Compare commits
12 Commits
0e2583caff
...
1680852b14
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1680852b14 | ||
|
|
90e345937a | ||
|
|
300be53a3a | ||
|
|
50044f5cb5 | ||
|
|
0be2e08b8f | ||
|
|
c925b830fe | ||
|
|
bf8cef9c8c | ||
|
|
7e4360402e | ||
|
|
df4212387d | ||
|
|
5f893affec | ||
|
|
e41cfeff7f | ||
|
|
e72959d436 |
@ -12,8 +12,15 @@
|
||||
* If two pipe anchors are connected, one having a type set and one still being "none", instead of erroring, the "none" pipe will assume the other one's type
|
||||
* Self-chargers in battery sockets now produce unreliable power output which constantly fluctuates
|
||||
* Self-chargers in battery sockets now cause static discharges in regular intervals
|
||||
* Added more RoR functionality to the boilers, industrial combustion engine, CCGT and ZIRNOX
|
||||
* The industrial steam turbine now has OpenComputers integration
|
||||
* Crates now open when right-clicked by default, holding shift is required to place them down
|
||||
* The automatic buzzsaw can now burn coal tar creosote
|
||||
* The old cluster type effect used by MPBs and cluster missiles now use the new generic projectile system with actual bomblet models
|
||||
* Removed the legacy fusion reactor entirely
|
||||
|
||||
## Fixed
|
||||
* Fixed uncrafting of the nickel RTG pellet not respecting item metadata
|
||||
* Tile entities that use fluids should now force the chunk they are in to be written to disk when unloaded
|
||||
* This should fix the issue where systems that constantly move fluids around may not properly save to disk
|
||||
* This should fix the issue where systems that constantly move fluids around may not properly save to disk
|
||||
* Fixed dispensed dynamites being considered impact grenades for some reason
|
||||
@ -875,9 +875,6 @@ public class ModBlocks {
|
||||
@Deprecated public static Block fusion_heater;
|
||||
@Deprecated public static Block fusion_hatch;
|
||||
|
||||
@Deprecated public static Block iter;
|
||||
@Deprecated public static Block plasma_heater;
|
||||
|
||||
public static Block fusion_component;
|
||||
public static Block fusion_torus;
|
||||
public static Block fusion_klystron;
|
||||
@ -1135,8 +1132,6 @@ public class ModBlocks {
|
||||
|
||||
public static Block statue_elb_f;
|
||||
|
||||
public static Block cheater_virus;
|
||||
public static Block cheater_virus_seed;
|
||||
public static Block crystal_virus;
|
||||
public static Block crystal_hardened;
|
||||
public static Block crystal_pulsar;
|
||||
@ -1995,8 +1990,6 @@ public class ModBlocks {
|
||||
|
||||
fusion_heater = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_heater_top").setBlockName("fusion_heater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_heater_side");
|
||||
fusion_hatch = new FusionHatch(Material.iron).setBlockName("fusion_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_hatch");
|
||||
iter = new MachineITER().setBlockName("iter").setHardness(5.0F).setResistance(60.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":iter");
|
||||
plasma_heater = new MachinePlasmaHeater().setBlockName("plasma_heater").setHardness(5.0F).setResistance(60.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":plasma_heater");
|
||||
|
||||
fusion_component = new BlockFusionComponent().setBlockName("fusion_component").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_component");
|
||||
fusion_torus = new MachineFusionTorus().setBlockName("fusion_torus").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -2273,8 +2266,6 @@ public class ModBlocks {
|
||||
|
||||
machine_forcefield = new MachineForceField(Material.iron).setBlockName("machine_forcefield").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_forcefield");
|
||||
|
||||
cheater_virus = new CheaterVirus(Material.iron).setBlockName("cheater_virus").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus");
|
||||
cheater_virus_seed = new CheaterVirusSeed(Material.iron).setBlockName("cheater_virus_seed").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus_seed");
|
||||
crystal_virus = new CrystalVirus(Material.iron).setBlockName("crystal_virus").setHardness(15.0F).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crystal_virus");
|
||||
crystal_hardened = new BlockGeneric(Material.iron).setBlockName("crystal_hardened").setHardness(15.0F).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crystal_hardened");
|
||||
crystal_pulsar = new CrystalPulsar(Material.iron).setBlockName("crystal_pulsar").setHardness(15.0F).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":crystal_pulsar");
|
||||
@ -3360,8 +3351,6 @@ public class ModBlocks {
|
||||
//Multiblock Generators
|
||||
GameRegistry.registerBlock(fusion_heater, fusion_heater.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(fusion_hatch, fusion_hatch.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(iter, iter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(plasma_heater, plasma_heater.getUnlocalizedName());
|
||||
|
||||
register(fusion_component);
|
||||
register(fusion_torus);
|
||||
@ -3496,8 +3485,6 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(crystal_hardened, crystal_hardened.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(crystal_pulsar, crystal_pulsar.getUnlocalizedName());
|
||||
register(taint);
|
||||
GameRegistry.registerBlock(cheater_virus, cheater_virus.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cheater_virus_seed, cheater_virus_seed.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(ntm_dirt, ntm_dirt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(pink_log, pink_log.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(pink_planks, pink_planks.getUnlocalizedName());
|
||||
|
||||
@ -159,11 +159,11 @@ public class BombMulti extends BlockContainer implements IBomb {
|
||||
explosionValue = 0;
|
||||
|
||||
if(clusterCount > 0) {
|
||||
ExplosionChaos.cluster(world, x, y, z, clusterCount, 1);
|
||||
ExplosionChaos.cluster(world, x + 0.5, y + 0.5, z + 0.5, clusterCount, 0, 0, (float) Math.PI * 2F, (float) Math.PI * 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
if(fireRadius > 0) {
|
||||
ExplosionChaos.burn(world, x, y, z, fireRadius);
|
||||
ExplosionChaos.igniteAllBlocks(world, x, y, z, fireRadius);
|
||||
}
|
||||
|
||||
if(poisonRadius > 0) {
|
||||
|
||||
@ -1,94 +0,0 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.explosion.ExplosionChaos;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CheaterVirus extends Block {
|
||||
|
||||
static boolean protect = true;
|
||||
|
||||
public CheaterVirus(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int i)
|
||||
{
|
||||
super.breakBlock(world, x, y, z, block, i);
|
||||
|
||||
if(CheaterVirus.protect)
|
||||
world.setBlock(x, y, z, this, i, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
if(GeneralConfig.enableVirus){
|
||||
if(world.getBlock(x + 1, y, z) != ModBlocks.cheater_virus && world.getBlock(x + 1, y, z) != Blocks.air && world.getBlock(x + 1, y, z) != ModBlocks.cheater_virus) {
|
||||
world.setBlock(x + 1, y, z, ModBlocks.cheater_virus);
|
||||
}
|
||||
|
||||
if(world.getBlock(x, y + 1, z) != ModBlocks.cheater_virus && world.getBlock(x, y + 1, z) != Blocks.air && world.getBlock(x, y + 1, z) != ModBlocks.cheater_virus) {
|
||||
world.setBlock(x, y + 1, z, ModBlocks.cheater_virus);
|
||||
}
|
||||
|
||||
if(world.getBlock(x, y, z + 1) != ModBlocks.cheater_virus && world.getBlock(x, y, z + 1) != Blocks.air && world.getBlock(x, y, z + 1) != ModBlocks.cheater_virus) {
|
||||
world.setBlock(x, y, z + 1, ModBlocks.cheater_virus);
|
||||
}
|
||||
|
||||
if(world.getBlock(x - 1, y, z) != ModBlocks.cheater_virus && world.getBlock(x - 1, y, z) != Blocks.air && world.getBlock(x - 1, y, z) != ModBlocks.cheater_virus) {
|
||||
world.setBlock(x - 1, y, z, ModBlocks.cheater_virus);
|
||||
}
|
||||
|
||||
if(world.getBlock(x, y - 1, z) != ModBlocks.cheater_virus && world.getBlock(x, y - 1, z) != Blocks.air && world.getBlock(x, y - 1, z) != ModBlocks.cheater_virus) {
|
||||
world.setBlock(x, y - 1, z, ModBlocks.cheater_virus);
|
||||
}
|
||||
|
||||
if(world.getBlock(x, y, z - 1) != ModBlocks.cheater_virus && world.getBlock(x, y, z - 1) != Blocks.air && world.getBlock(x, y, z - 1) != ModBlocks.cheater_virus) {
|
||||
world.setBlock(x, y, z - 1, ModBlocks.cheater_virus);
|
||||
}
|
||||
|
||||
protect = false;
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
protect = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
|
||||
if((world.getBlock(x + 1, y, z) == Blocks.air || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x - 1, y, z) == Blocks.air || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y + 1, z) == Blocks.air || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y - 1, z) == Blocks.air || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z + 1) == Blocks.air || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z - 1) == Blocks.air || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus_seed) &&
|
||||
!world.isRemote) {
|
||||
protect = false;
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
ExplosionChaos.spreadVirus(world, x, y, z, 5);
|
||||
protect = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity entity)
|
||||
{
|
||||
if(entity instanceof EntityLivingBase) {
|
||||
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.wither.id, 60 * 60 * 60, 9));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CheaterVirusSeed extends Block {
|
||||
|
||||
public CheaterVirusSeed(Material p_i45394_1_) {
|
||||
|
||||
super(p_i45394_1_);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
|
||||
|
||||
super.breakBlock(world, x, y, z, block, i);
|
||||
|
||||
if(!GeneralConfig.enableVirus)
|
||||
return;
|
||||
|
||||
if((world.getBlock(x + 1, y, z) == Blocks.air || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x - 1, y, z) == Blocks.air || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y + 1, z) == Blocks.air || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y - 1, z) == Blocks.air || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z + 1) == Blocks.air || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z - 1) == Blocks.air || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus_seed) &&
|
||||
!world.isRemote) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
} else {
|
||||
world.setBlock(x, y, z, ModBlocks.cheater_virus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
if(!GeneralConfig.enableVirus)
|
||||
return;
|
||||
|
||||
if((world.getBlock(x + 1, y, z) == Blocks.air || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x - 1, y, z) == Blocks.air || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y + 1, z) == Blocks.air || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y - 1, z) == Blocks.air || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z + 1) == Blocks.air || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z - 1) == Blocks.air || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus_seed) &&
|
||||
!world.isRemote) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
} else {
|
||||
world.setBlock(x, y, z, ModBlocks.cheater_virus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
|
||||
if((world.getBlock(x + 1, y, z) == Blocks.air || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x + 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x - 1, y, z) == Blocks.air || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus || world.getBlock(x - 1, y, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y + 1, z) == Blocks.air || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y + 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y - 1, z) == Blocks.air || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus || world.getBlock(x, y - 1, z) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z + 1) == Blocks.air || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z + 1) == ModBlocks.cheater_virus_seed) &&
|
||||
(world.getBlock(x, y, z - 1) == Blocks.air || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus || world.getBlock(x, y, z - 1) == ModBlocks.cheater_virus_seed) &&
|
||||
!world.isRemote) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,231 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityITER;
|
||||
import com.hbm.tileentity.machine.TileEntityITERStruct;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class MachineITER extends BlockDummyable {
|
||||
|
||||
public MachineITER() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityITER();
|
||||
|
||||
if(meta >= 6)
|
||||
return new TileEntityProxyCombo(true, true, true);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
//because we'll implement our own gnarly behavior here
|
||||
return new int[] { 0, 0, 0, 0, 0, 0 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
TileEntityITER entity = (TileEntityITER) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int height = 2;
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
|
||||
if(!(player instanceof EntityPlayer))
|
||||
return;
|
||||
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
EntityPlayer pl = (EntityPlayer) player;
|
||||
|
||||
int o = getOffset();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.NORTH;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
dir = ForgeDirection.getOrientation(2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
dir = ForgeDirection.getOrientation(5);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
dir = ForgeDirection.getOrientation(3);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
dir = ForgeDirection.getOrientation(4);
|
||||
}
|
||||
|
||||
dir = dir.getOpposite();
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
if(!checkRequirement(world, x, y, z, dir, o)) {
|
||||
|
||||
if(!pl.capabilities.isCreativeMode) {
|
||||
ItemStack stack = pl.inventory.mainInventory[pl.inventory.currentItem];
|
||||
Item item = Item.getItemFromBlock(this);
|
||||
|
||||
if(stack == null) {
|
||||
pl.inventory.mainInventory[pl.inventory.currentItem] = new ItemStack(this);
|
||||
} else {
|
||||
if(stack.getItem() != item || stack.stackSize == stack.getMaxStackSize()) {
|
||||
pl.inventory.addItemStackToInventory(new ItemStack(this));
|
||||
} else {
|
||||
pl.getHeldItem().stackSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pl.getHeldItem().stackSize--;
|
||||
|
||||
world.setBlock(x + dir.offsetX * o , y + dir.offsetY * o + height, z + dir.offsetZ * o, this, dir.ordinal() + offset, 3);
|
||||
this.safeRem = true;
|
||||
fillSpace(world, x, y, z, dir, o);
|
||||
this.safeRem = false;
|
||||
world.scheduleBlockUpdate(x, y, z, this, 1);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
x = x + dir.offsetX * o;
|
||||
z = z + dir.offsetZ * o;
|
||||
|
||||
int[][][] layout = TileEntityITERStruct.collisionMask;
|
||||
|
||||
for(int iy = 0; iy < 5; iy++) {
|
||||
|
||||
int l = iy > 2 ? 4 - iy : iy;
|
||||
int[][] layer = layout[l];
|
||||
|
||||
for(int ix = 0; ix < layer.length; ix++) {
|
||||
|
||||
for(int iz = 0; iz < layer.length; iz++) {
|
||||
|
||||
int ex = ix - layer.length / 2;
|
||||
int ez = iz - layer.length / 2;
|
||||
|
||||
if(ex == 0 && y == 2 && ez == 0)
|
||||
continue;
|
||||
|
||||
if(!world.getBlock(x + ex, y + iy, z + ez).canPlaceBlockAt(world, x + ex, y + iy, z + ez)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
x = x + dir.offsetX * o;
|
||||
z = z + dir.offsetZ * o;
|
||||
|
||||
int[][][] layout = TileEntityITERStruct.collisionMask;
|
||||
|
||||
for(int iy = 0; iy < 5; iy++) {
|
||||
|
||||
int l = iy > 2 ? 4 - iy : iy;
|
||||
int[][] layer = layout[l];
|
||||
|
||||
for(int ix = 0; ix < layer.length; ix++) {
|
||||
|
||||
for(int iz = 0; iz < layer[0].length; iz++) {
|
||||
|
||||
int ex = ix - layer.length / 2;
|
||||
int ez = iz - layer.length / 2;
|
||||
|
||||
int meta = 0;
|
||||
|
||||
if(iy < 2) {
|
||||
meta = ForgeDirection.DOWN.ordinal();
|
||||
} else if(iy > 2) {
|
||||
meta = ForgeDirection.UP.ordinal();
|
||||
} else if(ex < 0) {
|
||||
meta = ForgeDirection.WEST.ordinal();
|
||||
} else if(ex > 0) {
|
||||
meta = ForgeDirection.EAST.ordinal();
|
||||
} else if(ez < 0) {
|
||||
meta = ForgeDirection.NORTH.ordinal();
|
||||
} else if(ez > 0) {
|
||||
meta = ForgeDirection.SOUTH.ordinal();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(layout[l][ix][iz] > 0)
|
||||
world.setBlock(x + ex, y + iy, z + ez, this, meta, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.makeExtra(world, x, y, z);
|
||||
this.makeExtra(world, x, y + 4, z);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(5.75, 0, 0);
|
||||
|
||||
for(int i = 0; i < 16; i++) {
|
||||
vec.rotateAroundY((float) (Math.PI / 8));
|
||||
this.makeExtra(world, x + (int)vec.xCoord, y, z + (int)vec.zCoord);
|
||||
this.makeExtra(world, x + (int)vec.xCoord, y + 4, z + (int)vec.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,124 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachinePlasmaHeater extends BlockDummyable {
|
||||
|
||||
public MachinePlasmaHeater() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityMachinePlasmaHeater();
|
||||
|
||||
if(meta >= 6)
|
||||
return new TileEntityProxyCombo(false, true, true);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
TileEntityMachinePlasmaHeater entity = (TileEntityMachinePlasmaHeater) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -3, 2, 1, 1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 2, z + dir.offsetZ * o, new int[] {0, 1, 10, -8, 0, 0}, this, dir);
|
||||
|
||||
ForgeDirection side = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
for(int i = 1; i < 4; i++) {
|
||||
for(int j = -1; j < 2; j++) {
|
||||
|
||||
this.makeExtra(world, x + side.offsetX * j, y + i, z + side.offsetZ * j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
|
||||
float f = 0.0625F;
|
||||
|
||||
if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + f * 8F, z + 1);
|
||||
} else if(world.getBlockMetadata(x, y, z) == ForgeDirection.DOWN.ordinal() && world.getBlock(x, y - 1, z) != this) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y + f * 8F, z, x + 1, y + 1, z + 1);
|
||||
} else {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
|
||||
float f = 0.0625F;
|
||||
|
||||
if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f * 8F, 1.0F);
|
||||
} else if(world.getBlockMetadata(x, y, z) == ForgeDirection.DOWN.ordinal() && world.getBlock(x, y - 1, z) != this) {
|
||||
this.setBlockBounds(0.0F, f * 8F, 0.0F, 1, 1.0F, 1.0F);
|
||||
} else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir))
|
||||
return false;
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -3, 1, 1, 1, 1}, x, y, z, dir))
|
||||
return false;
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 2, z + dir.offsetZ * o, new int[] {0, 1, 10, -8, 0, 0}, x, y, z, dir))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {3, 0, 8, 1, 1, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -41,9 +41,7 @@ public class EntityMappings {
|
||||
|
||||
public static void writeMappings() {
|
||||
|
||||
addEntity(EntityRocket.class, "entity_rocket", 250);
|
||||
addEntity(EntityBullet.class, "entity_bullet", 250);
|
||||
addEntity(EntitySchrab.class, "entity_schrabnel", 500);
|
||||
addEntity(EntityMissileGeneric.class, "entity_missile_generic", 1000);
|
||||
addEntity(EntityMissileDecoy.class, "entity_missile_decoy", 1000);
|
||||
addEntity(EntityMissileStrong.class, "entity_missile_strong", 1000);
|
||||
@ -121,7 +119,6 @@ public class EntityMappings {
|
||||
addEntity(EntityDeliveryDrone.class, "entity_delivery_drone", 250, false);
|
||||
addEntity(EntityRequestDrone.class, "entity_request_drone", 250, false);
|
||||
addEntity(EntityCloudTom.class, "entity_moonstone_blast", 1000);
|
||||
addEntity(EntityBeamVortex.class, "entity_vortex_beam", 1000);
|
||||
addEntity(EntityFireworks.class, "entity_firework_ball", 1000);
|
||||
addEntity(EntityWastePearl.class, "entity_waste_pearl", 1000);
|
||||
addEntity(EntityBOTPrimeHead.class, "entity_balls_o_tron", 1000);
|
||||
@ -138,7 +135,6 @@ public class EntityMappings {
|
||||
addEntity(EntitySiegeLaser.class, "entity_ntm_siege_laser", 1000);
|
||||
addEntity(EntityTNTPrimedBase.class, "entity_ntm_tnt_primed", 1000);
|
||||
addEntity(EntityGrenadeBouncyGeneric.class, "entity_grenade_bouncy_generic", 250);
|
||||
addEntity(EntityGrenadeImpactGeneric.class, "entity_grenade_impact_generic", 250);
|
||||
addEntity(EntityMinecartCrate.class, "entity_ntm_cart_crate", 250, false);
|
||||
addEntity(EntityMinecartDestroyer.class, "entity_ntm_cart_destroyer", 250, false);
|
||||
addEntity(EntityMinecartOre.class, "entity_ntm_cart_ore", 250, false);
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
package com.hbm.entity.grenade;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.ItemGenericGrenade;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGrenadeImpactGeneric extends EntityGrenadeBase implements IGenericGrenade {
|
||||
|
||||
public EntityGrenadeImpactGeneric(World p_i1773_1_) {
|
||||
super(p_i1773_1_);
|
||||
}
|
||||
|
||||
public EntityGrenadeImpactGeneric(World p_i1774_1_, EntityLivingBase p_i1774_2_) {
|
||||
super(p_i1774_1_, p_i1774_2_);
|
||||
}
|
||||
|
||||
public EntityGrenadeImpactGeneric(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
|
||||
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
|
||||
}
|
||||
|
||||
public EntityGrenadeImpactGeneric setType(ItemGenericGrenade grenade) {
|
||||
this.dataWatcher.updateObject(12, Item.getIdFromItem(grenade));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemGenericGrenade getGrenade() {
|
||||
ItemGenericGrenade gren = (ItemGenericGrenade) Item.getItemById(this.dataWatcher.getWatchableObjectInt(12));
|
||||
return gren != null ? gren : (ItemGenericGrenade) ModItems.stick_dynamite;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(12, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explode() {
|
||||
|
||||
if(!this.worldObj.isRemote && getGrenade() != null) {
|
||||
getGrenade().explode(this, this.getThrower(), worldObj, posX, posY, posZ);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setInteger("grenade", this.dataWatcher.getWatchableObjectInt(12));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.dataWatcher.updateObject(12, nbt.getInteger("grenade"));
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@ public abstract class EntityMissileTier1 extends EntityMissileBaseNT {
|
||||
public EntityMissileCluster(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); this.isCluster = true; }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 5F, true);
|
||||
ExplosionChaos.cluster(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 25, 100);
|
||||
ExplosionChaos.cluster(this.worldObj, this.posX, this.posY, this.posZ, 25, this.rotationYaw, this.rotationPitch, (float) Math.PI * 0.25F, (float) Math.PI * 0.25F, 1F);
|
||||
}
|
||||
@Override public void cluster() { this.onMissileImpact(null); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_cluster_small); }
|
||||
|
||||
@ -54,7 +54,7 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.explodeStandard(30F, 32, true);
|
||||
ExplosionCreator.composeEffectStandard(worldObj, posX, posY, posZ);
|
||||
ExplosionChaos.flameDeath(this.worldObj, (int)((float)this.posX + 0.5F), (int)((float)this.posY + 0.5F), (int)((float)this.posZ + 0.5F), 25);
|
||||
ExplosionChaos.igniteFlammableBlocks(this.worldObj, (int)((float)this.posX + 0.5F), (int)((float)this.posY + 0.5F), (int)((float)this.posZ + 0.5F), 25);
|
||||
}
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_incendiary_medium); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_incendiary_strong); }
|
||||
@ -65,7 +65,7 @@ public abstract class EntityMissileTier2 extends EntityMissileBaseNT {
|
||||
public EntityMissileClusterStrong(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); this.isCluster = true; }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 15F, true);
|
||||
ExplosionChaos.cluster(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 50, 100);
|
||||
ExplosionChaos.cluster(this.worldObj, this.posX, this.posY, this.posZ, 50, this.rotationYaw, this.rotationPitch, (float) Math.PI * 0.25F, (float) Math.PI * 0.25F, 1F);
|
||||
}
|
||||
@Override public void cluster() { this.onMissileImpact(null); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_cluster_medium); }
|
||||
|
||||
@ -73,8 +73,8 @@ public abstract class EntityMissileTier3 extends EntityMissileBaseNT {
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.explodeStandard(50F, 48, true);
|
||||
ExplosionCreator.composeEffectLarge(worldObj, posX, posY, posZ);
|
||||
ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 10);
|
||||
ExplosionChaos.flameDeath(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 25);
|
||||
ExplosionChaos.igniteAllBlocks(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 10);
|
||||
ExplosionChaos.igniteFlammableBlocks(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 25);
|
||||
}
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_incendiary_large); }
|
||||
@Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_inferno); }
|
||||
@ -85,7 +85,7 @@ public abstract class EntityMissileTier3 extends EntityMissileBaseNT {
|
||||
public EntityMissileRain(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); this.isCluster = true; }
|
||||
@Override public void onMissileImpact(MovingObjectPosition mop) {
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 25F, true);
|
||||
ExplosionChaos.cluster(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 100, 100);
|
||||
ExplosionChaos.cluster(this.worldObj, this.posX, this.posY, this.posZ, 100, this.rotationYaw, this.rotationPitch, (float) Math.PI * 0.25F, (float) Math.PI * 0.25F, 1F);
|
||||
}
|
||||
@Override public void cluster() { this.onMissileImpact(null); }
|
||||
@Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_cluster_large); }
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBeamVortex extends EntityBeamBase {
|
||||
|
||||
public EntityBeamVortex(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityBeamVortex(World world, EntityPlayer player) {
|
||||
super(world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if(this.ticksExisted > 10)
|
||||
this.setDead();
|
||||
|
||||
if(this.ticksExisted > 1)
|
||||
return;
|
||||
|
||||
int range = 100;
|
||||
|
||||
EntityPlayer player = worldObj.getPlayerEntityByName(this.dataWatcher.getWatchableObjectString(20));
|
||||
|
||||
if(player != null) {
|
||||
|
||||
MovingObjectPosition pos = Library.rayTrace(player, range, 1, false, true, false);
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
worldObj.spawnParticle("cloud", pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 0, 0, 0);
|
||||
worldObj.playSound(pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, "random.fizz", 1, 1, true);
|
||||
|
||||
List<Entity> list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(pos.hitVec.xCoord - 1, pos.hitVec.yCoord - 1, pos.hitVec.zCoord - 1, pos.hitVec.xCoord + 1, pos.hitVec.yCoord + 1, pos.hitVec.zCoord + 1));
|
||||
|
||||
for(Entity e : list)
|
||||
e.attackEntityFrom(ModDamageSource.radiation, 5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,634 +0,0 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.S2BPacketChangeGameState;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// still in use for cluster munitions - somehow! let this fucking class die already
|
||||
public class EntityRocket extends Entity implements IProjectile
|
||||
{
|
||||
private int field_145791_d = -1;
|
||||
private int field_145792_e = -1;
|
||||
private int field_145789_f = -1;
|
||||
public double gravity = 0.0D;
|
||||
private Block field_145790_g;
|
||||
private int inData;
|
||||
private boolean inGround;
|
||||
/** 1 if the player can pick up the arrow */
|
||||
public int canBePickedUp;
|
||||
/** Seems to be some sort of timer for animating an arrow. */
|
||||
public int arrowShake;
|
||||
/** The owner of this arrow. */
|
||||
public Entity shootingEntity;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private double damage = 2.0D;
|
||||
/** The amount of knockback an arrow applies when it hits a mob. */
|
||||
private int knockbackStrength;
|
||||
public EntityRocket(World p_i1753_1_)
|
||||
{
|
||||
super(p_i1753_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntityRocket(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_)
|
||||
{
|
||||
super(p_i1754_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(p_i1754_2_, p_i1754_4_, p_i1754_6_);
|
||||
this.yOffset = 0.0F;
|
||||
}
|
||||
|
||||
public EntityRocket(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
|
||||
{
|
||||
super(p_i1755_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = p_i1755_2_;
|
||||
|
||||
if (p_i1755_2_ instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.posY = p_i1755_2_.posY + p_i1755_2_.getEyeHeight() - 0.10000000149011612D;
|
||||
double d0 = p_i1755_3_.posX - p_i1755_2_.posX;
|
||||
double d1 = p_i1755_3_.boundingBox.minY + p_i1755_3_.height / 3.0F - this.posY;
|
||||
double d2 = p_i1755_3_.posZ - p_i1755_2_.posZ;
|
||||
double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
|
||||
|
||||
if (d3 >= 1.0E-7D)
|
||||
{
|
||||
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
|
||||
double d4 = d0 / d3;
|
||||
double d5 = d2 / d3;
|
||||
this.setLocationAndAngles(p_i1755_2_.posX + d4, this.posY, p_i1755_2_.posZ + d5, f2, f3);
|
||||
this.yOffset = 0.0F;
|
||||
float f4 = (float)d3 * 0.2F;
|
||||
this.setThrowableHeading(d0, d1 + f4, d2, p_i1755_4_, p_i1755_5_);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityRocket(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_)
|
||||
{
|
||||
super(p_i1756_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = p_i1756_2_;
|
||||
|
||||
if (p_i1756_2_ instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch);
|
||||
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
|
||||
this.posY -= 0.10000000149011612D;
|
||||
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI);
|
||||
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI);
|
||||
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
public EntityRocket(World world, int x, int y, int z, double mx, double my, double mz, double grav) {
|
||||
super(world);
|
||||
this.posX = x + 0.5F;
|
||||
this.posY = y + 0.5F;
|
||||
this.posZ = z + 0.5F;
|
||||
|
||||
this.motionX = mx;
|
||||
this.motionY = my;
|
||||
this.motionZ = mz;
|
||||
|
||||
this.gravity = grav;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
@Override
|
||||
public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_)
|
||||
{
|
||||
float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_);
|
||||
p_70186_1_ /= f2;
|
||||
p_70186_3_ /= f2;
|
||||
p_70186_5_ /= f2;
|
||||
p_70186_1_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * p_70186_8_;
|
||||
p_70186_3_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * p_70186_8_;
|
||||
p_70186_5_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * p_70186_8_;
|
||||
p_70186_1_ *= p_70186_7_;
|
||||
p_70186_3_ *= p_70186_7_;
|
||||
p_70186_5_ *= p_70186_7_;
|
||||
this.motionX = p_70186_1_;
|
||||
this.motionY = p_70186_3_;
|
||||
this.motionZ = p_70186_5_;
|
||||
float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, f3) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_)
|
||||
{
|
||||
this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
|
||||
this.setRotation(p_70056_7_, p_70056_8_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
|
||||
{
|
||||
this.motionX = p_70016_1_;
|
||||
this.motionY = p_70016_3_;
|
||||
this.motionZ = p_70016_5_;
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, f) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch;
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
//@Override
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
//this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block.getMaterial() != Material.air)
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.arrowShake > 0)
|
||||
{
|
||||
--this.arrowShake;
|
||||
}
|
||||
|
||||
if (this.inGround)
|
||||
{
|
||||
/*int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block == this.field_145790_g && j == this.inData)
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
if (this.ticksInGround == 1200)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
}*/
|
||||
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
//this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
/*EntityNukeExplosionAdvanced explosion = new EntityNukeExplosionAdvanced(this.worldObj);
|
||||
explosion.speed = 25;
|
||||
explosion.coefficient = 5.0F;
|
||||
explosion.destructionRange = 20;
|
||||
explosion.posX = this.posX;
|
||||
explosion.posY = this.posY;
|
||||
explosion.posZ = this.posZ;
|
||||
this.worldObj.spawnEntityInWorld(explosion);*/
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.ticksInAir;
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
|
||||
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
int i;
|
||||
float f1;
|
||||
|
||||
for (i = 0; i < list.size(); ++i)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(i);
|
||||
|
||||
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
|
||||
{
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
|
||||
|
||||
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
|
||||
{
|
||||
movingobjectposition = null;
|
||||
}
|
||||
}
|
||||
|
||||
float f2;
|
||||
float f4;
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
int k = MathHelper.ceiling_double_int(f2 * this.damage);
|
||||
|
||||
if (this.getIsCritical())
|
||||
{
|
||||
k += this.rand.nextInt(k / 2 + 2);
|
||||
}
|
||||
|
||||
DamageSource damagesource = null;
|
||||
|
||||
if (this.shootingEntity == null)
|
||||
{
|
||||
damagesource = DamageSource.causeIndirectMagicDamage(this, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
damagesource = DamageSource.causeIndirectMagicDamage(this, this);
|
||||
}
|
||||
|
||||
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
movingobjectposition.entityHit.setFire(5);
|
||||
}
|
||||
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k))
|
||||
{
|
||||
if (movingobjectposition.entityHit instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
|
||||
|
||||
if (this.knockbackStrength > 0)
|
||||
{
|
||||
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if (f4 > 0.0F)
|
||||
{
|
||||
movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase)
|
||||
{
|
||||
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
|
||||
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
//this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
//this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_145791_d = movingobjectposition.blockX;
|
||||
this.field_145792_e = movingobjectposition.blockY;
|
||||
this.field_145789_f = movingobjectposition.blockZ;
|
||||
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.motionX = ((float)(movingobjectposition.hitVec.xCoord - this.posX));
|
||||
this.motionY = ((float)(movingobjectposition.hitVec.yCoord - this.posY));
|
||||
this.motionZ = ((float)(movingobjectposition.hitVec.zCoord - this.posZ));
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
this.posX -= this.motionX / f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / f2 * 0.05000000074505806D;
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
this.setIsCritical(false);
|
||||
|
||||
if (this.field_145790_g.getMaterial() != Material.air)
|
||||
{
|
||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, /*0, 0, 0 this.posX + this.motionX * (double)i / 4.0D, this.posY + this.motionY * (double)i / 4.0D, this.posZ + this.motionZ * (double)i / 4.0D,*/ -this.motionX/4, -this.motionY/4, -this.motionZ/4);
|
||||
//this.worldObj.spawnEntityInWorld(new EntityGasFX(worldObj, this.posX - motionX/4*i, this.posY - motionY/4*i, this.posZ - motionZ/4*i, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
//for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
/*while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
|
||||
{
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
|
||||
{
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
|
||||
{
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}*/
|
||||
|
||||
//this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
//this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float f3 = 0.99F;
|
||||
f1 = 0.05F;
|
||||
|
||||
if (this.isInWater())
|
||||
{
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
f4 = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f3 = 0.8F;
|
||||
}
|
||||
|
||||
if (this.isWet())
|
||||
{
|
||||
this.extinguish();
|
||||
}
|
||||
|
||||
this.motionX *= f3;
|
||||
this.motionY *= f3;
|
||||
this.motionZ *= f3;
|
||||
this.motionY -= gravity;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.func_145775_I();
|
||||
}
|
||||
|
||||
if (this.ticksExisted > 250)
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
|
||||
{
|
||||
p_70014_1_.setShort("xTile", (short)this.field_145791_d);
|
||||
p_70014_1_.setShort("yTile", (short)this.field_145792_e);
|
||||
p_70014_1_.setShort("zTile", (short)this.field_145789_f);
|
||||
p_70014_1_.setShort("life", (short)this.ticksInGround);
|
||||
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g));
|
||||
p_70014_1_.setByte("inData", (byte)this.inData);
|
||||
p_70014_1_.setByte("shake", (byte)this.arrowShake);
|
||||
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
p_70014_1_.setByte("pickup", (byte)this.canBePickedUp);
|
||||
p_70014_1_.setDouble("damage", this.damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
|
||||
{
|
||||
this.field_145791_d = p_70037_1_.getShort("xTile");
|
||||
this.field_145792_e = p_70037_1_.getShort("yTile");
|
||||
this.field_145789_f = p_70037_1_.getShort("zTile");
|
||||
this.ticksInGround = p_70037_1_.getShort("life");
|
||||
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
||||
this.inData = p_70037_1_.getByte("inData") & 255;
|
||||
this.arrowShake = p_70037_1_.getByte("shake") & 255;
|
||||
this.inGround = p_70037_1_.getByte("inGround") == 1;
|
||||
|
||||
if (p_70037_1_.hasKey("damage", 99))
|
||||
{
|
||||
this.damage = p_70037_1_.getDouble("damage");
|
||||
}
|
||||
|
||||
if (p_70037_1_.hasKey("pickup", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getByte("pickup");
|
||||
}
|
||||
else if (p_70037_1_.hasKey("player", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by a player entity when they collide with an entity
|
||||
*/
|
||||
@Override
|
||||
public void onCollideWithPlayer(EntityPlayer p_70100_1_)
|
||||
{
|
||||
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
|
||||
{
|
||||
boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && p_70100_1_.capabilities.isCreativeMode;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
p_70100_1_.onItemPickup(this, 1);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||
* prevent them from trampling crops
|
||||
*/
|
||||
@Override
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public void setDamage(double p_70239_1_)
|
||||
{
|
||||
this.damage = p_70239_1_;
|
||||
}
|
||||
|
||||
public double getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of knockback the arrow applies when it hits a mob.
|
||||
*/
|
||||
public void setKnockbackStrength(int p_70240_1_)
|
||||
{
|
||||
this.knockbackStrength = p_70240_1_;
|
||||
}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
@Override
|
||||
public boolean canAttackWithItem()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the arrow has a stream of critical hit particles flying behind it.
|
||||
*/
|
||||
public void setIsCritical(boolean p_70243_1_)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (p_70243_1_)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the arrow has a stream of critical hit particles flying behind it.
|
||||
*/
|
||||
public boolean getIsCritical()
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
return (b0 & 1) != 0;
|
||||
}
|
||||
}
|
||||
@ -1,632 +0,0 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.S2BPacketChangeGameState;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.hbm.explosion.ExplosionChaos;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntitySchrab extends Entity implements IProjectile
|
||||
{
|
||||
private int field_145791_d = -1;
|
||||
private int field_145792_e = -1;
|
||||
private int field_145789_f = -1;
|
||||
public double gravity = 0.0D;
|
||||
private Block field_145790_g;
|
||||
private int inData;
|
||||
private boolean inGround;
|
||||
/** 1 if the player can pick up the arrow */
|
||||
public int canBePickedUp;
|
||||
/** Seems to be some sort of timer for animating an arrow. */
|
||||
public int arrowShake;
|
||||
/** The owner of this arrow. */
|
||||
public Entity shootingEntity;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private double damage = 2.0D;
|
||||
/** The amount of knockback an arrow applies when it hits a mob. */
|
||||
private int knockbackStrength;
|
||||
public EntitySchrab(World p_i1753_1_)
|
||||
{
|
||||
super(p_i1753_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntitySchrab(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_)
|
||||
{
|
||||
super(p_i1754_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(p_i1754_2_, p_i1754_4_, p_i1754_6_);
|
||||
this.yOffset = 0.0F;
|
||||
}
|
||||
|
||||
public EntitySchrab(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_)
|
||||
{
|
||||
super(p_i1755_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = p_i1755_2_;
|
||||
|
||||
if (p_i1755_2_ instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.posY = p_i1755_2_.posY + p_i1755_2_.getEyeHeight() - 0.10000000149011612D;
|
||||
double d0 = p_i1755_3_.posX - p_i1755_2_.posX;
|
||||
double d1 = p_i1755_3_.boundingBox.minY + p_i1755_3_.height / 3.0F - this.posY;
|
||||
double d2 = p_i1755_3_.posZ - p_i1755_2_.posZ;
|
||||
double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
|
||||
|
||||
if (d3 >= 1.0E-7D)
|
||||
{
|
||||
float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI));
|
||||
double d4 = d0 / d3;
|
||||
double d5 = d2 / d3;
|
||||
this.setLocationAndAngles(p_i1755_2_.posX + d4, this.posY, p_i1755_2_.posZ + d5, f2, f3);
|
||||
this.yOffset = 0.0F;
|
||||
float f4 = (float)d3 * 0.2F;
|
||||
this.setThrowableHeading(d0, d1 + f4, d2, p_i1755_4_, p_i1755_5_);
|
||||
}
|
||||
}
|
||||
|
||||
public EntitySchrab(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_)
|
||||
{
|
||||
super(p_i1756_1_);
|
||||
this.renderDistanceWeight = 10.0D;
|
||||
this.shootingEntity = p_i1756_2_;
|
||||
|
||||
if (p_i1756_2_ instanceof EntityPlayer)
|
||||
{
|
||||
this.canBePickedUp = 1;
|
||||
}
|
||||
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch);
|
||||
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
|
||||
this.posY -= 0.10000000149011612D;
|
||||
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.yOffset = 0.0F;
|
||||
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI);
|
||||
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI);
|
||||
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
|
||||
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
public EntitySchrab(World world, int x, int y, int z, double mx, double my, double mz, double grav) {
|
||||
super(world);
|
||||
this.posX = x + 0.5F;
|
||||
this.posY = y + 0.5F;
|
||||
this.posZ = z + 0.5F;
|
||||
|
||||
this.motionX = mx;
|
||||
this.motionY = my;
|
||||
this.motionZ = mz;
|
||||
|
||||
this.gravity = grav;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit()
|
||||
{
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction.
|
||||
*/
|
||||
@Override
|
||||
public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_)
|
||||
{
|
||||
float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_);
|
||||
p_70186_1_ /= f2;
|
||||
p_70186_3_ /= f2;
|
||||
p_70186_5_ /= f2;
|
||||
p_70186_1_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * p_70186_8_;
|
||||
p_70186_3_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * p_70186_8_;
|
||||
p_70186_5_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * p_70186_8_;
|
||||
p_70186_1_ *= p_70186_7_;
|
||||
p_70186_3_ *= p_70186_7_;
|
||||
p_70186_5_ *= p_70186_7_;
|
||||
this.motionX = p_70186_1_;
|
||||
this.motionY = p_70186_3_;
|
||||
this.motionZ = p_70186_5_;
|
||||
float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, f3) * 180.0D / Math.PI);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
|
||||
* posY, posZ, yaw, pitch
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_)
|
||||
{
|
||||
this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
|
||||
this.setRotation(p_70056_7_, p_70056_8_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity to the args. Args: x, y, z
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_)
|
||||
{
|
||||
this.motionX = p_70016_1_;
|
||||
this.motionY = p_70016_3_;
|
||||
this.motionZ = p_70016_5_;
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, f) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch;
|
||||
this.prevRotationYaw = this.rotationYaw;
|
||||
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
|
||||
this.ticksInGround = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
//@Override
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
//this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
|
||||
}
|
||||
|
||||
Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block.getMaterial() != Material.air)
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
|
||||
{
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.arrowShake > 0)
|
||||
{
|
||||
--this.arrowShake;
|
||||
}
|
||||
|
||||
if (this.inGround)
|
||||
{
|
||||
/*int j = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
|
||||
if (block == this.field_145790_g && j == this.inData)
|
||||
{
|
||||
++this.ticksInGround;
|
||||
|
||||
if (this.ticksInGround == 1200)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inGround = false;
|
||||
this.motionX *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionY *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.motionZ *= (double)(this.rand.nextFloat() * 0.2F);
|
||||
this.ticksInGround = 0;
|
||||
this.ticksInAir = 0;
|
||||
}*/
|
||||
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
|
||||
ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 10);
|
||||
ExplosionChaos.flameDeath(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 20);
|
||||
ExplosionNukeGeneric.wasteNoSchrab(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 20);
|
||||
ExplosionChaos.poison(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 20);
|
||||
}
|
||||
this.worldObj.spawnEntityInWorld(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ));
|
||||
this.setDead();
|
||||
}
|
||||
else
|
||||
{
|
||||
++this.ticksInAir;
|
||||
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
|
||||
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
int i;
|
||||
float f1;
|
||||
|
||||
for (i = 0; i < list.size(); ++i)
|
||||
{
|
||||
Entity entity1 = (Entity)list.get(i);
|
||||
|
||||
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
|
||||
{
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
double d1 = vec31.distanceTo(movingobjectposition1.hitVec);
|
||||
|
||||
if (d1 < d0 || d0 == 0.0D)
|
||||
{
|
||||
entity = entity1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
movingobjectposition = new MovingObjectPosition(entity);
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;
|
||||
|
||||
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
|
||||
{
|
||||
movingobjectposition = null;
|
||||
}
|
||||
}
|
||||
|
||||
float f2;
|
||||
float f4;
|
||||
|
||||
if (movingobjectposition != null)
|
||||
{
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
int k = MathHelper.ceiling_double_int(f2 * this.damage);
|
||||
|
||||
if (this.getIsCritical())
|
||||
{
|
||||
k += this.rand.nextInt(k / 2 + 2);
|
||||
}
|
||||
|
||||
DamageSource damagesource = null;
|
||||
|
||||
if (this.shootingEntity == null)
|
||||
{
|
||||
damagesource = DamageSource.causeIndirectMagicDamage(this, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
damagesource = DamageSource.causeIndirectMagicDamage(this, this);
|
||||
}
|
||||
|
||||
if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
movingobjectposition.entityHit.setFire(5);
|
||||
}
|
||||
|
||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k))
|
||||
{
|
||||
if (movingobjectposition.entityHit instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit;
|
||||
|
||||
if (this.knockbackStrength > 0)
|
||||
{
|
||||
f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if (f4 > 0.0F)
|
||||
{
|
||||
movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase)
|
||||
{
|
||||
EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity);
|
||||
EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase);
|
||||
}
|
||||
|
||||
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.5F, true);
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.motionX *= -0.10000000149011612D;
|
||||
this.motionY *= -0.10000000149011612D;
|
||||
this.motionZ *= -0.10000000149011612D;
|
||||
this.rotationYaw += 180.0F;
|
||||
this.prevRotationYaw += 180.0F;
|
||||
this.ticksInAir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_145791_d = movingobjectposition.blockX;
|
||||
this.field_145792_e = movingobjectposition.blockY;
|
||||
this.field_145789_f = movingobjectposition.blockZ;
|
||||
this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
this.motionX = ((float)(movingobjectposition.hitVec.xCoord - this.posX));
|
||||
this.motionY = ((float)(movingobjectposition.hitVec.yCoord - this.posY));
|
||||
this.motionZ = ((float)(movingobjectposition.hitVec.zCoord - this.posZ));
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
this.posX -= this.motionX / f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / f2 * 0.05000000074505806D;
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
this.setIsCritical(false);
|
||||
|
||||
if (this.field_145790_g.getMaterial() != Material.air)
|
||||
{
|
||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0, 0, 0 /*this.posX + this.motionX * (double)i / 4.0D, this.posY + this.motionY * (double)i / 4.0D, this.posZ + this.motionZ * (double)i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ*/);
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
this.posY += this.motionY;
|
||||
this.posZ += this.motionZ;
|
||||
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||
|
||||
//for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
/*while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
|
||||
{
|
||||
this.prevRotationPitch += 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
|
||||
{
|
||||
this.prevRotationYaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
|
||||
{
|
||||
this.prevRotationYaw += 360.0F;
|
||||
}*/
|
||||
|
||||
//this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||
//this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||
float f3 = 0.99F;
|
||||
f1 = 0.05F;
|
||||
|
||||
if (this.isInWater())
|
||||
{
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
f4 = 0.25F;
|
||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f4, this.posY - this.motionY * f4, this.posZ - this.motionZ * f4, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
f3 = 0.8F;
|
||||
}
|
||||
|
||||
if (this.isWet())
|
||||
{
|
||||
this.extinguish();
|
||||
}
|
||||
|
||||
this.motionX *= f3;
|
||||
this.motionY *= f3;
|
||||
this.motionZ *= f3;
|
||||
this.motionY -= gravity;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.func_145775_I();
|
||||
}
|
||||
|
||||
if (this.ticksExisted > 250)
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound p_70014_1_)
|
||||
{
|
||||
p_70014_1_.setShort("xTile", (short)this.field_145791_d);
|
||||
p_70014_1_.setShort("yTile", (short)this.field_145792_e);
|
||||
p_70014_1_.setShort("zTile", (short)this.field_145789_f);
|
||||
p_70014_1_.setShort("life", (short)this.ticksInGround);
|
||||
p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g));
|
||||
p_70014_1_.setByte("inData", (byte)this.inData);
|
||||
p_70014_1_.setByte("shake", (byte)this.arrowShake);
|
||||
p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0));
|
||||
p_70014_1_.setByte("pickup", (byte)this.canBePickedUp);
|
||||
p_70014_1_.setDouble("damage", this.damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound p_70037_1_)
|
||||
{
|
||||
this.field_145791_d = p_70037_1_.getShort("xTile");
|
||||
this.field_145792_e = p_70037_1_.getShort("yTile");
|
||||
this.field_145789_f = p_70037_1_.getShort("zTile");
|
||||
this.ticksInGround = p_70037_1_.getShort("life");
|
||||
this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255);
|
||||
this.inData = p_70037_1_.getByte("inData") & 255;
|
||||
this.arrowShake = p_70037_1_.getByte("shake") & 255;
|
||||
this.inGround = p_70037_1_.getByte("inGround") == 1;
|
||||
|
||||
if (p_70037_1_.hasKey("damage", 99))
|
||||
{
|
||||
this.damage = p_70037_1_.getDouble("damage");
|
||||
}
|
||||
|
||||
if (p_70037_1_.hasKey("pickup", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getByte("pickup");
|
||||
}
|
||||
else if (p_70037_1_.hasKey("player", 99))
|
||||
{
|
||||
this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by a player entity when they collide with an entity
|
||||
*/
|
||||
@Override
|
||||
public void onCollideWithPlayer(EntityPlayer p_70100_1_)
|
||||
{
|
||||
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
|
||||
{
|
||||
boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && p_70100_1_.capabilities.isCreativeMode;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
p_70100_1_.onItemPickup(this, 1);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||
* prevent them from trampling crops
|
||||
*/
|
||||
@Override
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public void setDamage(double p_70239_1_)
|
||||
{
|
||||
this.damage = p_70239_1_;
|
||||
}
|
||||
|
||||
public double getDamage()
|
||||
{
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount of knockback the arrow applies when it hits a mob.
|
||||
*/
|
||||
public void setKnockbackStrength(int p_70240_1_)
|
||||
{
|
||||
this.knockbackStrength = p_70240_1_;
|
||||
}
|
||||
|
||||
/**
|
||||
* If returns false, the item will not inflict any damage against entities.
|
||||
*/
|
||||
@Override
|
||||
public boolean canAttackWithItem()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the arrow has a stream of critical hit particles flying behind it.
|
||||
*/
|
||||
public void setIsCritical(boolean p_70243_1_)
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if (p_70243_1_)
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the arrow has a stream of critical hit particles flying behind it.
|
||||
*/
|
||||
public boolean getIsCritical()
|
||||
{
|
||||
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
|
||||
return (b0 & 1) != 0;
|
||||
}
|
||||
}
|
||||
@ -4,15 +4,13 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.item.EntityFallingBlockNT;
|
||||
import com.hbm.entity.particle.EntityCloudFX;
|
||||
import com.hbm.entity.particle.EntityModFX;
|
||||
import com.hbm.entity.particle.EntityOrangeFX;
|
||||
import com.hbm.entity.particle.EntityPinkCloudFX;
|
||||
import com.hbm.entity.projectile.EntityRocket;
|
||||
import com.hbm.entity.projectile.EntityRubble;
|
||||
import com.hbm.entity.projectile.EntitySchrab;
|
||||
import com.hbm.entity.projectile.EntityBulletBaseMK4;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.items.weapon.sedna.factory.XFactoryCatapult;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorRegistry;
|
||||
@ -24,7 +22,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@ -63,110 +60,7 @@ public class ExplosionChaos { //TODO: destroy this entire class
|
||||
}
|
||||
}
|
||||
|
||||
public static void spreadVirus(World world, int x, int y, int z, int bombStartStrength) {
|
||||
|
||||
int r = bombStartStrength;
|
||||
int r2 = r * r;
|
||||
int r22 = r2 / 2;
|
||||
for (int xx = -r; xx < r; xx++) {
|
||||
int X = xx + x;
|
||||
int XX = xx * xx;
|
||||
for (int yy = -r; yy < r; yy++) {
|
||||
int Y = yy + y;
|
||||
int YY = XX + yy * yy;
|
||||
for (int zz = -r; zz < r; zz++) {
|
||||
int Z = zz + z;
|
||||
int ZZ = YY + zz * zz;
|
||||
if (ZZ < r22) {
|
||||
if (rand.nextInt(15) == 0 && world.getBlock(X, Y, Z) != Blocks.air)
|
||||
world.setBlock(X, Y, Z, ModBlocks.cheater_virus_seed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void pulse(World world, int x, int y, int z, int bombStartStrength) {
|
||||
|
||||
int r = bombStartStrength;
|
||||
int r2 = r * r;
|
||||
int r22 = r2 / 2;
|
||||
for (int xx = -r; xx < r; xx++) {
|
||||
int X = xx + x;
|
||||
int XX = xx * xx;
|
||||
for (int yy = -r; yy < r; yy++) {
|
||||
int Y = yy + y;
|
||||
int YY = XX + yy * yy;
|
||||
for (int zz = -r; zz < r; zz++) {
|
||||
int Z = zz + z;
|
||||
int ZZ = YY + zz * zz;
|
||||
if (ZZ < r22) {
|
||||
|
||||
if(world.getBlock(X, Y, Z).getExplosionResistance(null) <= 70) {
|
||||
EntityFallingBlockNT entityfallingblock = new EntityFallingBlockNT(world, X + 0.5, Y + 0.5, Z + 0.5, world.getBlock(X, Y, Z), world.getBlockMetadata(X, Y, Z));
|
||||
world.spawnEntityInWorld(entityfallingblock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void explodeZOMG(World world, int x, int y, int z, int bombStartStrength) {
|
||||
|
||||
int r = bombStartStrength;
|
||||
int r2 = r * r;
|
||||
int r22 = r2 / 2;
|
||||
for (int xx = -r; xx < r; xx++) {
|
||||
int X = xx + x;
|
||||
int XX = xx * xx;
|
||||
for (int yy = -r; yy < r; yy++) {
|
||||
int Y = yy + y;
|
||||
int YY = XX + yy * yy;
|
||||
for (int zz = -r; zz < r; zz++) {
|
||||
int Z = zz + z;
|
||||
int ZZ = YY + zz * zz;
|
||||
if (ZZ < r22) {
|
||||
if (!(world.getBlock(X, Y, Z) == Blocks.bedrock && Y <= 0))
|
||||
world.setBlock(X, Y, Z, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void decon(World world, int x, int y, int z, int radius) {
|
||||
|
||||
int r = radius;
|
||||
int r2 = r * r;
|
||||
int r22 = r2 / 2;
|
||||
for (int xx = -r; xx < r; xx++) {
|
||||
int X = xx + x;
|
||||
int XX = xx * xx;
|
||||
for (int yy = -r; yy < r; yy++) {
|
||||
int Y = yy + y;
|
||||
int YY = XX + yy * yy;
|
||||
for (int zz = -r; zz < r; zz++) {
|
||||
int Z = zz + z;
|
||||
int ZZ = YY + zz * zz;
|
||||
if (ZZ < r22) {
|
||||
decontaminate(world, X, Y, Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all flammable blocks on fire
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param bound
|
||||
*/
|
||||
public static void flameDeath(World world, int x, int y, int z, int bound) {
|
||||
public static void igniteFlammableBlocks(World world, int x, int y, int z, int bound) {
|
||||
|
||||
int r = bound;
|
||||
int r2 = r * r;
|
||||
@ -181,8 +75,7 @@ public class ExplosionChaos { //TODO: destroy this entire class
|
||||
int Z = zz + z;
|
||||
int ZZ = YY + zz * zz;
|
||||
if (ZZ < r22) {
|
||||
if (world.getBlock(X, Y, Z).isFlammable(world, XX, YY, ZZ, ForgeDirection.UP)
|
||||
&& world.getBlock(X, Y + 1, Z) == Blocks.air) {
|
||||
if (world.getBlock(X, Y, Z).isFlammable(world, XX, YY, ZZ, ForgeDirection.UP) && world.getBlock(X, Y + 1, Z) == Blocks.air) {
|
||||
world.setBlock(X, Y + 1, Z, Blocks.fire);
|
||||
}
|
||||
}
|
||||
@ -192,16 +85,7 @@ public class ExplosionChaos { //TODO: destroy this entire class
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all blocks on fire
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param bound
|
||||
*/
|
||||
public static void burn(World world, int x, int y, int z, int bound) {
|
||||
public static void igniteAllBlocks(World world, int x, int y, int z, int bound) {
|
||||
|
||||
int r = bound;
|
||||
int r2 = r * r;
|
||||
@ -216,16 +100,13 @@ public class ExplosionChaos { //TODO: destroy this entire class
|
||||
int Z = zz + z;
|
||||
int ZZ = YY + zz * zz;
|
||||
if (ZZ < r22) {
|
||||
if ((world.getBlock(X, Y + 1, Z) == Blocks.air
|
||||
|| world.getBlock(X, Y + 1, Z) == Blocks.snow_layer)
|
||||
&& world.getBlock(X, Y, Z) != Blocks.air) {
|
||||
if ((world.getBlock(X, Y + 1, Z) == Blocks.air || world.getBlock(X, Y + 1, Z) == Blocks.snow_layer) && world.getBlock(X, Y, Z) != Blocks.air) {
|
||||
world.setBlock(X, Y + 1, Z, Blocks.fire);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Deprecated public static void spawnPoisonCloud(World world, double x, double y, double z, int count, double speed, int type) {
|
||||
@ -264,93 +145,15 @@ public class ExplosionChaos { //TODO: destroy this entire class
|
||||
}
|
||||
}
|
||||
|
||||
public static void cluster(World world, int x, int y, int z, int count, int gravity) {
|
||||
|
||||
double d1 = 0;
|
||||
double d2 = 0;
|
||||
double d3 = 0;
|
||||
EntityRocket fragment;
|
||||
public static void cluster(World world, double x, double y, double z, int count, float yaw, float pitch, float yawRand, float pitchRand, float speed) {
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
d1 = rand.nextDouble();
|
||||
d2 = rand.nextDouble();
|
||||
d3 = rand.nextDouble();
|
||||
|
||||
if (rand.nextInt(2) == 0) {
|
||||
d1 *= -1;
|
||||
}
|
||||
|
||||
if (rand.nextInt(2) == 0) {
|
||||
d3 *= -1;
|
||||
}
|
||||
|
||||
fragment = new EntityRocket(world, x, y, z, d1, d2, d3, 0.0125D);
|
||||
|
||||
world.spawnEntityInWorld(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
public static void schrab(World world, int x, int y, int z, int count, int gravity) {
|
||||
|
||||
double d1 = 0;
|
||||
double d2 = 0;
|
||||
double d3 = 0;
|
||||
EntitySchrab fragment;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
d1 = rand.nextDouble();
|
||||
d2 = rand.nextDouble();
|
||||
d3 = rand.nextDouble();
|
||||
|
||||
if (rand.nextInt(2) == 0) {
|
||||
d1 *= -1;
|
||||
}
|
||||
|
||||
if (rand.nextInt(2) == 0) {
|
||||
d3 *= -1;
|
||||
}
|
||||
|
||||
fragment = new EntitySchrab(world, x, y, z, d1, d2, d3, 0.0125D);
|
||||
|
||||
world.spawnEntityInWorld(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
public static void frag(World world, int x, int y, int z, int count, boolean flame, Entity shooter) {
|
||||
|
||||
double d1 = 0;
|
||||
double d2 = 0;
|
||||
double d3 = 0;
|
||||
EntityArrow fragment;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
d1 = rand.nextDouble();
|
||||
d2 = rand.nextDouble();
|
||||
d3 = rand.nextDouble();
|
||||
|
||||
if (rand.nextInt(2) == 0) {
|
||||
d1 *= -1;
|
||||
}
|
||||
|
||||
if (rand.nextInt(2) == 0) {
|
||||
d3 *= -1;
|
||||
}
|
||||
|
||||
fragment = new EntityArrow(world, x, y, z);
|
||||
|
||||
fragment.motionX = d1;
|
||||
fragment.motionY = d2;
|
||||
fragment.motionZ = d3;
|
||||
fragment.shootingEntity = shooter;
|
||||
|
||||
fragment.setIsCritical(true);
|
||||
if (flame) {
|
||||
fragment.setFire(1000);
|
||||
}
|
||||
|
||||
fragment.setDamage(2.5);
|
||||
|
||||
world.spawnEntityInWorld(fragment);
|
||||
EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(world, XFactoryCatapult.cluster_submunition, 50F, 0F, yaw + (float) (yawRand * world.rand.nextGaussian()), pitch + (float) (pitchRand * world.rand.nextGaussian()));
|
||||
bullet.setPosition(x, y, z);
|
||||
bullet.motionX *= speed;
|
||||
bullet.motionY *= speed;
|
||||
bullet.motionZ *= speed;
|
||||
world.spawnEntityInWorld(bullet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,80 +303,4 @@ public class ExplosionChaos { //TODO: destroy this entire class
|
||||
|
||||
radius = (int) f;
|
||||
}
|
||||
|
||||
public static void levelDown(World world, int x, int y, int z, int radius) {
|
||||
|
||||
if(!world.isRemote)
|
||||
for (int i = x - radius; i <= x + radius; i++)
|
||||
for (int j = z - radius; j <= z + radius; j++) {
|
||||
|
||||
Block b = world.getBlock(i, y, j);
|
||||
float k = b.getExplosionResistance(null);
|
||||
|
||||
if(k < 6000 && b != Blocks.air) {
|
||||
|
||||
EntityRubble rubble = new EntityRubble(world);
|
||||
rubble.posX = i + 0.5F;
|
||||
rubble.posY = y;
|
||||
rubble.posZ = j + 0.5F;
|
||||
|
||||
rubble.motionY = 0.025F * 10 + 0.15F;
|
||||
rubble.setMetaBasedOnBlock(b, world.getBlockMetadata(i, y, j));
|
||||
|
||||
world.spawnEntityInWorld(rubble);
|
||||
|
||||
world.setBlock(i, y, j, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void decontaminate(World world, int x, int y, int z) {
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
if (world.getBlock(x, y, z) == ModBlocks.waste_earth && random.nextInt(3) != 0) {
|
||||
world.setBlock(x, y, z, Blocks.grass);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.waste_mycelium && random.nextInt(5) == 0) {
|
||||
world.setBlock(x, y, z, Blocks.mycelium);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.waste_trinitite && random.nextInt(3) == 0) {
|
||||
world.setBlock(x, y, z, Blocks.sand);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.waste_trinitite_red && random.nextInt(3) == 0) {
|
||||
world.setBlock(x, y, z, Blocks.sand, 1, 2);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.waste_log && random.nextInt(3) != 0) {
|
||||
world.setBlock(x, y, z, Blocks.log);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.waste_planks && random.nextInt(3) != 0) {
|
||||
world.setBlock(x, y, z, Blocks.planks);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.block_trinitite && random.nextInt(10) == 0) {
|
||||
world.setBlock(x, y, z, ModBlocks.block_lead);
|
||||
}
|
||||
|
||||
else if (world.getBlock(x, y, z) == ModBlocks.block_waste && random.nextInt(10) == 0) {
|
||||
world.setBlock(x, y, z, ModBlocks.block_lead);
|
||||
}
|
||||
|
||||
else if(world.getBlock(x, y, z) == ModBlocks.sellafield) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta > 0) {
|
||||
if(meta == 5 && random.nextInt(10) == 0)
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 3);
|
||||
else if(random.nextInt(5) == 0)
|
||||
world.setBlockMetadataWithNotify(meta, x, y, z, meta - 1);
|
||||
} else if(random.nextInt(5) == 0)
|
||||
world.setBlock(y, z, meta, ModBlocks.sellafield_slaked);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,12 +42,12 @@ public class DispenserBehaviorHandler {
|
||||
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite);
|
||||
return new EntityGrenadeBouncyGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite);
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite_fishing, new BehaviorProjectileDispense() {
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite_fishing);
|
||||
return new EntityGrenadeBouncyGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite_fishing);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.tileentity.machine.TileEntityITER;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerITER extends Container {
|
||||
|
||||
private TileEntityITER iter;
|
||||
|
||||
public ContainerITER(InventoryPlayer invPlayer, TileEntityITER tedf) {
|
||||
|
||||
iter = tedf;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 107, 108));
|
||||
//Breeder In
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 26, 18));
|
||||
//Breeder Out
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 62, 18));
|
||||
//Plasma Shield
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 98, 18));
|
||||
//Byproduct
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 134, 18));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(par2 <= 4) {
|
||||
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return iter.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPlasmaHeater extends Container {
|
||||
|
||||
private TileEntityMachinePlasmaHeater microwave;
|
||||
|
||||
public ContainerPlasmaHeater(InventoryPlayer invPlayer, TileEntityMachinePlasmaHeater tedf) {
|
||||
|
||||
microwave = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 44, 17));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 44, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 152, 17));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 152, 53));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(par2 <= 4) {
|
||||
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if(!this.mergeItemStack(var5, 0, 1, true))
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return microwave.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerITER;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.AuxButtonPacket;
|
||||
import com.hbm.tileentity.machine.TileEntityITER;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIITER extends GuiInfoContainer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_fusion_multiblock.png");
|
||||
private TileEntityITER iter;
|
||||
|
||||
public GUIITER(InventoryPlayer invPlayer, TileEntityITER laser) {
|
||||
super(new ContainerITER(invPlayer, laser));
|
||||
this.iter = laser;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 108, 34, 16, iter.power, iter.maxPower);
|
||||
|
||||
iter.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 54, 16, 52); //Water
|
||||
iter.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 54, 16, 52); //Steam
|
||||
iter.plasma.renderTankInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 54, 34, 34); //Plasma
|
||||
|
||||
String text = "Magnets are " + ((iter.isOn && iter.power >= iter.powerReq) ? "ON" : "OFF");
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 76, guiTop + 94, 24, 12, mouseX, mouseY, new String[] { text });
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 52 <= x && guiLeft + 52 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
|
||||
|
||||
//toggle the magnets
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(iter.xCoord, iter.yCoord, iter.zCoord, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.iter.hasCustomInventoryName() ? this.iter.getInventoryName() : I18n.format(this.iter.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(iter.isOn)
|
||||
drawTexturedModalRect(guiLeft + 52, guiTop + 107, 176, 0, 18, 18);
|
||||
|
||||
if(iter.isOn && iter.power >= iter.powerReq)
|
||||
drawTexturedModalRect(guiLeft + 76, guiTop + 94, 194, 0, 24, 12);
|
||||
|
||||
if(iter.getShield() >= iter.plasma.getTankType().temperature)
|
||||
drawTexturedModalRect(guiLeft + 97, guiTop + 17, 218, 0, 18, 18);
|
||||
|
||||
int i = (int)iter.getPowerScaled(34);
|
||||
drawTexturedModalRect(guiLeft + 71, guiTop + 108, 176, 25, i, 16);
|
||||
|
||||
int j = (int)iter.getProgressScaled(17);
|
||||
drawTexturedModalRect(guiLeft + 44, guiTop + 22, 176, 18, j, 7);
|
||||
|
||||
for(int t = 0; t < 2; t++) {
|
||||
iter.tanks[t].renderTank(guiLeft + 26 + 108 * t, guiTop + 106, this.zLevel, 16, 52);
|
||||
}
|
||||
|
||||
iter.plasma.renderTank(guiLeft + 71, guiTop + 88, this.zLevel, 34, 34);
|
||||
}
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPlasmaHeater;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIPlasmaHeater extends GuiInfoContainer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_fusion_heater.png");
|
||||
private TileEntityMachinePlasmaHeater microwave;
|
||||
|
||||
public GUIPlasmaHeater(InventoryPlayer invPlayer, TileEntityMachinePlasmaHeater microwave) {
|
||||
super(new ContainerPlasmaHeater(invPlayer, microwave));
|
||||
this.microwave = microwave;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
microwave.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 17, 16, 52);
|
||||
microwave.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 17, 16, 52);
|
||||
microwave.plasma.renderTankInfo(this, mouseX, mouseY, guiLeft + 98, guiTop + 17, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 34, microwave.power, microwave.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.microwave.hasCustomInventoryName() ? this.microwave.getInventoryName() : I18n.format(this.microwave.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int i = (int)microwave.getPowerScaled(34);
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i);
|
||||
|
||||
microwave.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
|
||||
microwave.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
|
||||
microwave.plasma.renderTank(guiLeft + 98, guiTop + 69, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -36,6 +36,16 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
|
||||
// If crates can be opened from hand, prioritize this and require sneaking to place them
|
||||
if (ServerConfig.CRATE_OPEN_HELD.get() && !player.isSneaking() && Block.getBlockFromItem(stack.getItem()) != ModBlocks.mass_storage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if(!ServerConfig.CRATE_OPEN_HELD.get()) return stack;
|
||||
|
||||
@ -99,7 +99,7 @@ public class ItemGlitch extends Item implements IBatteryItem {
|
||||
break;
|
||||
case 14:
|
||||
player.inventory.dropAllItems();
|
||||
ExplosionChaos.burn(world, (int)player.posX, (int)player.posY, (int)player.posZ, 5);
|
||||
ExplosionChaos.igniteAllBlocks(world, (int)player.posX, (int)player.posY, (int)player.posZ, 5);
|
||||
break;
|
||||
case 15:
|
||||
for(int i = 0; i < 36; i++)
|
||||
|
||||
@ -274,7 +274,7 @@ public class ItemAmmoArty extends Item {
|
||||
standardExplosion(shell, mop, 10F, 3F, false);
|
||||
//shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F);
|
||||
ExplosionLarge.spawnShrapnels(shell.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 15);
|
||||
ExplosionChaos.burn(shell.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 12);
|
||||
ExplosionChaos.igniteAllBlocks(shell.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 12);
|
||||
int radius = 15;
|
||||
List<Entity> hit = shell.worldObj.getEntitiesWithinAABBExcludingEntity(shell, AxisAlignedBB.getBoundingBox(shell.posX - radius, shell.posY - radius, shell.posZ - radius, shell.posX + radius, shell.posY + radius, shell.posZ + radius));
|
||||
for(Entity e : hit) {
|
||||
|
||||
@ -187,7 +187,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
rocket.worldObj.playSoundEffect(rocket.posX, rocket.posY, rocket.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rocket.worldObj.rand.nextFloat() * 0.2F);
|
||||
standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.block_slag, 1);
|
||||
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
|
||||
ExplosionChaos.burn(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 20);
|
||||
ExplosionChaos.igniteAllBlocks(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 20);
|
||||
int radius = 30;
|
||||
List<Entity> hit = rocket.worldObj.getEntitiesWithinAABBExcludingEntity(rocket, AxisAlignedBB.getBoundingBox(rocket.posX - radius, rocket.posY - radius, rocket.posZ - radius, rocket.posX + radius, rocket.posY + radius, rocket.posZ + radius));
|
||||
for(Entity e : hit) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.items.weapon;
|
||||
|
||||
import com.hbm.entity.grenade.EntityGrenadeBouncyGeneric;
|
||||
import com.hbm.entity.grenade.EntityGrenadeImpactGeneric;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -9,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class ItemGenericGrenade extends ItemGrenade {
|
||||
|
||||
public ItemGenericGrenade(int fuse) {
|
||||
@ -26,11 +24,7 @@ public class ItemGenericGrenade extends ItemGrenade {
|
||||
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
if(fuse == -1)
|
||||
world.spawnEntityInWorld(new EntityGrenadeImpactGeneric(world, player).setType(this));
|
||||
else
|
||||
world.spawnEntityInWorld(new EntityGrenadeBouncyGeneric(world, player).setType(this));
|
||||
world.spawnEntityInWorld(new EntityGrenadeBouncyGeneric(world, player).setType(this));
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
package com.hbm.items.weapon;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class ItemGrenadeKyiv extends ItemGenericGrenade {
|
||||
|
||||
public ItemGrenadeKyiv(int fuse) {
|
||||
super(fuse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void explode(Entity grenade, EntityLivingBase thrower, World world, double x, double y, double z) {
|
||||
world.newExplosion(grenade, x, y, z, 5F, true, true);
|
||||
}
|
||||
}
|
||||
@ -220,6 +220,7 @@ public class GunFactoryClient {
|
||||
nuke_tots.setRenderer(LegoClient.RENDER_GRENADE);
|
||||
nuke_hive.setRenderer(LegoClient.RENDER_HIVE);
|
||||
nuke_balefire.setRenderer(LegoClient.RENDER_NUKE_BALEFIRE);
|
||||
cluster_submunition.setRenderer(LegoClient.RENDER_BOMB);
|
||||
|
||||
setRendererBulkBeam(LegoClient.RENDER_LIGHTNING, energy_tesla, energy_tesla_overcharge, energy_tesla_ir);
|
||||
setRendererBulkBeam(LegoClient.RENDER_LIGHTNING_SUB, energy_tesla_ir_sub, TileEntityBatterySocket.discharge);
|
||||
|
||||
@ -493,6 +493,19 @@ public class LegoClient {
|
||||
GL11.glPopMatrix();
|
||||
};
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_BOMB = (bullet, interp) -> {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.03125F, 0.03125F, 0.03125F);
|
||||
GL11.glRotated(-90, 0, 1, 0);
|
||||
GL11.glTranslatef(0, -1, 1F);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.cluster_submunition_tex);
|
||||
ResourceManager.fatman.renderPart("MiniNuke");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
};
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_NUKE_BALEFIRE = (bullet, interp) -> {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@ -48,6 +48,8 @@ public class XFactoryCatapult {
|
||||
public static BulletConfig nuke_tots;
|
||||
public static BulletConfig nuke_hive;
|
||||
public static BulletConfig nuke_balefire;
|
||||
|
||||
public static BulletConfig cluster_submunition;
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_NUKE_STANDARD = (bullet, mop) -> {
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
|
||||
@ -153,6 +155,17 @@ public class XFactoryCatapult {
|
||||
vnt.setSFX(new ExplosionEffectWeapon(10, 2.5F, 1F));
|
||||
vnt.explode();
|
||||
};
|
||||
|
||||
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_SUBMUNITION = (bullet, mop) -> {
|
||||
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 7.5F, bullet.getThrower());
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard());
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard());
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, bullet.damage));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.setSFX(new ExplosionEffectWeapon(10, 2.5F, 1F));
|
||||
vnt.explode();
|
||||
bullet.setDead();
|
||||
};
|
||||
|
||||
public static void init() {
|
||||
|
||||
@ -163,6 +176,8 @@ public class XFactoryCatapult {
|
||||
nuke_hive = new BulletConfig().setItem(EnumAmmo.NUKE_HIVE).setProjectiles(12).setLife(300).setVel(1F).setGrav(0.025F).setSpread(0.15F).setDamage(0.25F).setOnImpact(LAMBDA_NUKE_HIVE);
|
||||
nuke_balefire = new BulletConfig().setItem(EnumAmmo.NUKE_BALEFIRE).setDamage(2.5F).setLife(300).setVel(3F).setGrav(0.025F).setOnImpact(LAMBDA_NUKE_BALEFIRE);
|
||||
|
||||
cluster_submunition = new BulletConfig().setLife(1_200).setGrav(0.025F).setOnImpact(LAMBDA_SUBMUNITION);
|
||||
|
||||
ModItems.gun_fatman = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
|
||||
.dura(300).draw(20).inspect(30).reloadChangeType(true).crosshair(Crosshair.L_CIRCUMFLEX).hideCrosshair(false)
|
||||
.rec(new Receiver(0)
|
||||
|
||||
@ -421,8 +421,6 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKRodReaSim.class, new RenderRBMKFuelChannel());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKAutoloader.class, new RenderRBMKAutoloader());
|
||||
//ITER
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityITER.class, new RenderITER());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePlasmaHeater.class, new RenderPlasmaHeater());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityICF.class, new RenderICF());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityICFController.class, new RenderICFController());
|
||||
//Fusion
|
||||
@ -593,8 +591,6 @@ public class ClientProxy extends ServerProxy {
|
||||
@Override
|
||||
public void registerEntityRenderer() {
|
||||
//projectiles
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderSnowball(ModItems.man_core));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySchrab.class, new RenderFlare());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class, new RenderRocket());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBaseNT.class, new RenderBullet());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBaseMK4.class, new RenderBulletMK4());
|
||||
@ -621,7 +617,6 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityFireworks.class, new RenderShrapnel());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWaterSplash.class, new RenderEmpty());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEMP.class, new RenderEmpty());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBeamVortex.class, new RenderVortexBeam());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRBMKDebris.class, new RenderRBMKDebris());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityZirnoxDebris.class, new RenderZirnoxDebris());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityArtilleryShell.class, new RenderArtilleryShell());
|
||||
@ -636,7 +631,6 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAcidBomb.class, new RenderSnowball(Items.slime_ball));
|
||||
//grenades
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeBouncyGeneric.class, new RenderGenericGrenade());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeImpactGeneric.class, new RenderGenericGrenade());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityDisperserCanister.class, new RenderGenericGrenade());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeUniversal.class, new RenderGrenadeUniversal());
|
||||
//missiles
|
||||
|
||||
@ -439,7 +439,7 @@ public class MainRegistry {
|
||||
achRBMKBoom = new Achievement("achievement.RBMKBoom", "RBMKBoom", 9, -7, ModItems.debris_fuel, achRBMK).initIndependentStat().setSpecial().registerStat();
|
||||
achBismuth = new Achievement("achievement.bismuth", "bismuth", 11, -6, ModItems.ingot_bismuth, achRBMK).initIndependentStat().registerStat();
|
||||
achBreeding = new Achievement("achievement.breeding", "breeding", 7, -6, ModItems.ingot_am_mix, achRBMK).initIndependentStat().setSpecial().registerStat();
|
||||
achFusion = new Achievement("achievement.fusion", "fusion", 13, -7, new ItemStack(ModBlocks.iter), achBismuth).initIndependentStat().setSpecial().registerStat();
|
||||
achFusion = new Achievement("achievement.fusion", "fusion", 13, -7, new ItemStack(ModBlocks.fusion_torus), achBismuth).initIndependentStat().setSpecial().registerStat();
|
||||
achRedBalloons = new Achievement("achievement.redBalloons", "redBalloons", 11, 0, ModItems.missile_nuclear, achPolymer).initIndependentStat().setSpecial().registerStat();
|
||||
achManhattan = new Achievement("achievement.manhattan", "manhattan", 11, -4, new ItemStack(ModBlocks.nuke_boy), achPolymer).initIndependentStat().setSpecial().registerStat();
|
||||
|
||||
@ -1570,6 +1570,10 @@ public class MainRegistry {
|
||||
ignoreMappings.add("hbm:item.grenade_kit");
|
||||
ignoreMappings.add("hbm:item.nuclear_waste_pearl");
|
||||
ignoreMappings.add("hbm:tile.plasma");
|
||||
ignoreMappings.add("hbm:tile.cheater_virus");
|
||||
ignoreMappings.add("hbm:tile.cheater_virus_seed");
|
||||
ignoreMappings.add("hbm:tile.iter");
|
||||
ignoreMappings.add("hbm:tile.plasma_heater");
|
||||
|
||||
/// REMAP ///
|
||||
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);
|
||||
|
||||
@ -58,8 +58,6 @@ public class NEIConfig implements IConfigureNEI {
|
||||
API.hideItem(new ItemStack(ModBlocks.machine_rtg_furnace_on));
|
||||
API.hideItem(new ItemStack(ModBlocks.reinforced_lamp_on));
|
||||
API.hideItem(new ItemStack(ModBlocks.statue_elb_f));
|
||||
API.hideItem(new ItemStack(ModBlocks.cheater_virus));
|
||||
API.hideItem(new ItemStack(ModBlocks.cheater_virus_seed));
|
||||
API.hideItem(new ItemStack(ModItems.euphemium_kit));
|
||||
API.hideItem(new ItemStack(ModItems.bobmazon_hidden));
|
||||
API.hideItem(new ItemStack(ModItems.book_lore)); //the broken nbt-less one shouldn't show up in normal play anyway
|
||||
|
||||
@ -242,7 +242,6 @@ public class ResourceManager {
|
||||
public static final IModelCustom breeder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/breeder.obj"));
|
||||
|
||||
//ITER
|
||||
public static final IModelCustom iter = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/iter.obj")).asVBO();
|
||||
public static final IModelCustom fusion_torus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fusion/torus.obj")).asVBO();
|
||||
public static final IModelCustom fusion_klystron = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fusion/klystron.obj")).asVBO();
|
||||
public static final IModelCustom fusion_breeder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fusion/breeder.obj")).asVBO();
|
||||
@ -702,18 +701,6 @@ public class ResourceManager {
|
||||
public static final ResourceLocation breeder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/breeder.png");
|
||||
|
||||
//ITER
|
||||
public static final ResourceLocation iter_glass = new ResourceLocation(RefStrings.MODID, "textures/models/iter/glass.png");
|
||||
public static final ResourceLocation iter_microwave = new ResourceLocation(RefStrings.MODID, "textures/models/iter/microwave.png");
|
||||
public static final ResourceLocation iter_motor = new ResourceLocation(RefStrings.MODID, "textures/models/iter/motor.png");
|
||||
public static final ResourceLocation iter_plasma = new ResourceLocation(RefStrings.MODID, "textures/models/iter/plasma.png");
|
||||
public static final ResourceLocation iter_rails = new ResourceLocation(RefStrings.MODID, "textures/models/iter/rails.png");
|
||||
public static final ResourceLocation iter_solenoid = new ResourceLocation(RefStrings.MODID, "textures/models/iter/solenoid.png");
|
||||
public static final ResourceLocation iter_toroidal = new ResourceLocation(RefStrings.MODID, "textures/models/iter/toroidal.png");
|
||||
public static final ResourceLocation iter_torus = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus.png");
|
||||
public static final ResourceLocation iter_torus_tungsten = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_tungsten.png");
|
||||
public static final ResourceLocation iter_torus_desh = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_desh.png");
|
||||
public static final ResourceLocation iter_torus_chlorophyte = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_chlorophyte.png");
|
||||
public static final ResourceLocation iter_torus_vaporwave = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_vaporwave.png");
|
||||
public static final ResourceLocation fusion_torus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/fusion/torus.png");
|
||||
public static final ResourceLocation fusion_plasma_tex = new ResourceLocation(RefStrings.MODID, "textures/models/fusion/plasma.png");
|
||||
public static final ResourceLocation fusion_plasma_glow_tex = new ResourceLocation(RefStrings.MODID, "textures/models/fusion/plasma_glow.png");
|
||||
@ -1075,6 +1062,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation fatman_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fatman.png");
|
||||
public static final ResourceLocation fatman_mininuke_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fatman_mininuke.png");
|
||||
public static final ResourceLocation fatman_balefire_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fatman_balefire.png");
|
||||
public static final ResourceLocation cluster_submunition_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fatman_submunition.png");
|
||||
public static final ResourceLocation lasrifle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lasrifle.png");
|
||||
public static final ResourceLocation lasrifle_mods_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lasrifle_mods.png");
|
||||
public static final ResourceLocation hangman_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/hangman.png");
|
||||
@ -1329,7 +1317,6 @@ public class ResourceManager {
|
||||
public static final ResourceLocation duchessgambit_tex = new ResourceLocation(RefStrings.MODID, "textures/models/duchessgambit.png");
|
||||
public static final ResourceLocation building_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/building.png");
|
||||
public static final ResourceLocation torpedo_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/torpedo.png");
|
||||
public static final ResourceLocation rpc_tex = new ResourceLocation(RefStrings.MODID, "textures/models/rpc.png");
|
||||
public static final ResourceLocation tom_main_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tom_main.png");
|
||||
public static final ResourceLocation tom_flame_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tom_flame.png");
|
||||
public static final ResourceLocation nikonium_tex = new ResourceLocation(RefStrings.MODID, "textures/models/misc/nikonium.png");
|
||||
@ -1388,7 +1375,6 @@ public class ResourceManager {
|
||||
public static final ResourceLocation missileShuttle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile/missile_shuttle.png");
|
||||
public static final ResourceLocation minerRocket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/minerRocket.png");
|
||||
public static final ResourceLocation bobmazon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bobmazon.png");
|
||||
public static final ResourceLocation siege_dropship_tex = new ResourceLocation(RefStrings.MODID, "textures/models/siege_dropship.png");
|
||||
|
||||
public static final ResourceLocation soyuz_engineblock = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/engineblock.png");
|
||||
public static final ResourceLocation soyuz_bottomstage = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/bottomstage.png");
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
package com.hbm.render.entity.effect;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderFlare extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
float f1 = (p_76986_1_.ticksExisted + 2.0F) / 200.0F;
|
||||
float f2 = 0.0F;
|
||||
int count = 250;
|
||||
|
||||
if(p_76986_1_.ticksExisted < 250)
|
||||
{
|
||||
count = p_76986_1_.ticksExisted * 3;
|
||||
}
|
||||
|
||||
if (f1 > 0.8F)
|
||||
{
|
||||
f2 = (f1 - 0.8F) / 0.2F;
|
||||
}
|
||||
|
||||
Random random = new Random(432L);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glTranslatef(0.0F, -1.0F, -2.0F);
|
||||
|
||||
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
|
||||
|
||||
//for (int i = 0; (float)i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i)
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
|
||||
tessellator.startDrawing(6);
|
||||
float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
|
||||
float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
|
||||
//tessellator.setColorRGBA_I(16777215, (int)(255.0F * (1.0F - f2)));
|
||||
tessellator.setColorRGBA_I(59345715, (int)(255.0F * (1.0F - f2)));
|
||||
tessellator.addVertex(0.0D, 0.0D, 0.0D);
|
||||
//tessellator.setColorRGBA_I(16711935, 0);
|
||||
tessellator.setColorRGBA_I(59345735, 0);
|
||||
tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
|
||||
tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
|
||||
tessellator.addVertex(0.0D, f3, 1.0F * f4);
|
||||
tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
|
||||
GL11.glScalef(0.99F, 0.99F, 0.99F);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
package com.hbm.render.entity.projectile;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBeamBase;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.render.util.BeamPronter;
|
||||
import com.hbm.render.util.BeamPronter.EnumBeamType;
|
||||
import com.hbm.render.util.BeamPronter.EnumWaveType;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderVortexBeam extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
this.doRender((EntityBeamBase)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
|
||||
public void doRender(EntityBeamBase laser, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
EntityPlayer player = laser.worldObj.getPlayerEntityByName(laser.getDataWatcher().getWatchableObjectString(20));
|
||||
|
||||
if(player != null) {
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
MovingObjectPosition pos = Library.rayTrace(player, 100, 1);
|
||||
|
||||
Vec3 skeleton = Vec3.createVectorHelper(pos.hitVec.xCoord - player.posX, pos.hitVec.yCoord - player.posY - player.getEyeHeight(), pos.hitVec.zCoord - player.posZ);
|
||||
int init = (int) -(System.currentTimeMillis() % 360);
|
||||
|
||||
BeamPronter.prontBeam(skeleton, EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0x000040, 0x2020d0, init, 1, 0F, 4, 0.005F);
|
||||
BeamPronter.prontBeam(skeleton, EnumWaveType.RANDOM, EnumBeamType.LINE, 0x8080ff, 0x8080ff, init, (int)skeleton.lengthVector() * 3 + 1, 0.01F, 1, 0.01F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -55,23 +55,6 @@ public class ItemRenderLibrary {
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.iter), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -1, 0);
|
||||
GL11.glScaled(4.5, 4.5, 4.5);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glScaled(0.25, 0.25, 0.25);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.iter_glass); ResourceManager.iter.renderPart("Windows");
|
||||
bindTexture(ResourceManager.iter_motor); ResourceManager.iter.renderPart("Motors");
|
||||
bindTexture(ResourceManager.iter_rails); ResourceManager.iter.renderPart("Rails");
|
||||
bindTexture(ResourceManager.iter_toroidal); ResourceManager.iter.renderPart("Toroidal");
|
||||
bindTexture(ResourceManager.iter_torus); ResourceManager.iter.renderPart("Torus");
|
||||
bindTexture(ResourceManager.iter_solenoid); ResourceManager.iter.renderPart("Solenoid");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.machine_press), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -4, 0);
|
||||
@ -259,20 +242,6 @@ public class ItemRenderLibrary {
|
||||
bindTexture(ResourceManager.mining_laser_laser_tex); ResourceManager.mining_laser.renderPart("Laser");
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.plasma_heater), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -1, 0);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glScaled(2.5, 2.5, 2.5);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glTranslatef(0, 0, 14);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.iter_microwave); ResourceManager.iter.renderPart("Microwave");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}});
|
||||
|
||||
renderers.put(Item.getItemFromBlock(ModBlocks.tesla), new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -3, 0);
|
||||
|
||||
@ -1,90 +0,0 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntityITER;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class RenderITER extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
|
||||
TileEntityITER iter = (TileEntityITER) te;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y - 2, (float) z + 0.5F);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.iter_glass);
|
||||
ResourceManager.iter.renderPart("Windows");
|
||||
bindTexture(ResourceManager.iter_motor);
|
||||
ResourceManager.iter.renderPart("Motors");
|
||||
bindTexture(ResourceManager.iter_rails);
|
||||
ResourceManager.iter.renderPart("Rails");
|
||||
bindTexture(ResourceManager.iter_toroidal);
|
||||
ResourceManager.iter.renderPart("Toroidal");
|
||||
|
||||
switch(iter.blanket) {
|
||||
case 0: bindTexture(ResourceManager.iter_torus); break;
|
||||
case 1: bindTexture(ResourceManager.iter_torus_tungsten); break;
|
||||
case 2: bindTexture(ResourceManager.iter_torus_desh); break;
|
||||
case 3: bindTexture(ResourceManager.iter_torus_chlorophyte); break;
|
||||
case 4: bindTexture(ResourceManager.iter_torus_vaporwave); break;
|
||||
default: bindTexture(ResourceManager.iter_torus); break;
|
||||
}
|
||||
ResourceManager.iter.renderPart("Torus");
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(iter.lastRotor + (iter.rotor - iter.lastRotor) * f, 0, 1, 0);
|
||||
bindTexture(ResourceManager.iter_solenoid);
|
||||
ResourceManager.iter.renderPart("Solenoid");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(iter.plasma.getFill() > 0) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(System.currentTimeMillis() / 50D % 360, 0, 1, 0);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
int color = iter.plasma.getTankType().getColor();
|
||||
double alpha = (double) iter.plasma.getFill() / (double) iter.plasma.getMaxFill();
|
||||
|
||||
int r = (int) (((color & 0xFF0000) >> 16) / 2 * alpha);
|
||||
int g = (int) (((color & 0xFF00) >> 8) / 2 * alpha);
|
||||
int b = (int) ((color & 0xFF) / 2 * alpha);
|
||||
|
||||
GL11.glColor3b((byte) r, (byte) g, (byte) b);
|
||||
|
||||
GL11.glTranslatef(0, 2.5F, 0);
|
||||
GL11.glScaled(1, alpha, 1);
|
||||
GL11.glTranslatef(0, -2.5F, 0);
|
||||
|
||||
bindTexture(ResourceManager.iter_plasma);
|
||||
ResourceManager.iter.renderPart("Plasma");
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class RenderPlasmaHeater extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
switch(te.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
GL11.glTranslatef(0, 0, 18);
|
||||
|
||||
bindTexture(ResourceManager.iter_microwave);
|
||||
ResourceManager.iter.renderPart("Microwave");
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@ -179,12 +179,10 @@ public class TileMappings {
|
||||
put(TileEntityNukeBalefire.class, "tileentity_nuke_fstbmb");
|
||||
put(TileEntityMicrowave.class, "tileentity_microwave");
|
||||
put(TileEntityMachineMiniRTG.class, "tileentity_mini_rtg");
|
||||
put(TileEntityITER.class, "tileentity_iter");
|
||||
put(TileEntityBlockICF.class, "tileentity_block_icf");
|
||||
put(TileEntityICFPress.class, "tileentity_icf_press");
|
||||
put(TileEntityICFController.class, "tileentity_icf_controller");
|
||||
put(TileEntityICF.class, "tileentity_icf");
|
||||
put(TileEntityMachinePlasmaHeater.class, "tileentity_plasma_heater");
|
||||
put(TileEntityMachineFENSU.class, "tileentity_fensu");
|
||||
put(TileEntityTrappedBrick.class, "tileentity_trapped_brick");
|
||||
put(TileEntityWatzStruct.class, "tileentity_watz_struct");
|
||||
|
||||
@ -26,6 +26,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -37,7 +38,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable {
|
||||
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable, IRORValueProvider {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
@ -358,4 +359,24 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPa
|
||||
writer.name("D:diffusion").value(diffusion);
|
||||
writer.name("B:canExplode").value(canExplode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "input",
|
||||
PREFIX_VALUE + "output"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if (hasExploded) {
|
||||
if ((PREFIX_VALUE + "input").equals(name)) return "0";
|
||||
if ((PREFIX_VALUE + "output").equals(name)) return "0";
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_VALUE + "input").equals(name)) return "" + tanks[0].getFill();
|
||||
if ((PREFIX_VALUE + "output").equals(name)) return "" + tanks[1].getFill();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -31,7 +32,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable {
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable, IRORValueProvider {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
@ -320,4 +321,19 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme
|
||||
writer.name("I:maxHeat").value(maxHeat);
|
||||
writer.name("D:diffusion").value(diffusion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "input",
|
||||
PREFIX_VALUE + "output"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if ((PREFIX_VALUE + "input").equals(name)) return "" + tanks[0].getFill();
|
||||
if ((PREFIX_VALUE + "output").equals(name)) return "" + tanks[1].getFill();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,566 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.handler.threading.PacketThreading;
|
||||
import com.hbm.inventory.container.ContainerITER;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIITER;
|
||||
import com.hbm.inventory.recipes.BreederRecipes;
|
||||
import com.hbm.inventory.recipes.BreederRecipes.BreederRecipe;
|
||||
import com.hbm.inventory.recipes.FusionRecipesLegacy;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemFusionShield;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Deprecated
|
||||
public class TileEntityITER extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IInfoProviderEC, IFluidCopiable, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 10000000;
|
||||
public static final int powerReq = 100000;
|
||||
public FluidTank[] tanks;
|
||||
public FluidTank plasma;
|
||||
|
||||
public int progress;
|
||||
public static final int duration = 100;
|
||||
public long totalRuntime;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int blanket;
|
||||
|
||||
public float rotor;
|
||||
public float lastRotor;
|
||||
public boolean isOn;
|
||||
|
||||
private float rotorSpeed = 0F;
|
||||
|
||||
private AudioWrapper audio;
|
||||
|
||||
public TileEntityITER() {
|
||||
super(5);
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(Fluids.WATER, 1280000);
|
||||
tanks[1] = new FluidTank(Fluids.ULTRAHOTSTEAM, 128000);
|
||||
plasma = new FluidTank(Fluids.PLASMA_DT, 16000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineITER";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
/// START Processing part ///
|
||||
|
||||
if(!isOn) {
|
||||
plasma.setFill(0); //jettison plasma if the thing is turned off
|
||||
}
|
||||
|
||||
//explode either if there's plasma that is too hot or if the reactor is turned on but the magnets have no power
|
||||
if(plasma.getFill() > 0 && (this.plasma.getTankType().temperature >= this.getShield() || (this.isOn && this.power < this.powerReq))) {
|
||||
this.explode();
|
||||
}
|
||||
|
||||
if(isOn && power >= powerReq) {
|
||||
power -= powerReq;
|
||||
|
||||
if(plasma.getFill() > 0) {
|
||||
this.totalRuntime++;
|
||||
int delay = FusionRecipesLegacy.getByproductDelay(plasma.getTankType());
|
||||
if(delay > 0 && totalRuntime % delay == 0) produceByproduct();
|
||||
}
|
||||
|
||||
if(plasma.getFill() > 0 && this.getShield() != 0) {
|
||||
|
||||
ItemFusionShield.setShieldDamage(slots[3], ItemFusionShield.getShieldDamage(slots[3]) + 1);
|
||||
|
||||
if(ItemFusionShield.getShieldDamage(slots[3]) > ((ItemFusionShield)slots[3].getItem()).maxDamage) {
|
||||
slots[3] = null;
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.shutdown", 5F, 1F);
|
||||
this.isOn = false;
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
int prod = FusionRecipesLegacy.getSteamProduction(plasma.getTankType());
|
||||
|
||||
for(int i = 0; i < 20; i++) {
|
||||
|
||||
if(plasma.getFill() > 0) {
|
||||
|
||||
if(tanks[0].getFill() >= prod * 10) {
|
||||
tanks[0].setFill(tanks[0].getFill() - prod * 10);
|
||||
tanks[1].setFill(tanks[1].getFill() + prod);
|
||||
|
||||
if(tanks[1].getFill() > tanks[1].getMaxFill())
|
||||
tanks[1].setFill(tanks[1].getMaxFill());
|
||||
}
|
||||
|
||||
plasma.setFill(plasma.getFill() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doBreederStuff();
|
||||
|
||||
/// END Processing part ///
|
||||
|
||||
/// START Notif packets ///
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
if(tanks[1].getFill() > 0) {
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
this.networkPackNT(250);
|
||||
/// END Notif packets ///
|
||||
|
||||
} else {
|
||||
|
||||
this.lastRotor = this.rotor;
|
||||
this.rotor += this.rotorSpeed;
|
||||
|
||||
if(this.rotor >= 360) {
|
||||
this.rotor -= 360;
|
||||
this.lastRotor -= 360;
|
||||
}
|
||||
|
||||
if(this.isOn && this.power >= powerReq) {
|
||||
this.rotorSpeed = Math.max(0F, Math.min(15F, this.rotorSpeed + 0.05F));
|
||||
|
||||
if(audio == null) {
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.fusionReactorRunning", xCoord, yCoord, zCoord, 1.0F, 30F, 1.0F);
|
||||
audio.startSound();
|
||||
}
|
||||
|
||||
float rotorSpeed = this.rotorSpeed / 15F;
|
||||
audio.updateVolume(getVolume(0.5f * rotorSpeed));
|
||||
audio.updatePitch(0.25F + 0.75F * rotorSpeed);
|
||||
} else {
|
||||
this.rotorSpeed = Math.max(0F, Math.min(15F, this.rotorSpeed - 0.1F));
|
||||
|
||||
if(audio != null) {
|
||||
if(this.rotorSpeed > 0) {
|
||||
float rotorSpeed = this.rotorSpeed / 15F;
|
||||
audio.updateVolume(getVolume(0.5f * rotorSpeed));
|
||||
audio.updatePitch(0.25F + 0.75F * rotorSpeed);
|
||||
} else {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<DirPos> connections;
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
protected List<DirPos> getConPos() {
|
||||
if(connections != null && !connections.isEmpty())
|
||||
return connections;
|
||||
|
||||
connections = new ArrayList();
|
||||
|
||||
connections.add(new DirPos(xCoord, yCoord + 3, zCoord, ForgeDirection.UP));
|
||||
connections.add(new DirPos(xCoord, yCoord - 3, zCoord, ForgeDirection.DOWN));
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(5.75, 0, 0);
|
||||
|
||||
for(int i = 0; i < 16; i++) {
|
||||
vec.rotateAroundY((float) (Math.PI / 8));
|
||||
connections.add(new DirPos(xCoord + (int)vec.xCoord, yCoord + 3, zCoord + (int)vec.zCoord, ForgeDirection.UP));
|
||||
connections.add(new DirPos(xCoord + (int)vec.xCoord, yCoord - 3, zCoord + (int)vec.zCoord, ForgeDirection.DOWN));
|
||||
}
|
||||
|
||||
return connections;
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
this.disassemble();
|
||||
|
||||
if(this.plasma.getTankType() == Fluids.PLASMA_BF) {
|
||||
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
ExplosionLarge.spawnShrapnels(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 50);
|
||||
|
||||
ExplosionNT exp = new ExplosionNT(worldObj, null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 20F)
|
||||
.addAttrib(ExAttrib.BALEFIRE)
|
||||
.addAttrib(ExAttrib.NOPARTICLE)
|
||||
.addAttrib(ExAttrib.NOSOUND)
|
||||
.addAttrib(ExAttrib.NODROP)
|
||||
.overrideResolution(64);
|
||||
exp.doExplosionA();
|
||||
exp.doExplosionB(false);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
data.setBoolean("balefire", true);
|
||||
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250));
|
||||
|
||||
} else {
|
||||
Vec3 vec = Vec3.createVectorHelper(5.5, 0, 0);
|
||||
vec.rotateAroundY(worldObj.rand.nextFloat() * (float)Math.PI * 2F);
|
||||
|
||||
worldObj.newExplosion(null, xCoord + 0.5 + vec.xCoord, yCoord + 0.5 + worldObj.rand.nextGaussian() * 1.5D, zCoord + 0.5 + vec.zCoord, 2.5F, true, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doBreederStuff() {
|
||||
|
||||
if(plasma.getFill() == 0) {
|
||||
this.progress = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
BreederRecipe out = BreederRecipes.getOutput(slots[1]);
|
||||
|
||||
if(slots[1] != null && slots[1].getItem() == ModItems.meteorite_sword_irradiated)
|
||||
out = new BreederRecipe(ModItems.meteorite_sword_fused, 1000);
|
||||
|
||||
if(slots[1] != null && slots[1].getItem() == ModItems.meteorite_sword_fused)
|
||||
out = new BreederRecipe(ModItems.meteorite_sword_baleful, 4000);
|
||||
|
||||
if(out == null) {
|
||||
this.progress = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(slots[2] != null && slots[2].stackSize >= slots[2].getMaxStackSize()) {
|
||||
this.progress = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int level = FusionRecipesLegacy.getBreedingLevel(plasma.getTankType());
|
||||
|
||||
if(out.flux > level) {
|
||||
this.progress = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
progress++;
|
||||
|
||||
if(progress > this.duration) {
|
||||
|
||||
this.progress = 0;
|
||||
|
||||
if(slots[2] != null) {
|
||||
slots[2].stackSize++;
|
||||
} else {
|
||||
slots[2] = out.output.copy();
|
||||
}
|
||||
|
||||
slots[1].stackSize--;
|
||||
|
||||
if(slots[1].stackSize <= 0)
|
||||
slots[1] = null;
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return slot == 2 || slot == 4; // only allow removing breeder outputs <- ?????
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] { 1, 2, 4 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
|
||||
if(i == 1 && BreederRecipes.getOutput(stack) != null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void produceByproduct() {
|
||||
|
||||
ItemStack by = FusionRecipesLegacy.getByproduct(plasma.getTankType());
|
||||
|
||||
if(by == null)
|
||||
return;
|
||||
|
||||
if(slots[4] == null) {
|
||||
slots[4] = by;
|
||||
return;
|
||||
}
|
||||
|
||||
if(slots[4].getItem() == by.getItem() && slots[4].getItemDamage() == by.getItemDamage() && slots[4].stackSize < slots[4].getMaxStackSize()) {
|
||||
slots[4].stackSize++;
|
||||
}
|
||||
}
|
||||
|
||||
public int getShield() {
|
||||
|
||||
if(slots[3] == null || !(slots[3].getItem() instanceof ItemFusionShield))
|
||||
return 0;
|
||||
|
||||
return ((ItemFusionShield)slots[3].getItem()).maxTemp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeLong(this.power);
|
||||
buf.writeInt(this.progress);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
plasma.serialize(buf);
|
||||
if(slots[3] == null) {
|
||||
buf.writeInt(0);
|
||||
} else if(slots[3].getItem() == ModItems.fusion_shield_tungsten) {
|
||||
buf.writeInt(1);
|
||||
} else if(slots[3].getItem() == ModItems.fusion_shield_desh) {
|
||||
buf.writeInt(2);
|
||||
} else if(slots[3].getItem() == ModItems.fusion_shield_chlorophyte) {
|
||||
buf.writeInt(3);
|
||||
} else if(slots[3].getItem() == ModItems.fusion_shield_vaporwave) {
|
||||
buf.writeInt(4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.isOn = buf.readBoolean();
|
||||
this.power = buf.readLong();
|
||||
this.progress = buf.readInt();
|
||||
tanks[0].deserialize(buf);
|
||||
tanks[1].deserialize(buf);
|
||||
plasma.deserialize(buf);
|
||||
this.blanket = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
if(meta == 0) this.isOn = !this.isOn;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) { return (power * i) / maxPower; }
|
||||
public long getProgressScaled(long i) { return (progress * i) / duration; }
|
||||
@Override public void setPower(long i) { this.power = i; }
|
||||
@Override public long getPower() { return power; }
|
||||
@Override public long getMaxPower() { return maxPower; }
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.totalRuntime = nbt.getLong("totalRuntime");
|
||||
|
||||
tanks[0].readFromNBT(nbt, "water");
|
||||
tanks[1].readFromNBT(nbt, "steam");
|
||||
plasma.readFromNBT(nbt, "plasma");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", this.power);
|
||||
nbt.setBoolean("isOn", isOn);
|
||||
nbt.setLong("totalRuntime", this.totalRuntime);
|
||||
|
||||
tanks[0].writeToNBT(nbt, "water");
|
||||
tanks[1].writeToNBT(nbt, "steam");
|
||||
plasma.writeToNBT(nbt, "plasma");
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord + 0.5 - 8,
|
||||
yCoord + 0.5 - 3,
|
||||
zCoord + 0.5 - 8,
|
||||
xCoord + 0.5 + 8,
|
||||
yCoord + 0.5 + 3,
|
||||
zCoord + 0.5 + 8
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
public void disassemble() {
|
||||
worldObj.func_147480_a(xCoord, yCoord, zCoord, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||
return dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerITER(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIITER(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.isOn && plasma.getFill() > 0);
|
||||
int output = FusionRecipesLegacy.getSteamProduction(plasma.getTankType());
|
||||
data.setDouble("consumption", output * 10);
|
||||
data.setDouble("outputmb", output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getTankToPaste() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "durability",
|
||||
PREFIX_VALUE + "durabilitypercent",
|
||||
PREFIX_FUNCTION + "toggle",
|
||||
PREFIX_FUNCTION + "switch" + NAME_SEPARATOR + "on/off",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "durability").equals(name)) return (slots[3] != null && slots[3].getItem() instanceof ItemFusionShield) ? "" + (((ItemFusionShield) slots[3].getItem()).maxDamage - ItemFusionShield.getShieldDamage(slots[3])) : "0";
|
||||
if((PREFIX_VALUE + "durabilitypercent").equals(name)) return (slots[3] != null && slots[3].getItem() instanceof ItemFusionShield) ? "" + ((((ItemFusionShield) slots[3].getItem()).maxDamage - ItemFusionShield.getShieldDamage(slots[3])) * 100 / ((ItemFusionShield) slots[3].getItem()).maxDamage) : "0";
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
|
||||
if((PREFIX_FUNCTION + "toggle").equals(name)) {
|
||||
this.isOn = !this.isOn;
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if((PREFIX_FUNCTION + "switch").equals(name) && params.length > 0) {
|
||||
if("on".equals(params[0])) {
|
||||
this.isOn = true;
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
if("off".equals(params[0])) {
|
||||
this.isOn = false;
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,115 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
@Deprecated
|
||||
public class TileEntityITERStruct {
|
||||
|
||||
public static final int[][][] layout = new int[][][] {
|
||||
|
||||
new int[][] {
|
||||
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
|
||||
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,3,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
|
||||
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
},
|
||||
new int[][] {
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,1,0,0,0,0,0,0,0,1,0,0,0},
|
||||
new int[] {0,0,1,0,0,1,1,1,1,1,0,0,1,0,0},
|
||||
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
|
||||
new int[] {0,1,0,1,0,2,0,2,0,2,0,1,0,1,0},
|
||||
new int[] {1,0,0,1,2,0,0,2,0,0,2,1,0,0,1},
|
||||
new int[] {1,0,0,1,2,2,2,3,2,2,2,1,0,0,1},
|
||||
new int[] {1,0,0,1,2,0,0,2,0,0,2,1,0,0,1},
|
||||
new int[] {0,1,0,1,0,2,0,2,0,2,0,1,0,1,0},
|
||||
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
|
||||
new int[] {0,0,1,0,0,1,1,1,1,1,0,0,1,0,0},
|
||||
new int[] {0,0,0,1,0,0,0,0,0,0,0,1,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
|
||||
},
|
||||
new int[][] {
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,4,0,0,0,0,0,0,0,4,0,0,0},
|
||||
new int[] {0,0,4,0,0,1,1,1,1,1,0,0,4,0,0},
|
||||
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
|
||||
new int[] {0,1,0,1,0,2,0,0,0,2,0,1,0,1,0},
|
||||
new int[] {1,0,0,1,2,0,0,0,0,0,2,1,0,0,1},
|
||||
new int[] {1,0,0,1,2,0,0,3,0,0,2,1,0,0,1},
|
||||
new int[] {1,0,0,1,2,0,0,0,0,0,2,1,0,0,1},
|
||||
new int[] {0,1,0,1,0,2,0,0,0,2,0,1,0,1,0},
|
||||
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
|
||||
new int[] {0,0,4,0,0,1,1,1,1,1,0,0,4,0,0},
|
||||
new int[] {0,0,0,4,0,0,0,0,0,0,0,4,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
|
||||
}
|
||||
};
|
||||
|
||||
public static final int[][][] collisionMask = new int[][][] {
|
||||
|
||||
new int[][] {
|
||||
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
|
||||
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,3,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
|
||||
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
|
||||
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
},
|
||||
new int[][] {
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
|
||||
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
|
||||
new int[] {0,1,1,1,1,0,2,2,2,0,1,1,1,1,0},
|
||||
new int[] {0,1,1,1,0,2,0,0,0,2,0,1,1,1,0},
|
||||
new int[] {1,1,1,1,2,0,0,0,0,0,2,1,1,1,1},
|
||||
new int[] {1,1,1,1,2,0,0,3,0,0,2,1,1,1,1},
|
||||
new int[] {1,1,1,1,2,0,0,0,0,0,2,1,1,1,1},
|
||||
new int[] {0,1,1,1,0,2,0,0,0,2,0,1,1,1,0},
|
||||
new int[] {0,1,1,1,1,0,2,2,2,0,1,1,1,1,0},
|
||||
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
|
||||
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
|
||||
},
|
||||
new int[][] {
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
|
||||
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
|
||||
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
|
||||
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
|
||||
new int[] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
||||
new int[] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
||||
new int[] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
||||
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
|
||||
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
|
||||
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
|
||||
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
|
||||
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
|
||||
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -66,6 +66,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
acceptedFuels.add(Fluids.ETHANOL);
|
||||
acceptedFuels.add(Fluids.FISHOIL);
|
||||
acceptedFuels.add(Fluids.HEAVYOIL);
|
||||
acceptedFuels.add(Fluids.COALCREOSOTE);
|
||||
}
|
||||
|
||||
public FluidTank tank;
|
||||
|
||||
@ -23,6 +23,8 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -40,7 +42,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineCombustionEngine extends TileEntityMachinePolluting implements IEnergyProviderMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent, IFluidCopiable {
|
||||
public class TileEntityMachineCombustionEngine extends TileEntityMachinePolluting implements IEnergyProviderMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public boolean isOn = false;
|
||||
public static long maxPower = 2_500_000;
|
||||
@ -474,4 +476,57 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_VALUE + "throttle",
|
||||
PREFIX_VALUE + "power",
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "efficiency",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state",
|
||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "throttle"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if ((PREFIX_VALUE + "state").equals(name)) return "" + (isOn ? 1 : 0);
|
||||
if ((PREFIX_VALUE + "throttle").equals(name)) return "" + setting;
|
||||
if ((PREFIX_VALUE + "power").equals(name)) return "" + power;
|
||||
if ((PREFIX_VALUE + "fuel").equals(name)) return "" + tank.getFill();
|
||||
if ((PREFIX_VALUE + "efficiency").equals(name)) {
|
||||
if (slots[2] != null && slots[2].getItem() == ModItems.piston_set && tank.getTankType().hasTrait(FT_Combustible.class)) {
|
||||
EnumPistonType piston = EnumUtil.grabEnumSafely(EnumPistonType.class, slots[2].getItemDamage());
|
||||
FT_Combustible trait = tank.getTankType().getTrait(FT_Combustible.class);
|
||||
double eff = piston.eff[trait.getGrade().ordinal()];
|
||||
return "" + (int) Math.round(eff * 100);
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if ((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.isOn = (val == 1);
|
||||
this.markDirty();
|
||||
} catch (NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
if (val < 0) val = 0;
|
||||
if (val > 30) val = 30;
|
||||
this.setting = val;
|
||||
this.markDirty();
|
||||
} catch (NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.Random;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
@ -17,12 +18,18 @@ import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase implements IConfigurableMachine {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase implements IConfigurableMachine, SimpleComponent, CompatHandler.OCComponent {
|
||||
|
||||
public static int inputTankSize = 750_000;
|
||||
public static int outputTankSize = 3_000_000;
|
||||
@ -251,4 +258,81 @@ public class TileEntityMachineIndustrialTurbine extends TileEntityTurbineBase im
|
||||
if((PREFIX_VALUE + "flywheel").equals(name)) return "" + (int) (spin * 100);
|
||||
return null;
|
||||
}
|
||||
|
||||
// OpenComputers methods
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String getComponentName() {
|
||||
return "ntm_turbine";
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFluid(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tanks[0].getFill(),
|
||||
tanks[0].getMaxFill(),
|
||||
tanks[1].getFill(),
|
||||
tanks[1].getMaxFill()
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getType(Context context, Arguments args) {
|
||||
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPower(Context context, Arguments args) {
|
||||
return new Object[] { this.powerBuffer };
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFlywheel(Context context, Arguments args) {
|
||||
return new Object[] { (int) (this.spin * 100) };
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {
|
||||
tanks[0].getFill(),
|
||||
tanks[0].getMaxFill(),
|
||||
tanks[1].getFill(),
|
||||
tanks[1].getMaxFill(),
|
||||
CompatHandler.steamTypeToInt(tanks[0].getTankType())[0],
|
||||
this.powerBuffer,
|
||||
(int) (this.spin * 100)
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public String[] methods() {
|
||||
return new String[] {
|
||||
"getFluid",
|
||||
"getType",
|
||||
"getPower",
|
||||
"getFlywheel",
|
||||
"getInfo"
|
||||
};
|
||||
}
|
||||
|
||||
@Callback(direct = true)
|
||||
@Override
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||
switch(method) {
|
||||
case "getFluid": return getFluid(context, args);
|
||||
case "getType": return getType(context, args);
|
||||
case "getPower": return getPower(context, args);
|
||||
case "getFlywheel": return getFlywheel(context, args);
|
||||
case "getInfo": return getInfo(context, args);
|
||||
default: throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,267 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachineITER;
|
||||
import com.hbm.inventory.container.ContainerPlasmaHeater;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIPlasmaHeater;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IGUIProvider, IFluidCopiable {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000;
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public FluidTank plasma;
|
||||
|
||||
public TileEntityMachinePlasmaHeater() {
|
||||
super(5);
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(Fluids.DEUTERIUM, 16_000);
|
||||
tanks[1] = new FluidTank(Fluids.TRITIUM, 16_000);
|
||||
plasma = new FluidTank(Fluids.PLASMA_DT, 64_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.plasmaHeater";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.worldObj.getTotalWorldTime() % 20 == 0)
|
||||
this.updateConnections();
|
||||
|
||||
/// START Managing all the internal stuff ///
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tanks[0].setType(1, 2, slots);
|
||||
tanks[1].setType(3, 4, slots);
|
||||
|
||||
updateType();
|
||||
|
||||
int maxConv = 50;
|
||||
int powerReq = 10000;
|
||||
|
||||
int convert = Math.min(tanks[0].getFill(), tanks[1].getFill());
|
||||
convert = Math.min(convert, (plasma.getMaxFill() - plasma.getFill()) / 2);
|
||||
convert = Math.min(convert, maxConv);
|
||||
convert = (int) Math.min(convert, power / powerReq);
|
||||
convert = Math.max(0, convert);
|
||||
|
||||
if(convert > 0 && plasma.getTankType() != Fluids.NONE) {
|
||||
|
||||
tanks[0].setFill(tanks[0].getFill() - convert);
|
||||
tanks[1].setFill(tanks[1].getFill() - convert);
|
||||
|
||||
plasma.setFill(plasma.getFill() + convert * 2);
|
||||
power -= convert * powerReq;
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
/// END Managing all the internal stuff ///
|
||||
|
||||
/// START Loading plasma into the ITER ///
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
|
||||
int dist = 11;
|
||||
|
||||
if(worldObj.getBlock(xCoord + dir.offsetX * dist, yCoord + 2, zCoord + dir.offsetZ * dist) == ModBlocks.iter) {
|
||||
int[] pos = ((MachineITER)ModBlocks.iter).findCore(worldObj, xCoord + dir.offsetX * dist, yCoord + 2, zCoord + dir.offsetZ * dist);
|
||||
|
||||
if(pos != null) {
|
||||
TileEntity te = worldObj.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(te instanceof TileEntityITER) {
|
||||
TileEntityITER iter = (TileEntityITER)te;
|
||||
|
||||
if(iter.plasma.getFill() == 0 && this.plasma.getTankType() != Fluids.NONE) {
|
||||
iter.plasma.setTankType(this.plasma.getTankType());
|
||||
}
|
||||
|
||||
if(iter.isOn) {
|
||||
|
||||
if(iter.plasma.getTankType() == this.plasma.getTankType()) {
|
||||
|
||||
int toLoad = Math.min(iter.plasma.getMaxFill() - iter.plasma.getFill(), this.plasma.getFill());
|
||||
toLoad = Math.min(toLoad, 40);
|
||||
this.plasma.setFill(this.plasma.getFill() - toLoad);
|
||||
iter.plasma.setFill(iter.plasma.getFill() + toLoad);
|
||||
this.markDirty();
|
||||
iter.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// END Loading plasma into the ITER ///
|
||||
|
||||
/// START Notif packets ///
|
||||
this.networkPackNT(50);
|
||||
/// END Notif packets ///
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
this.getBlockMetadata();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.blockMetadata - BlockDummyable.offset);
|
||||
ForgeDirection side = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
for(int i = 1; i < 4; i++) {
|
||||
for(int j = -1; j < 2; j++) {
|
||||
this.trySubscribe(worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2, j < 0 ? ForgeDirection.DOWN : ForgeDirection.UP);
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2, j < 0 ? ForgeDirection.DOWN : ForgeDirection.UP);
|
||||
this.trySubscribe(tanks[1].getTankType(), worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2, j < 0 ? ForgeDirection.DOWN : ForgeDirection.UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
plasma.serialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.power = buf.readLong();
|
||||
tanks[0].deserialize(buf);
|
||||
tanks[1].deserialize(buf);
|
||||
plasma.deserialize(buf);
|
||||
}
|
||||
|
||||
private void updateType() {
|
||||
|
||||
List<FluidType> types = new ArrayList() {{ add(tanks[0].getTankType()); add(tanks[1].getTankType()); }};
|
||||
|
||||
if(types.contains(Fluids.DEUTERIUM) && types.contains(Fluids.TRITIUM)) {
|
||||
plasma.setTankType(Fluids.PLASMA_DT);
|
||||
return;
|
||||
}
|
||||
if(types.contains(Fluids.DEUTERIUM) && types.contains(Fluids.HELIUM3)) {
|
||||
plasma.setTankType(Fluids.PLASMA_DH3);
|
||||
return;
|
||||
}
|
||||
if(types.contains(Fluids.DEUTERIUM) && types.contains(Fluids.HYDROGEN)) {
|
||||
plasma.setTankType(Fluids.PLASMA_HD);
|
||||
return;
|
||||
}
|
||||
if(types.contains(Fluids.HYDROGEN) && types.contains(Fluids.TRITIUM)) {
|
||||
plasma.setTankType(Fluids.PLASMA_HT);
|
||||
return;
|
||||
}
|
||||
if(types.contains(Fluids.HELIUM4) && types.contains(Fluids.OXYGEN)) {
|
||||
plasma.setTankType(Fluids.PLASMA_XM);
|
||||
return;
|
||||
}
|
||||
if(types.contains(Fluids.BALEFIRE) && types.contains(Fluids.AMAT)) {
|
||||
plasma.setTankType(Fluids.PLASMA_BF);
|
||||
return;
|
||||
}
|
||||
|
||||
plasma.setTankType(Fluids.NONE);
|
||||
}
|
||||
|
||||
public long getPowerScaled(int i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
tanks[0].readFromNBT(nbt, "fuel_1");
|
||||
tanks[1].readFromNBT(nbt, "fuel_2");
|
||||
plasma.readFromNBT(nbt, "plasma");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
tanks[0].writeToNBT(nbt, "fuel_1");
|
||||
tanks[1].writeToNBT(nbt, "fuel_2");
|
||||
plasma.writeToNBT(nbt, "plasma");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] {tanks[0], tanks[1], plasma};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerPlasmaHeater(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIPlasmaHeater(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@ -27,6 +27,7 @@ import com.hbm.util.CompatEnergyControl;
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -45,7 +46,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyProviderMK2, IControlReceiver, IGUIProvider, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider {
|
||||
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyProviderMK2, IControlReceiver, IGUIProvider, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000L;
|
||||
@ -734,7 +735,18 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "turbinepercent",
|
||||
PREFIX_VALUE + "turbinespeed",
|
||||
PREFIX_VALUE + "output"
|
||||
PREFIX_VALUE + "output",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_VALUE + "autoMode",
|
||||
PREFIX_VALUE + "temp",
|
||||
PREFIX_VALUE + "power",
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "lubricant",
|
||||
PREFIX_VALUE + "water",
|
||||
PREFIX_VALUE + "steam",
|
||||
PREFIX_FUNCTION + "setAuto" + NAME_SEPARATOR + "auto",
|
||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "percent",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state"
|
||||
};
|
||||
}
|
||||
|
||||
@ -742,7 +754,50 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "turbinepercent").equals(name)) return "" + (int) (this.powerSliderPos * 100D / 60D);
|
||||
if((PREFIX_VALUE + "turbinespeed").equals(name)) return "" + this.rpm;
|
||||
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) this.instantPowerOutput;
|
||||
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) (this.instantPowerOutput * 20);
|
||||
if((PREFIX_VALUE + "state").equals(name)) return "" + this.state;
|
||||
if((PREFIX_VALUE + "autoMode").equals(name)) return "" + (this.autoMode ? 1 : 0);
|
||||
if((PREFIX_VALUE + "temp").equals(name)) return "" + this.temp;
|
||||
if((PREFIX_VALUE + "power").equals(name)) return "" + this.power;
|
||||
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tanks[0].getFill();
|
||||
if((PREFIX_VALUE + "lubricant").equals(name)) return "" + tanks[1].getFill();
|
||||
if((PREFIX_VALUE + "water").equals(name)) return "" + tanks[2].getFill();
|
||||
if((PREFIX_VALUE + "steam").equals(name)) return "" + tanks[3].getFill();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setAuto").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.autoMode = (val == 1);
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int percent = Integer.parseInt(params[0]);
|
||||
if(percent < 0) percent = 0;
|
||||
if(percent > 100) percent = 100;
|
||||
this.powerSliderPos = percent * 60 / 100;
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int newState = Integer.parseInt(params[0]);
|
||||
if(newState == 1) {
|
||||
if(this.state == 0) this.state = -1; // startup
|
||||
} else if(newState == 0) {
|
||||
if(this.state == 1) this.state = 0; // shutdown
|
||||
}
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -50,7 +51,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IControlReceiver, IFluidStandardTransceiver, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent, IRORValueProvider {
|
||||
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IControlReceiver, IFluidStandardTransceiver, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public int heat;
|
||||
public static final int maxHeat = 100000;
|
||||
@ -603,14 +604,44 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "heat",
|
||||
PREFIX_VALUE + "pressure"
|
||||
PREFIX_VALUE + "pressure",
|
||||
PREFIX_VALUE + "water",
|
||||
PREFIX_VALUE + "steam",
|
||||
PREFIX_VALUE + "co2",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "active",
|
||||
PREFIX_FUNCTION + "ventCO2"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "heat").equals(name)) return "" + (int) Math.round(heat * 1.0E-5D * 780.0D + 20.0D);
|
||||
if((PREFIX_VALUE + "pressure").equals(name)) return "" + (int) Math.round(pressure * 1.0E-5D * 30.0D);
|
||||
if((PREFIX_VALUE + "heat").equals(name)) return "" + (int) Math.round(heat * 1.0E-5D * 780.0D + 20.0D);
|
||||
if((PREFIX_VALUE + "pressure").equals(name)) return "" + (int) Math.round(pressure * 1.0E-5D * 30.0D);
|
||||
if((PREFIX_VALUE + "water").equals(name)) return "" + water.getFill();
|
||||
if((PREFIX_VALUE + "steam").equals(name)) return "" + steam.getFill();
|
||||
if((PREFIX_VALUE + "co2").equals(name)) return "" + carbonDioxide.getFill();
|
||||
if((PREFIX_VALUE + "state").equals(name)) return "" + (isOn ? 1 : 0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
if(redstonePowered) return null;
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.isOn = (val == 1);
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_FUNCTION + "ventCO2").equals(name)) {
|
||||
int fill = this.carbonDioxide.getFill();
|
||||
this.carbonDioxide.setFill(Math.max(fill - 1000, 0));
|
||||
this.markDirty();
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -5757,7 +5757,7 @@ tile.machine_assembly_factory.desc=Quadruple assembly machine.$Recipes process t
|
||||
tile.machine_assembly_machine.name=Assembly Machine
|
||||
tile.machine_autocrafter.name=Automatic Crafting Table
|
||||
tile.machine_autosaw.name=Automatic Buzz Saw
|
||||
tile.machine_autosaw.desc=Cuts down nearby plants, re-plants trees$Accepts:$-Wood oil$-Ethanol$-Fish oil$-Heavy oil
|
||||
tile.machine_autosaw.desc=Cuts down nearby plants, re-plants trees$Accepts:$-Wood oil$-Ethanol$-Fish oil$-Heavy oil$-Coal Tar Creosote
|
||||
tile.machine_autosaw.suspended=Suspended
|
||||
tile.machine_bat9000.name=Big-Ass Tank 9000
|
||||
tile.machine_battery.name=Energy Storage Block (LEGACY)
|
||||
|
||||
|
Before Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 819 B |
|
Before Width: | Height: | Size: 549 B |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 750 B |
|
Before Width: | Height: | Size: 918 B |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 776 B |
|
Before Width: | Height: | Size: 808 B |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 909 B |
|
Before Width: | Height: | Size: 954 B |
|
Before Width: | Height: | Size: 892 B |
|
Before Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 793 B |
|
Before Width: | Height: | Size: 317 B |
|
Before Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 297 B |