mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge remote-tracking branch 'HbmMods/master'
This commit is contained in:
commit
73987a5b1c
33
changelog
33
changelog
@ -1,33 +0,0 @@
|
||||
## Added
|
||||
* Machines now emit soot. Soot collects in units of 4x4 chunks, and spreads into neighboring regions. High levels of soot cause visible smog.
|
||||
* The system has yet to be balanced, it's possible that only a few machines cause way too much soot or barely any
|
||||
* Gas artillery shells
|
||||
* Chlorine
|
||||
* Phosgene
|
||||
* Mustard gas
|
||||
* Euphemium capacitor
|
||||
* Used for schrabidium transmutation, has infinite durability
|
||||
* Capacitor blocks
|
||||
* Like batteries without GUIs that are constantly in input/output mode
|
||||
* Input is on the top of the capacitor block, for output the capacitor has to be placed onto a capaictor bus
|
||||
* Capacitor buses have one side for the output, multiple buses can be chained up given they are placed in a straight line
|
||||
* Incentivizes splitting the power grid, looping the output back into the input will yield the same weirdness as combining multiple IO energy storage blocks
|
||||
* Desh bullet stamps
|
||||
* Like regular bullets stamps but with infinite durability
|
||||
|
||||
## Changed
|
||||
* Updated russian and chinese localization
|
||||
* Mist now spawns cloud particles with the correct color instead of standard white
|
||||
* HE artillery shells and rockets now turn blocks into slag
|
||||
* The old static bunker structure has been removed and replaced with dynamically generated ones, using the same style of generation as vanilla strongholds.
|
||||
* Changed the processing for chlorocalcite, instead of using a combination furnace it now requires a six step cleaning and electrolysis process
|
||||
|
||||
## Fixed
|
||||
* Fixed the TOXIC trait not respecting protection when applying potion effects
|
||||
* Fixed some armor recipes only accepting polymer and not bakelite
|
||||
* Fixed turbofans not sucking in players
|
||||
* Fixed NTM skybox not applying to superflat worlds
|
||||
* Fixed breeding slot in the fusion reactor never resettingthe progress after completing an operation
|
||||
* Fixed potential issue where tanks would send fluids to invalidated tile entities, voiding themselves almost instantly
|
||||
* Fixed cadmium and technetium steel blocks not having ore dict names
|
||||
* Fixed potential crash regarding certain potion code running clientside
|
||||
@ -495,11 +495,13 @@ public class ModBlocks {
|
||||
public static Block glass_ash;
|
||||
public static Block glass_quartz;
|
||||
|
||||
|
||||
public static Block mush;
|
||||
public static Block mush_block;
|
||||
public static Block mush_block_stem;
|
||||
|
||||
public static Block glyphid_base;
|
||||
public static Block glyphid_spawner;
|
||||
|
||||
public static Block plant_flower;
|
||||
public static Block plant_tall;
|
||||
public static Block plant_dead;
|
||||
@ -1696,6 +1698,8 @@ public class ModBlocks {
|
||||
mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush");
|
||||
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
|
||||
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
|
||||
glyphid_base = new BlockBase(Material.coral).setBlockName("glyphid_base").setStepSound(Block.soundTypeCloth).setHardness(0.5F);
|
||||
glyphid_spawner = new BlockGlyphidSpawner(Material.coral).setBlockName("glyphid_spawner").setStepSound(Block.soundTypeCloth).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":glyphid_base");
|
||||
|
||||
plant_flower = new BlockNTMFlower().setBlockName("plant_flower").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F);
|
||||
plant_tall = new BlockTallPlant().setBlockName("plant_tall").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F);
|
||||
@ -2013,7 +2017,7 @@ public class ModBlocks {
|
||||
reactor_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":reactor_conductor_top").setBlockName("reactor_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_conductor_side");
|
||||
reactor_computer = new ReactorCore(Material.iron).setBlockName("reactor_computer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":reactor_computer");
|
||||
|
||||
fusion_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_conductor_top_alt").setBlockName("fusion_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_conductor_side_alt");
|
||||
fusion_conductor = new BlockToolConversionPillar(Material.iron).addVariant("_welded").setBlockName("fusion_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_conductor");
|
||||
fusion_center = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_center_top_alt").setBlockName("fusion_center").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_center_side_alt");
|
||||
fusion_motor = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_motor_top_alt").setBlockName("fusion_motor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_motor_side_alt");
|
||||
fusion_heater = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_heater_top").setBlockName("fusion_heater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_heater_side");
|
||||
@ -2840,6 +2844,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(mush, mush.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(glyphid_base, glyphid_base.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(glyphid_spawner, glyphid_spawner.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName());
|
||||
|
||||
//Waste
|
||||
@ -3326,7 +3332,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(reactor_conductor, reactor_conductor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reactor_computer, reactor_computer.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerBlock(fusion_conductor, fusion_conductor.getUnlocalizedName());
|
||||
register(fusion_conductor);
|
||||
GameRegistry.registerBlock(fusion_center, fusion_center.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(fusion_motor, fusion_motor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(fusion_heater, fusion_heater.getUnlocalizedName());
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.entity.mob.EntityGlyphidBlaster;
|
||||
import com.hbm.entity.mob.EntityGlyphidBombardier;
|
||||
import com.hbm.entity.mob.EntityGlyphidBrawler;
|
||||
import com.hbm.entity.mob.EntityGlyphidScout;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockGlyphidSpawner extends BlockContainer {
|
||||
|
||||
public BlockGlyphidSpawner(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityGlpyhidSpawner();
|
||||
}
|
||||
|
||||
public static class TileEntityGlpyhidSpawner extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) {
|
||||
|
||||
|
||||
float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT);
|
||||
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 6, yCoord + 1, zCoord - 6, xCoord + 7, yCoord + 9, zCoord + 7));
|
||||
|
||||
if(list.size() < 3) {
|
||||
EntityGlyphid glyphid = createGlyphid(soot);
|
||||
glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
|
||||
this.worldObj.spawnEntityInWorld(glyphid);
|
||||
}
|
||||
|
||||
if(worldObj.rand.nextInt(20) == 0 && soot > 0) {
|
||||
EntityGlyphidScout scout = new EntityGlyphidScout(worldObj);
|
||||
scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
|
||||
this.worldObj.spawnEntityInWorld(scout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EntityGlyphid createGlyphid(float soot) {
|
||||
Random rand = new Random();
|
||||
|
||||
if(soot < 1) {
|
||||
return rand.nextInt(5) == 0 ? new EntityGlyphidBombardier(worldObj) : new EntityGlyphid(worldObj);
|
||||
}
|
||||
|
||||
return rand.nextInt(5) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidBrawler(worldObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,9 +8,11 @@ import java.util.Map.Entry;
|
||||
import com.hbm.blocks.BlockMulti;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.OreDictManager;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.MetaBlock;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
@ -150,6 +152,7 @@ public class BlockToolConversion extends BlockMulti implements IToolable, ILookO
|
||||
|
||||
public static void registerRecipes() {
|
||||
conversions.put(new Pair(ToolType.BOLT, new MetaBlock(ModBlocks.watz_end, 0)), new Pair(new AStack[] {new ComparableStack(ModItems.bolt_dura_steel, 4)}, new MetaBlock(ModBlocks.watz_end, 1)));
|
||||
conversions.put(new Pair(ToolType.TORCH, new MetaBlock(ModBlocks.fusion_conductor, 0)), new Pair(new AStack[] {new OreDictStack(OreDictManager.STEEL.plateCast())}, new MetaBlock(ModBlocks.fusion_conductor, 1)));
|
||||
}
|
||||
|
||||
public static HashMap<Object[], Object> bufferedRecipes = new HashMap();
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockToolConversionPillar extends BlockToolConversion {
|
||||
|
||||
public IIcon[] topIcons;
|
||||
public IIcon topIcon;
|
||||
|
||||
public BlockToolConversionPillar(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
this.blockIcon = iconRegister.registerIcon(this.getTextureName() + "_side");
|
||||
this.topIcon = iconRegister.registerIcon(this.getTextureName() + "_top");
|
||||
|
||||
if(names != null) {
|
||||
icons = new IIcon[names.length];
|
||||
topIcons = new IIcon[names.length];
|
||||
|
||||
for(int i = 0; i < names.length; i++) {
|
||||
icons[i] = iconRegister.registerIcon(getTextureName() + "_side" + names[i]);
|
||||
topIcons[i] = iconRegister.registerIcon(getTextureName() + "_top" + names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
metadata -= 1;
|
||||
|
||||
if(metadata == -1 || icons == null || metadata >= icons.length) {
|
||||
return side == 0 || side == 1 ? topIcon : blockIcon;
|
||||
}
|
||||
|
||||
return side == 0 || side == 1 ? topIcons[metadata] : icons[metadata];
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,10 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineCompressor extends BlockDummyable {
|
||||
|
||||
@ -29,4 +31,19 @@ public class MachineCompressor extends BlockDummyable {
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
return super.checkRequirement(world, x, y, z, dir, o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityITER;
|
||||
@ -241,20 +243,23 @@ public class MachineITER extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
|
||||
|
||||
if(i >= 12 && drop) {
|
||||
|
||||
for(int l = 0; l < 4; l++)
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 64)));
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 36)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_center, 64)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_motor, 4)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.reinforced_glass, 8)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.struct_iter_core, 1)));
|
||||
}
|
||||
|
||||
if(i >= 12 && drop) {
|
||||
|
||||
for(int l = 0; l < 4; l++) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 64)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_cast, 64, Mats.MAT_STEEL.id)));
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_conductor, 36)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.plate_cast, 36, Mats.MAT_STEEL.id)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_center, 64)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_motor, 4)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.reinforced_glass, 8)));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.struct_iter_core, 1)));
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -142,4 +142,60 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
dir = dir.getOpposite();
|
||||
|
||||
int dX = dir.offsetX;
|
||||
int dZ = dir.offsetZ;
|
||||
int rX = rot.offsetX;
|
||||
int rZ = rot.offsetZ;
|
||||
|
||||
return world.getBlock(x + dX, y, z + dZ).isReplaceable(world, x + dX, y, z + dZ) &&
|
||||
world.getBlock(x + rX, y, z + rZ).isReplaceable(world, x + rX, y, z + rZ) &&
|
||||
world.getBlock(x + dX + rX, y, z + dZ + rZ).isReplaceable(world, x + dX + rX, y, z + dZ + rZ) &&
|
||||
world.getBlock(x + dX + rX * 2, y, z + dZ + rZ * 2).isReplaceable(world, x + dX + rX * 2, y, z + dZ + rZ * 2) &&
|
||||
world.getBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ).isReplaceable(world, x + dX * 2 + rX, y, z + dZ * 2 + rZ) &&
|
||||
world.getBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2).isReplaceable(world, x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2) &&
|
||||
world.getBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ).isReplaceable(world, x + dX * 3 + rX, y, z + dZ * 3 + rZ) &&
|
||||
world.getBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2).isReplaceable(world, x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2) &&
|
||||
world.getBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3).isReplaceable(world, x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3).isReplaceable(world, x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3).isReplaceable(world, x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3) &&
|
||||
world.getBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4).isReplaceable(world, x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4) &&
|
||||
world.getBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4).isReplaceable(world, x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
BlockDummyable.safeRem = true;
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
dir = dir.getOpposite();
|
||||
|
||||
int dX = dir.offsetX;
|
||||
int dZ = dir.offsetZ;
|
||||
int rX = rot.offsetX;
|
||||
int rZ = rot.offsetZ;
|
||||
|
||||
world.setBlock(x + dX, y, z + dZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + rX, y, z + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX + rX, y, z + dZ + rZ, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX + rX * 2, y, z + dZ + rZ * 2, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3, this, dir.ordinal(), 3);
|
||||
world.setBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4, this, rot.ordinal(), 3);
|
||||
world.setBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4, this, rot.ordinal(), 3);
|
||||
|
||||
BlockDummyable.safeRem = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ public class BombConfig {
|
||||
public static int limitExplosionLifespan = 0;
|
||||
public static int rain = 0;
|
||||
public static int cont = 0;
|
||||
public static boolean chunkloading = true;
|
||||
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
@ -100,5 +101,7 @@ public class BombConfig {
|
||||
Property rainCont = config.get(CATEGORY_NUKE, "6.06_falloutRainRadiation", 0);
|
||||
rainCont.comment = "Radiation in 100th RADs created by fallout rain";
|
||||
cont = rainCont.getInt();
|
||||
|
||||
chunkloading = CommonConfig.createConfigBool(config, CATEGORY_NUKE, "6.XX_enableChunkLoading", "Allows all types of procedural explosions to keep the central chunk loaded.", true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ public class GeneralConfig {
|
||||
public static boolean enableCrosshairs = true;
|
||||
public static boolean enableReflectorCompat = false;
|
||||
public static boolean enableRenderDistCheck = true;
|
||||
public static boolean enableCustomDashKeybind = false;
|
||||
public static boolean enableReEval = true;
|
||||
public static boolean enableSilentCompStackErrors = true;
|
||||
public static boolean enableChunkyNEIHandler = true;
|
||||
@ -82,7 +81,6 @@ public class GeneralConfig {
|
||||
enableCrosshairs = config.get(CATEGORY_GENERAL, "1.22_enableCrosshairs", true, "Shows custom crosshairs when an NTM gun is being held").getBoolean(true);
|
||||
enableReflectorCompat = config.get(CATEGORY_GENERAL, "1.24_enableReflectorCompat", false, "Enable old reflector oredict name (\"plateDenseLead\") instead of new \"plateTungCar\"").getBoolean(false);
|
||||
enableRenderDistCheck = config.get(CATEGORY_GENERAL, "1.25_enableRenderDistCheck", true, "Check invalid render distances (over 16, without OptiFine) and fix it").getBoolean(true);
|
||||
enableCustomDashKeybind = config.get(CATEGORY_GENERAL, "1.26_enableCustomDashKeybind", false, "Enable custom dash keybind instead of shift").getBoolean(false);
|
||||
enableReEval = config.get(CATEGORY_GENERAL, "1.27_enableReEval", true, "Allows re-evaluating power networks on link remove instead of destroying and recreating").getBoolean(true);
|
||||
enableSilentCompStackErrors = config.get(CATEGORY_GENERAL, "1.28_enableSilentCompStackErrors", false, "Enabling this will disable log spam created by unregistered items in ComparableStack instances.").getBoolean(false);
|
||||
hintPos = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.29_hudOverlayPosition", "0: Top left\n1: Top right\n2: Center right\n3: Center Left", 0);
|
||||
|
||||
@ -14,6 +14,7 @@ public class MobConfig {
|
||||
public static int raidDelay = 30 * 60 * 60;
|
||||
public static int raidChance = 3;
|
||||
public static int raidAmount = 15;
|
||||
public static int raidDrones = 5;
|
||||
public static int raidAttackDelay = 40;
|
||||
public static int raidAttackReach = 2;
|
||||
public static int raidAttackDistance = 32;
|
||||
@ -44,6 +45,7 @@ public class MobConfig {
|
||||
raidAttackDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.F04_raidAttackDelay", "Time between individual attempts to break machines", 40);
|
||||
raidAttackReach = CommonConfig.createConfigInt(config, CATEGORY, "12.F05_raidAttackReach", "How far away machines can be broken", 2);
|
||||
raidAttackDistance = CommonConfig.createConfigInt(config, CATEGORY, "12.F06_raidAttackDistance", "How far away agents will spawn from the targeted player", 32);
|
||||
raidDrones = CommonConfig.createConfigInt(config, CATEGORY, "12.F07_raidDrones", "How many quadcopter drones are spawned each raid", 5);
|
||||
|
||||
enableElementals = CommonConfig.createConfigBool(config, CATEGORY, "12.E00_enableMeltdownElementals", "Whether there should be radiation elementals", true);
|
||||
elementalDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.E01_elementalDelay", "How many world ticks need to pass for a check to be performed", 30 * 60 * 60);
|
||||
|
||||
@ -211,6 +211,7 @@ public class EntityMappings {
|
||||
addEntity(EntitySawblade.class, "entity_stray_saw", 1000);
|
||||
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
|
||||
addEntity(EntityMist.class, "entity_mist", 250, false);
|
||||
addEntity(EntityAcidBomb.class, "entity_acid_bomb", 1000);
|
||||
|
||||
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
||||
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
||||
@ -233,11 +234,20 @@ public class EntityMappings {
|
||||
addMob(EntityDuck.class, "entity_fucc_a_ducc", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityQuackos.class, "entity_elder_one", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityFBI.class, "entity_ntm_fbi", 0x008000, 0x404040);
|
||||
addMob(EntityFBIDrone.class, "entity_ntm_fbi_drone", 0x008000, 0x404040);
|
||||
addMob(EntityRADBeast.class, "entity_ntm_radiation_blaze", 0x303030, 0x008000);
|
||||
addMob(EntitySiegeZombie.class, "entity_meme_zombie", 0x303030, 0x008000);
|
||||
addMob(EntitySiegeSkeleton.class, "entity_meme_skeleton", 0x303030, 0x000080);
|
||||
addMob(EntitySiegeUFO.class, "entity_meme_ufo", 0x303030, 0x800000);
|
||||
addMob(EntitySiegeCraft.class, "entity_meme_craft", 0x303030, 0x808000);
|
||||
addMob(EntityGlyphid.class, "entity_glyphid", 0x724A21, 0xD2BB72);
|
||||
addMob(EntityGlyphidBrawler.class, "entity_glyphid_brawler", 0x273038, 0xD2BB72);
|
||||
addMob(EntityGlyphidBehemoth.class, "entity_glyphid_behemoth", 0x267F00, 0xD2BB72);
|
||||
addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0);
|
||||
addMob(EntityGlyphidBombardier.class, "entity_glyphid_bombardier", 0xDDD919, 0xDBB79D);
|
||||
addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D);
|
||||
addMob(EntityGlyphidScout.class, "entity_glyphid_scout", 0x273038, 0xB9E36B);
|
||||
addMob(EntityGlyphidNuclear.class, "entity_glyphid_nuclear", 0x267F00, 0xA0A0A0);
|
||||
|
||||
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
||||
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
|
||||
|
||||
@ -7,11 +7,10 @@ import com.hbm.explosion.ExplosionBalefire;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBalefire extends Entity {
|
||||
public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -53,48 +52,46 @@ public class EntityBalefire extends Entity {
|
||||
super(p_i1582_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.did)
|
||||
{
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||
|
||||
exp = new ExplosionBalefire((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange);
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
speed += 1; //increase speed to keep up with expansion
|
||||
|
||||
boolean flag = false;
|
||||
for(int i = 0; i < this.speed; i++)
|
||||
{
|
||||
flag = exp.update();
|
||||
|
||||
if(flag) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(!mute && rand.nextInt(5) == 0)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
if(!flag) {
|
||||
|
||||
if(!mute)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||
}
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did) {
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||
|
||||
exp = new ExplosionBalefire((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange);
|
||||
|
||||
this.did = true;
|
||||
}
|
||||
|
||||
speed += 1; // increase speed to keep up with expansion
|
||||
|
||||
boolean flag = false;
|
||||
for(int i = 0; i < this.speed; i++) {
|
||||
flag = exp.update();
|
||||
|
||||
if(flag) {
|
||||
clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(!mute && rand.nextInt(5) == 0)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
if(!flag) {
|
||||
|
||||
if(!mute)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||
}
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
public EntityBalefire mute() {
|
||||
this.mute = true;
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
package com.hbm.entity.logic;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityEnvirEffect extends Entity {
|
||||
|
||||
public int maxAge = 100;
|
||||
public int blockRadius = 7;
|
||||
public int entityRadius = 7;
|
||||
public int chance = 10;
|
||||
public boolean hasBlockEffect = true;
|
||||
public boolean hasEntityEffect = true;
|
||||
|
||||
public EntityEnvirEffect(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
this.ticksExisted = nbt.getInteger("lifetime");
|
||||
this.maxAge = nbt.getInteger("lifecap");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("lifetime", this.ticksExisted);
|
||||
nbt.setInteger("lifecap", this.maxAge);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
|
||||
if(hasBlockEffect && rand.nextInt(chance) == 0)
|
||||
applyBlockEffect();
|
||||
|
||||
if(hasEntityEffect && rand.nextInt(chance) == 0)
|
||||
applyEntityEffect();
|
||||
}
|
||||
|
||||
private void applyBlockEffect() { };
|
||||
private void applyEntityEffect() { };
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.hbm.entity.logic;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityEnvirEffectRad extends EntityEnvirEffect {
|
||||
|
||||
public EntityEnvirEffectRad(World p_i1582_1_) {
|
||||
super(p_i1582_1_);
|
||||
}
|
||||
|
||||
public void randomizeAge(int min, int max) {
|
||||
this.maxAge = min + rand.nextInt(max - min);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.hbm.entity.logic;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
|
||||
public abstract class EntityExplosionChunkloading extends Entity implements IChunkLoader {
|
||||
|
||||
private Ticket loaderTicket;
|
||||
private ChunkCoordIntPair loadedChunk;
|
||||
|
||||
public EntityExplosionChunkloading(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ticket ticket) {
|
||||
if(!worldObj.isRemote && ticket != null) {
|
||||
if(loaderTicket == null) {
|
||||
loaderTicket = ticket;
|
||||
loaderTicket.bindEntity(this);
|
||||
loaderTicket.getModData();
|
||||
}
|
||||
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair(chunkCoordX, chunkCoordZ));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadChunk(int x, int z) {
|
||||
|
||||
if(this.loadedChunk == null) {
|
||||
this.loadedChunk = new ChunkCoordIntPair(x, z);
|
||||
ForgeChunkManager.forceChunk(loaderTicket, loadedChunk);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearChunkLoader() {
|
||||
if(!worldObj.isRemote && loaderTicket != null && loadedChunk != null) {
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, loadedChunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,14 +20,13 @@ import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Spaghetti("why???")
|
||||
public class EntityNukeExplosionMK3 extends Entity {
|
||||
public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -59,31 +58,32 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
|
||||
long time = nbt.getLong("milliTime");
|
||||
|
||||
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000)
|
||||
if(BombConfig.limitExplosionLifespan > 0 && System.currentTimeMillis() - time > BombConfig.limitExplosionLifespan * 1000) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
if(this.waste)
|
||||
{
|
||||
exp = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
if(this.waste) {
|
||||
exp = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, 0);
|
||||
exp.readFromNbt(nbt, "exp_");
|
||||
wst = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, (int)(this.destructionRange * 1.8), this.coefficient, 2);
|
||||
wst = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, (int) (this.destructionRange * 1.8), this.coefficient, 2);
|
||||
wst.readFromNbt(nbt, "wst_");
|
||||
vap = new ExplosionNukeAdvanced((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, (int)(this.destructionRange * 2.5), this.coefficient, 1);
|
||||
vap = new ExplosionNukeAdvanced((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, (int) (this.destructionRange * 2.5), this.coefficient, 1);
|
||||
vap.readFromNbt(nbt, "vap_");
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if(extType == 0) {
|
||||
expl = new ExplosionFleija((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
if(extType == 0) {
|
||||
expl = new ExplosionFleija((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
expl.readFromNbt(nbt, "expl_");
|
||||
}
|
||||
if(extType == 1) {
|
||||
sol = new ExplosionSolinium((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
sol.readFromNbt(nbt, "sol_");
|
||||
}
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
|
||||
}
|
||||
if(extType == 1) {
|
||||
sol = new ExplosionSolinium((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
|
||||
sol.readFromNbt(nbt, "sol_");
|
||||
}
|
||||
}
|
||||
|
||||
this.did = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -120,6 +120,8 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did)
|
||||
{
|
||||
@ -149,25 +151,31 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
boolean flag = false;
|
||||
boolean flag3 = false;
|
||||
|
||||
for(int i = 0; i < this.speed; i++)
|
||||
{
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
wst.update();
|
||||
flag3 = vap.update();
|
||||
|
||||
if(flag3) {
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
if(extType == 0)
|
||||
if(expl.update())
|
||||
this.setDead();
|
||||
if(extType == 1)
|
||||
if(sol.update())
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < this.speed; i++) {
|
||||
if(waste) {
|
||||
flag = exp.update();
|
||||
wst.update();
|
||||
flag3 = vap.update();
|
||||
|
||||
if(flag3) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
} else {
|
||||
if(extType == 0) {
|
||||
if(expl.update()) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
if(extType == 1) {
|
||||
if(sol.update()) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
@ -196,9 +204,6 @@ public class EntityNukeExplosionMK3 extends Entity {
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
|
||||
public static HashMap<ATEntry, Long> at = new HashMap();
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -22,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityNukeExplosionMK5 extends Entity {
|
||||
public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
|
||||
//Strength of the blast
|
||||
public int strength;
|
||||
@ -52,9 +51,12 @@ public class EntityNukeExplosionMK5 extends Entity {
|
||||
public void onUpdate() {
|
||||
|
||||
if(strength == 0) {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
for(Object player : this.worldObj.playerEntities) {
|
||||
((EntityPlayer)player).triggerAchievement(MainRegistry.achManhattan);
|
||||
@ -92,9 +94,11 @@ public class EntityNukeExplosionMK5 extends Entity {
|
||||
fallout.setScale((int)(this.length * 2.5 + falloutAdd) * BombConfig.falloutRange / 100);
|
||||
|
||||
this.worldObj.spawnEntityInWorld(fallout);
|
||||
|
||||
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
} else {
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,10 @@ import com.hbm.explosion.ExplosionTom;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityTomBlast extends Entity {
|
||||
public class EntityTomBlast extends EntityExplosionChunkloading {
|
||||
|
||||
public int age = 0;
|
||||
public int destructionRange = 0;
|
||||
@ -54,6 +53,8 @@ public class EntityTomBlast extends Entity {
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) loadChunk((int) Math.floor(posX / 16D), (int) Math.floor(posZ / 16D));
|
||||
|
||||
if(!this.did) {
|
||||
|
||||
if(GeneralConfig.enableExtendedLogging && !worldObj.isRemote)
|
||||
@ -89,8 +90,4 @@ public class EntityTomBlast extends Entity {
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,46 +48,36 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
targetZ = (int) posZ;
|
||||
}
|
||||
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
|
||||
{
|
||||
if (this.isEntityInvulnerable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.isDead && !this.worldObj.isRemote)
|
||||
{
|
||||
health -= p_70097_2_;
|
||||
|
||||
if (this.health <= 0)
|
||||
{
|
||||
this.setDead();
|
||||
this.killMissile();
|
||||
}
|
||||
}
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void killMissile() {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
|
||||
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
|
||||
}
|
||||
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
if(this.isEntityInvulnerable()) {
|
||||
return false;
|
||||
} else {
|
||||
if(!this.isDead && !this.worldObj.isRemote) {
|
||||
health -= p_70097_2_;
|
||||
|
||||
if(this.health <= 0) {
|
||||
this.setDead();
|
||||
this.killMissile();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void killMissile() {
|
||||
ExplosionLarge.explode(worldObj, posX, posY, posZ, 5, true, false, true);
|
||||
ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075);
|
||||
ExplosionLarge.spawnMissileDebris(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 0.25, getDebris(), getDebrisRareDrop());
|
||||
}
|
||||
|
||||
public EntityMissileBaseAdvanced(World world, float x, float y, float z, int a, int b) {
|
||||
super(world);
|
||||
this.ignoreFrustumCheck = true;
|
||||
/*this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;*/
|
||||
this.setLocationAndAngles(x, y, z, 0, 0);
|
||||
startX = (int) x;
|
||||
startZ = (int) z;
|
||||
@ -95,19 +85,19 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
targetZ = b;
|
||||
this.motionY = 2;
|
||||
|
||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||
accelXZ = decelY = 1/vector.lengthVector();
|
||||
Vec3 vector = Vec3.createVectorHelper(targetX - startX, 0, targetZ - startZ);
|
||||
accelXZ = decelY = 1 / vector.lengthVector();
|
||||
decelY *= 2;
|
||||
|
||||
|
||||
velocity = 1;
|
||||
|
||||
this.setSize(1.5F, 1.5F);
|
||||
this.setSize(1.5F, 1.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
|
||||
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
||||
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -212,7 +202,6 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
}
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
//this.worldObj.spawnEntityInWorld(new EntitySmokeFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0, 0.0, 0.0));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 2),
|
||||
new TargetPoint(worldObj.provider.dimensionId, posX, posY, posZ, 300));
|
||||
|
||||
@ -220,30 +209,28 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.water &&
|
||||
this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.flowing_water) {
|
||||
|
||||
if(!this.worldObj.isRemote)
|
||||
{
|
||||
onImpact();
|
||||
}
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int)(posX / 16), (int)(posZ / 16));
|
||||
|
||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||
cluster();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
if(!this.worldObj.isRemote) {
|
||||
onImpact();
|
||||
}
|
||||
this.killAndClear();
|
||||
return;
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int) (posX / 16), (int) (posZ / 16));
|
||||
|
||||
if(motionY < -1 && this.isCluster && !worldObj.isRemote) {
|
||||
cluster();
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isInRangeToRenderDist(double distance)
|
||||
{
|
||||
return distance < 500000;
|
||||
}
|
||||
public boolean isInRangeToRenderDist(double distance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void onImpact();
|
||||
|
||||
@ -272,30 +259,31 @@ public abstract class EntityMissileBaseAdvanced extends Entity implements IChunk
|
||||
|
||||
List<ChunkCoordIntPair> loadedChunks = new ArrayList<ChunkCoordIntPair>();
|
||||
|
||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ)
|
||||
{
|
||||
if(!worldObj.isRemote && loaderTicket != null)
|
||||
{
|
||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
||||
{
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
||||
}
|
||||
public void loadNeighboringChunks(int newChunkX, int newChunkZ) {
|
||||
if(!worldObj.isRemote && loaderTicket != null) {
|
||||
|
||||
clearChunkLoader();
|
||||
|
||||
loadedChunks.clear();
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ + 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ - 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ - 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ + 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ + 1));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ - 1));
|
||||
loadedChunks.clear();
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D), newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D)));
|
||||
|
||||
for(ChunkCoordIntPair chunk : loadedChunks)
|
||||
{
|
||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void killAndClear() {
|
||||
this.setDead();
|
||||
this.clearChunkLoader();
|
||||
}
|
||||
|
||||
public void clearChunkLoader() {
|
||||
if(!worldObj.isRemote && loaderTicket != null) {
|
||||
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
src/main/java/com/hbm/entity/mob/EntityFBIDrone.java
Normal file
64
src/main/java/com/hbm/entity/mob/EntityFBIDrone.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.entity.grenade.EntityGrenadeGeneric;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityFBIDrone extends EntityUFOBase {
|
||||
|
||||
private int attackCooldown;
|
||||
|
||||
public EntityFBIDrone(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
super.updateEntityActionState();
|
||||
if(this.courseChangeCooldown > 0) this.courseChangeCooldown--;
|
||||
if(this.scanCooldown > 0) this.scanCooldown--;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(attackCooldown > 0) attackCooldown--;
|
||||
|
||||
if(this.target != null && attackCooldown <= 0) {
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(posX - target.posX, posY - target.posY, posZ - target.posZ);
|
||||
if(Math.abs(vec.xCoord) < 5 && Math.abs(vec.zCoord) < 5 && vec.yCoord > 3) {
|
||||
attackCooldown = 60;
|
||||
EntityGrenadeGeneric grenade = new EntityGrenadeGeneric(worldObj);
|
||||
grenade.setPosition(posX, posY, posZ);
|
||||
worldObj.spawnEntityInWorld(grenade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.courseChangeCooldown > 0) {
|
||||
approachPosition(this.target == null ? 0.25D : 0.5D);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(35.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScanRange() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int targetHeightOffset() {
|
||||
return 7 + rand.nextInt(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int wanderHeightOffset() {
|
||||
return 7 + rand.nextInt(4);
|
||||
}
|
||||
}
|
||||
228
src/main/java/com/hbm/entity/mob/EntityGlyphid.java
Normal file
228
src/main/java/com/hbm/entity/mob/EntityGlyphid.java
Normal file
@ -0,0 +1,228 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.pathfinder.PathFinderUtils;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphid extends EntityMob {
|
||||
|
||||
public EntityGlyphid(World world) {
|
||||
super(world);
|
||||
/*this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
|
||||
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
|
||||
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
|
||||
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
|
||||
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));*/
|
||||
this.setSize(1.75F, 1F);
|
||||
}
|
||||
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_tex;
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return 1.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(16, new Byte((byte) 0)); //wall climbing
|
||||
this.dataWatcher.addObject(17, new Byte((byte) 0b11111)); //armor
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity findPlayerToAttack() {
|
||||
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 128.0D);
|
||||
return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntityActionState() {
|
||||
super.updateEntityActionState();
|
||||
|
||||
// hell yeah!!
|
||||
if(this.entityToAttack != null && !this.hasPath()) {
|
||||
this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, false, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return entityToAttack == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote) {
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
|
||||
if(armor != 0) { //if at least one bit of armor is present
|
||||
|
||||
if(amount < getDamageThreshold()) return false;
|
||||
|
||||
int chance = getArmorBreakChance(amount); //chances of armor being broken off
|
||||
if(this.rand.nextInt(chance) == 0 && amount > 1) {
|
||||
breakOffArmor();
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
amount -= getDamageThreshold();
|
||||
if(amount < 0) return true;
|
||||
}
|
||||
|
||||
amount = this.calculateDamage(amount);
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 10 ? 5 : amount < 20 ? 3 : 2;
|
||||
}
|
||||
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor++;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public float getDamageThreshold() {
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
public void breakOffArmor() {
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
List<Integer> indices = Arrays.asList(0, 1, 2, 3, 4);
|
||||
Collections.shuffle(indices);
|
||||
|
||||
for(Integer i : indices) {
|
||||
byte bit = (byte) (1 << i);
|
||||
if((armor & bit) > 0) {
|
||||
armor &= ~bit;
|
||||
armor = (byte) (armor & 0b11111);
|
||||
this.dataWatcher.updateObject(17, armor);
|
||||
worldObj.playSoundAtEntity(this, "mob.zombie.woodbreak", 1.0F, 1.25F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity victum) {
|
||||
if(this.isSwingInProgress) return false;
|
||||
this.swingItem();
|
||||
return super.attackEntityAsMob(victum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
this.setBesideClimbableBlock(this.isCollidedHorizontally);
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 200 == 0) {
|
||||
this.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateArmSwingProgress() {
|
||||
int i = this.swingDuration();
|
||||
|
||||
if(this.isSwingInProgress) {
|
||||
++this.swingProgressInt;
|
||||
|
||||
if(this.swingProgressInt >= i) {
|
||||
this.swingProgressInt = 0;
|
||||
this.isSwingInProgress = false;
|
||||
}
|
||||
} else {
|
||||
this.swingProgressInt = 0;
|
||||
}
|
||||
|
||||
this.swingProgress = (float) this.swingProgressInt / (float) i;
|
||||
}
|
||||
|
||||
public int swingDuration() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInWeb() { }
|
||||
|
||||
@Override
|
||||
public boolean isOnLadder() {
|
||||
return this.isBesideClimbableBlock();
|
||||
}
|
||||
|
||||
public boolean isBesideClimbableBlock() {
|
||||
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void setBesideClimbableBlock(boolean climbable) {
|
||||
byte watchable = this.dataWatcher.getWatchableObjectByte(16);
|
||||
|
||||
if(climbable) {
|
||||
watchable = (byte) (watchable | 1);
|
||||
} else {
|
||||
watchable &= -2;
|
||||
}
|
||||
|
||||
this.dataWatcher.updateObject(16, Byte.valueOf(watchable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumCreatureAttribute getCreatureAttribute() {
|
||||
return EnumCreatureAttribute.ARTHROPOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.dataWatcher.updateObject(17, nbt.getByte("armor"));
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java
Normal file
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBehemoth extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBehemoth(World world) {
|
||||
super(world);
|
||||
this.setSize(2.25F, 1.25F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_behemoth_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 1.5D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 20 ? 10 : amount < 100 ? 5 : amount > 200 ? 1 : 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 3;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 2.5F;
|
||||
}
|
||||
}
|
||||
80
src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java
Normal file
80
src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java
Normal file
@ -0,0 +1,80 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBlaster extends EntityGlyphidBombardier {
|
||||
|
||||
public EntityGlyphidBlaster(World world) {
|
||||
super(world);
|
||||
this.setSize(2F, 1.125F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_blaster_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 1.25D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 2;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBombDamage() {
|
||||
return 10F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBombCount() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpreadMult() {
|
||||
return 0.75F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getV0() {
|
||||
return 1.25D;
|
||||
}
|
||||
}
|
||||
101
src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java
Normal file
101
src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.entity.projectile.EntityAcidBomb;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBombardier extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBombardier(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_bombardier_tex;
|
||||
}
|
||||
|
||||
protected Entity lastTarget;
|
||||
protected double lastX;
|
||||
protected double lastY;
|
||||
protected double lastZ;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
|
||||
Entity e = this.getEntityToAttack();
|
||||
|
||||
if(this.ticksExisted % 20 == 0 && e != null) {
|
||||
this.lastTarget = e;
|
||||
this.lastX = e.posX;
|
||||
this.lastY = e.posY;
|
||||
this.lastZ = e.posZ;
|
||||
}
|
||||
|
||||
if(this.ticksExisted % 20 == 1 && e != null) {
|
||||
|
||||
boolean topAttack = rand.nextBoolean();
|
||||
|
||||
double velX = e.posX - lastX;
|
||||
double velY = e.posY - lastY;
|
||||
double velZ = e.posZ - lastZ;
|
||||
|
||||
if(this.lastTarget != e || Vec3.createVectorHelper(velX, velY, velZ).lengthVector() > 30) {
|
||||
velX = velY = velZ = 0;
|
||||
}
|
||||
|
||||
int prediction = topAttack ? 60 : 20;
|
||||
Vec3 delta = Vec3.createVectorHelper(e.posX - posX + velX * prediction, (e.posY + e.height / 2) - (posY + 1) + velY * prediction, e.posZ - posZ + velZ * prediction);
|
||||
double len = delta.lengthVector();
|
||||
if(len < 3) return;
|
||||
double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord);
|
||||
|
||||
double x = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
|
||||
double y = delta.yCoord;
|
||||
double v0 = getV0();
|
||||
double v02 = v0 * v0;
|
||||
double g = 0.04D;
|
||||
double upperLower = topAttack ? 1 : -1;
|
||||
double targetPitch = Math.atan((v02 + Math.sqrt(v02*v02 - g*(g*x*x + 2*y*v02)) * upperLower) / (g*x));
|
||||
|
||||
if(!Double.isNaN(targetPitch)) {
|
||||
|
||||
Vec3 fireVec = Vec3.createVectorHelper(v0, 0, 0);
|
||||
fireVec.rotateAroundZ((float) -targetPitch);
|
||||
fireVec.rotateAroundY((float) -(targetYaw + Math.PI * 0.5));
|
||||
|
||||
for(int i = 0; i < getBombCount(); i++) {
|
||||
EntityAcidBomb bomb = new EntityAcidBomb(worldObj, posX, posY + 1, posZ);
|
||||
bomb.setThrowableHeading(fireVec.xCoord, fireVec.yCoord, fireVec.zCoord, (float) v0, i * getSpreadMult());
|
||||
bomb.damage = getBombDamage();
|
||||
worldObj.spawnEntityInWorld(bomb);
|
||||
}
|
||||
|
||||
this.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getBombDamage() {
|
||||
return 1.5F;
|
||||
}
|
||||
|
||||
public int getBombCount() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public float getSpreadMult() {
|
||||
return 1F;
|
||||
}
|
||||
|
||||
public double getV0() {
|
||||
return 1D;
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java
Normal file
60
src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBrawler extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBrawler(World world) {
|
||||
super(world);
|
||||
this.setSize(2F, 1.125F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_brawler_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 1.25D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 2;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 1.0F;
|
||||
}
|
||||
}
|
||||
81
src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java
Normal file
81
src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java
Normal file
@ -0,0 +1,81 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidBrenda extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBrenda(World world) {
|
||||
super(world);
|
||||
this.setSize(2.5F, 1.75F);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_brenda_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 2D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 25 ? 100 : amount > 1000 ? 1 : 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 5;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 10F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
if(!this.worldObj.isRemote && this.getHealth() <= 0.0F) {
|
||||
for(int i = 0; i < 12; ++i) {
|
||||
EntityGlyphid glyphid = new EntityGlyphid(worldObj);
|
||||
glyphid.setLocationAndAngles(this.posX, this.posY + 0.5D, this.posZ, rand.nextFloat() * 360.0F, 0.0F);
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.resistance.id, 5 * 60 * 20, 2));
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 5 * 60 * 20, 0));
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 5 * 60 * 20, 4));
|
||||
glyphid.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 5 * 60 * 20, 19));
|
||||
this.worldObj.spawnEntityInWorld(glyphid);
|
||||
glyphid.moveEntity(rand.nextGaussian(), 0, rand.nextGaussian());
|
||||
}
|
||||
}
|
||||
|
||||
super.setDead();
|
||||
}
|
||||
}
|
||||
108
src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java
Normal file
108
src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java
Normal file
@ -0,0 +1,108 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockMutatorDebris;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidNuclear extends EntityGlyphid {
|
||||
|
||||
public int deathTicks;
|
||||
|
||||
public EntityGlyphidNuclear(World world) {
|
||||
super(world);
|
||||
this.setSize(2.5F, 1.75F);
|
||||
this.isImmuneToFire = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_nuclear_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 2D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return amount < 25 ? 100 : amount > 1000 ? 1 : 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateDamage(float amount) {
|
||||
|
||||
byte armor = this.dataWatcher.getWatchableObjectByte(17);
|
||||
int divisor = 1;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
if((armor & (1 << i)) > 0) {
|
||||
divisor += 5;
|
||||
}
|
||||
}
|
||||
|
||||
amount /= divisor;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 10F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeathUpdate() {
|
||||
++this.deathTicks;
|
||||
|
||||
if(this.deathTicks == 100) {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this);
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard(24));
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop());
|
||||
vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(1.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.explode();
|
||||
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
// if the FX type is "muke", apply random BF effect
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) {
|
||||
data.setBoolean("balefire", true);
|
||||
}
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
} else {
|
||||
if(!worldObj.isRemote && this.deathTicks % 10 == 0) {
|
||||
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.fstbmbPing", 5.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
157
src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java
Normal file
157
src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java
Normal file
@ -0,0 +1,157 @@
|
||||
package com.hbm.entity.mob;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.world.feature.GlyphidHive;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityGlyphidScout extends EntityGlyphid {
|
||||
|
||||
public boolean hasHome = false;
|
||||
public double homeX;
|
||||
public double homeY;
|
||||
public double homeZ;
|
||||
|
||||
public EntityGlyphidScout(World world) {
|
||||
super(world);
|
||||
this.setSize(1.25F, 0.75F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageThreshold() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_scout_tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScale() {
|
||||
return 0.75D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorBreakChance(float amount) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDespawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(!this.hasHome) {
|
||||
this.homeX = posX;
|
||||
this.homeY = posY;
|
||||
this.homeZ = posZ;
|
||||
this.hasHome = true;
|
||||
}
|
||||
|
||||
if(rand.nextInt(20) == 0) fleeingTick = 2;
|
||||
|
||||
if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 8) {
|
||||
|
||||
Block b = worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
|
||||
|
||||
int accuracy = 16;
|
||||
for(int i = 0; i < accuracy; i++) {
|
||||
float angle = (float) Math.toRadians(360D / accuracy * i);
|
||||
Vec3 rot = Vec3.createVectorHelper(0, 0, 16);
|
||||
rot.rotateAroundY(angle);
|
||||
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ);
|
||||
Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord);
|
||||
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
||||
|
||||
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
||||
|
||||
Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
if(block == ModBlocks.glyphid_base) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) {
|
||||
this.setDead();
|
||||
worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false);
|
||||
GlyphidHive.generate(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateWanderPath() {
|
||||
this.worldObj.theProfiler.startSection("stroll");
|
||||
boolean flag = false;
|
||||
int pathX = -1;
|
||||
int pathY = -1;
|
||||
int pathZ = -1;
|
||||
float maxWeight = -99999.0F;
|
||||
|
||||
for(int l = 0; l < 5; ++l) {
|
||||
int x = MathHelper.floor_double(this.posX + (double) this.rand.nextInt(25) - 12.0D);
|
||||
int y = MathHelper.floor_double(this.posY + (double) this.rand.nextInt(11) - 5.0D);
|
||||
int z = MathHelper.floor_double(this.posZ + (double) this.rand.nextInt(25) - 12.0D);
|
||||
float weight = this.getBlockPathWeight(x, y, z);
|
||||
|
||||
if(weight > maxWeight) {
|
||||
maxWeight = weight;
|
||||
pathX = x;
|
||||
pathY = y;
|
||||
pathZ = z;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
this.setPathToEntity(this.worldObj.getEntityPathToXYZ(this, pathX, pathY, pathZ, 10.0F, true, false, false, true));
|
||||
}
|
||||
|
||||
this.worldObj.theProfiler.endSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setBoolean("hasHome", hasHome);
|
||||
nbt.setDouble("homeX", homeX);
|
||||
nbt.setDouble("homeY", homeY);
|
||||
nbt.setDouble("homeZ", homeZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.hasHome = nbt.getBoolean("hasHome");
|
||||
this.homeX = nbt.getDouble("homeX");
|
||||
this.homeY = nbt.getDouble("homeY");
|
||||
this.homeZ = nbt.getDouble("homeZ");
|
||||
}
|
||||
}
|
||||
@ -18,8 +18,8 @@ public abstract class EntityUFOBase extends EntityFlying implements IMob {
|
||||
protected int courseChangeCooldown;
|
||||
protected Entity target;
|
||||
|
||||
public EntityUFOBase(World p_i1587_1_) {
|
||||
super(p_i1587_1_);
|
||||
public EntityUFOBase(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
62
src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java
Normal file
62
src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.hbm.entity.pathfinder;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathFinder;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PathFinderUtils {
|
||||
|
||||
public static PathEntity getPathEntityToEntityPartial(World world, Entity fromEntity, Entity toEntity, float maxDist, boolean allowDoors, boolean allowBlocked, boolean allowWater, boolean canDrown) {
|
||||
world.theProfiler.startSection("pathfind");
|
||||
int startX = MathHelper.floor_double(fromEntity.posX);
|
||||
int startY = MathHelper.floor_double(fromEntity.posY + 1.0D);
|
||||
int startZ = MathHelper.floor_double(fromEntity.posZ);
|
||||
int maxDistEff = (int) (maxDist + 16.0F);
|
||||
int minX = startX - maxDistEff;
|
||||
int minY = startY - maxDistEff;
|
||||
int minZ = startZ - maxDistEff;
|
||||
int maxX = startX + maxDistEff;
|
||||
int maxY = startY + maxDistEff;
|
||||
int maxZ = startZ + maxDistEff;
|
||||
ChunkCache chunkcache = new ChunkCache(world, minX, minY, minZ, maxX, maxY, maxZ, 0);
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(toEntity.posX - fromEntity.posX, toEntity.posY - fromEntity.posY, toEntity.posZ - fromEntity.posZ);
|
||||
vec = vec.normalize();
|
||||
vec.xCoord *= maxDist;
|
||||
vec.yCoord *= maxDist;
|
||||
vec.zCoord *= maxDist;
|
||||
|
||||
int x = (int) Math.floor(fromEntity.posX + vec.xCoord);
|
||||
int y = (int) Math.floor(fromEntity.posY + vec.yCoord);
|
||||
int z = (int) Math.floor(fromEntity.posZ + vec.zCoord);
|
||||
|
||||
//this part will adjust the end of the path so it's actually on the ground, it being unreachable causes mobs to slow down
|
||||
boolean solid = false;
|
||||
|
||||
for(int i = y; i > y - 10; i--) {
|
||||
if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) {
|
||||
solid = true;
|
||||
y = i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!solid) for(int i = y + 10; i > y; i--) {
|
||||
if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) {
|
||||
solid = true;
|
||||
y = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, toEntity, maxDist);
|
||||
PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, x, y, z, maxDist);
|
||||
world.theProfiler.endSection();
|
||||
return pathentity;
|
||||
}
|
||||
}
|
||||
60
src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java
Normal file
60
src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.hbm.entity.projectile;
|
||||
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityAcidBomb extends EntityThrowableInterp {
|
||||
|
||||
public float damage = 1.5F;
|
||||
|
||||
public EntityAcidBomb(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityAcidBomb(World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
|
||||
if(worldObj.isRemote) return;
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.ENTITY) {
|
||||
|
||||
if(!(mop.entityHit instanceof EntityGlyphid)) {
|
||||
mop.entityHit.attackEntityFrom(ModDamageSource.acid, damage);
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK)
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGravityVelocity() {
|
||||
return 0.04D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getAirDrag() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setFloat("damage", damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
super.readEntityFromNBT(nbt);
|
||||
this.damage = nbt.getFloat("damage");
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
data.setString("type", "debug");
|
||||
data.setInteger("color", 0x0000ff);
|
||||
data.setFloat("scale", 1.5F);
|
||||
data.setString("text", id);
|
||||
data.setString("text", id + " (#" + train.ltuIndex + ")");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, train.posX, train.posY + 1, train.posZ), new TargetPoint(this.dimension, train.posX, train.posY + 1, train.posZ, 50));
|
||||
}
|
||||
}
|
||||
@ -180,9 +180,6 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new PlayerInformPacket(ChatBuilder.start("" + this.rotationPitch).color(EnumChatFormatting.RED).flush(), 1),
|
||||
new TargetPoint(dimension, posX, posY + 1, posZ, 50));
|
||||
|
||||
if(this.coupledFront != null && this.coupledFront.isDead) {
|
||||
this.coupledFront = null;
|
||||
@ -319,7 +316,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
|
||||
for(LogicalTrainUnit ltu : ltus) {
|
||||
|
||||
double speed = ltu.getTotalSpeed();
|
||||
double speed = ltu.getTotalSpeed() + ltu.pushForce;
|
||||
|
||||
if(Math.abs(speed) < 0.001) speed = 0;
|
||||
|
||||
@ -346,6 +343,10 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
} else {
|
||||
ltu.setRenderPos(train, frontPos, backPos);
|
||||
}
|
||||
|
||||
//ltu.pushForce *= 0.95;
|
||||
ltu.pushForce = 0;
|
||||
ltu.collideTrain(speed);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -355,6 +356,12 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
} else {
|
||||
ltu.moveTrainByApproach(speed);
|
||||
}
|
||||
|
||||
if(ltu.trains.length != 1) {
|
||||
//ltu.pushForce *= 0.95;
|
||||
ltu.pushForce = 0;
|
||||
ltu.collideTrain(speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -540,6 +547,7 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
|
||||
public static class LogicalTrainUnit {
|
||||
|
||||
protected double pushForce;
|
||||
protected EntityRailCarBase trains[];
|
||||
|
||||
/** Assumes that the train is an endpoint, i.e. that only one coupling is in use */
|
||||
@ -742,7 +750,6 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
/** Determines the "front" wagon based on the movement and moves it, then moves all other wagons towards that */
|
||||
public void moveTrainByApproach(double speed) {
|
||||
boolean forward = speed < 0;
|
||||
double origSpeed = speed;
|
||||
speed = Math.abs(speed);
|
||||
EntityRailCarBase previous = null;
|
||||
|
||||
@ -798,6 +805,55 @@ public abstract class EntityRailCarBase extends Entity implements ILookOverlay {
|
||||
current.motionY = current.rotationPitch / 360D;
|
||||
current.velocityChanged = true;
|
||||
}
|
||||
|
||||
public void collideTrain(double speed) {
|
||||
EntityRailCarBase collidingTrain = speed > 0 ? trains[0] : trains[trains.length - 1];
|
||||
List<EntityRailCarBase> intersect = collidingTrain.worldObj.getEntitiesWithinAABB(EntityRailCarBase.class, collidingTrain.boundingBox.expand(1, 1, 1));
|
||||
EntityRailCarBase collidesWith = null;
|
||||
|
||||
for(EntityRailCarBase train : intersect) {
|
||||
if(train.ltu != null && train.ltu != this) {
|
||||
collidesWith = train;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(collidesWith == null) return;
|
||||
|
||||
Vec3 delta = Vec3.createVectorHelper(collidingTrain.posX - collidesWith.posX, 0, collidingTrain.posZ - collidesWith.posZ);
|
||||
double totalSpan = collidingTrain.getCollisionSpan() + collidesWith.getCollisionSpan();
|
||||
double diff = delta.lengthVector();
|
||||
if(diff > totalSpan) return;
|
||||
double push = (totalSpan - diff);
|
||||
|
||||
//PacketDispatcher.wrapper.sendToAllAround(new PlayerInformPacket(ChatBuilder.start("" + collidesWith.ltuIndex + " " + collidingTrain.ltuIndex).color(EnumChatFormatting.RED).flush(), 1),
|
||||
// new TargetPoint(collidingTrain.dimension, collidingTrain.posX, collidingTrain.posY + 1, collidingTrain.posZ, 50));
|
||||
|
||||
EntityRailCarBase[][] whatever = new EntityRailCarBase[][] {{collidingTrain, collidesWith}, {collidesWith, collidingTrain}};
|
||||
for(EntityRailCarBase[] array : whatever) {
|
||||
LogicalTrainUnit ltu = array[0].ltu;
|
||||
if(ltu.trains.length == 1) {
|
||||
Vec3 rot = Vec3.createVectorHelper(0, 0, array[0].getCollisionSpan());
|
||||
rot.rotateAroundX((float) (array[0].rotationPitch * Math.PI / 180D));
|
||||
rot.rotateAroundY((float) (-array[0].rotationYaw * Math.PI / 180));
|
||||
Vec3 forward = Vec3.createVectorHelper(array[1].posX - (array[0].posX + rot.xCoord), 0, array[1].posZ - (array[0].posZ + rot.zCoord));
|
||||
Vec3 backward = Vec3.createVectorHelper(array[1].posX - (array[0].posX - rot.xCoord), 0, array[1].posZ - (array[0].posZ - rot.zCoord));
|
||||
|
||||
if(forward.lengthVector() > backward.lengthVector()) {
|
||||
ltu.pushForce += push;
|
||||
} else {
|
||||
ltu.pushForce -= push;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(array[0].ltuIndex < ltu.trains.length / 2) {
|
||||
ltu.pushForce -= push;
|
||||
} else {
|
||||
ltu.pushForce += push;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.explosion.nt;
|
||||
|
||||
@Deprecated
|
||||
public interface IExplosionLogic {
|
||||
|
||||
public void updateLogic();
|
||||
|
||||
@ -10,6 +10,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Deprecated
|
||||
public class Mark5 implements IExplosionLogic {
|
||||
|
||||
//holds rays after being calculated up to where the blocks get removed
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.config.MobConfig;
|
||||
import com.hbm.config.WorldConfig;
|
||||
import com.hbm.entity.mob.EntityFBI;
|
||||
import com.hbm.entity.mob.EntityFBIDrone;
|
||||
import com.hbm.entity.mob.EntityGhost;
|
||||
import com.hbm.entity.mob.EntityMaskMan;
|
||||
import com.hbm.entity.mob.EntityRADBeast;
|
||||
@ -97,6 +98,15 @@ public class BossSpawnHandler {
|
||||
|
||||
trySpawn(world, (float)spawnX, (float)spawnY, (float)spawnZ, new EntityFBI(world));
|
||||
}
|
||||
|
||||
for(int i = 0; i < MobConfig.raidDrones; i++) {
|
||||
|
||||
double spawnX = player.posX + vec.xCoord + world.rand.nextGaussian() * 5;
|
||||
double spawnZ = player.posZ + vec.zCoord + world.rand.nextGaussian() * 5;
|
||||
double spawnY = world.getHeightValue((int)spawnX, (int)spawnZ);
|
||||
|
||||
trySpawn(world, (float)spawnX, (float)spawnY + 10, (float)spawnZ, new EntityFBIDrone(world));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,16 +484,7 @@ public class EntityEffectHandler {
|
||||
|
||||
int dashCount = armorDashCount + armorModDashCount;
|
||||
|
||||
boolean dashActivated = false;
|
||||
|
||||
|
||||
if(!GeneralConfig.enableCustomDashKeybind) {
|
||||
dashActivated = !player.capabilities.isFlying && player.isSneaking();
|
||||
} else {
|
||||
dashActivated = props.getKeyPressed(EnumKeybind.DASH);
|
||||
}
|
||||
|
||||
//System.out.println(dashCount);
|
||||
boolean dashActivated = props.getKeyPressed(EnumKeybind.DASH);
|
||||
|
||||
if(dashCount * 30 < props.getStamina())
|
||||
props.setStamina(dashCount * 30);
|
||||
|
||||
@ -22,7 +22,7 @@ public class HbmKeybinds {
|
||||
public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category);
|
||||
public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category);
|
||||
public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_F, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
|
||||
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
|
||||
|
||||
public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category);
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.handler.nei;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
@ -45,13 +46,13 @@ public class ConstructionHandler extends NEIUniversalHandler {
|
||||
/* ITER */
|
||||
ItemStack[] iter = new ItemStack[] {
|
||||
new ItemStack(ModBlocks.fusion_conductor, 36),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
new ItemStack(ModBlocks.fusion_conductor, 64),
|
||||
ItemStackUtil.addTooltipToStack(new ItemStack(ModBlocks.fusion_conductor, 320), EnumChatFormatting.RED + "5x64"),
|
||||
new ItemStack(ModItems.plate_cast, 36, Mats.MAT_STEEL.id),
|
||||
ItemStackUtil.addTooltipToStack(new ItemStack(ModItems.plate_cast, 320, Mats.MAT_STEEL.id), EnumChatFormatting.RED + "5x64"),
|
||||
new ItemStack(ModBlocks.fusion_center, 64),
|
||||
new ItemStack(ModBlocks.fusion_motor, 4),
|
||||
new ItemStack(ModBlocks.reinforced_glass, 8)};
|
||||
new ItemStack(ModBlocks.reinforced_glass, 8),
|
||||
new ItemStack(ModItems.blowtorch)};
|
||||
|
||||
bufferedRecipes.put(iter, new ItemStack(ModBlocks.iter));
|
||||
bufferedTools.put(iter, new ItemStack(ModBlocks.struct_iter_core));
|
||||
|
||||
@ -35,8 +35,8 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler {
|
||||
public RecipeSet(CrucibleRecipe recipe) {
|
||||
List<ItemStack> inputs = new ArrayList();
|
||||
List<ItemStack> outputs = new ArrayList();
|
||||
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack));
|
||||
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack));
|
||||
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack, true));
|
||||
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack, true));
|
||||
|
||||
this.template = new PositionedStack(new ItemStack(ModItems.crucible_template, 1, recipe.getId()), 75, 6);
|
||||
this.crucible = new PositionedStack(new ItemStack(ModBlocks.machine_crucible), 75, 42);
|
||||
|
||||
@ -32,6 +32,8 @@ public class PollutionHandler {
|
||||
|
||||
/** Baserate of soot generation for a furnace-equivalent machine per second */
|
||||
public static final float SOOT_PER_SECOND = 1F / 25F;
|
||||
/** Baserate of heavy metal generation, balanced around the soot values of combustion engines */
|
||||
public static final float HEAVY_METAL_PER_SECOND = 1F / 50F;
|
||||
|
||||
///////////////////////
|
||||
/// UTILITY METHODS ///
|
||||
@ -120,13 +122,15 @@ public class PollutionHandler {
|
||||
if(!event.world.isRemote) {
|
||||
WorldServer world = (WorldServer) event.world;
|
||||
String dirPath = getDataDir(world);
|
||||
File pollutionFile = new File(dirPath, fileName);
|
||||
|
||||
try {
|
||||
File pollutionFile = new File(dirPath, fileName);
|
||||
if(!pollutionFile.getParentFile().exists()) pollutionFile.getParentFile().mkdirs();
|
||||
if(!pollutionFile.exists()) pollutionFile.createNewFile();
|
||||
NBTTagCompound data = perWorld.get(world).writeToNBT();
|
||||
CompressedStreamTools.writeCompressed(data, new FileOutputStream(pollutionFile));
|
||||
} catch(Exception ex) {
|
||||
System.out.println("Failed to write " + pollutionFile.getAbsolutePath());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -173,9 +177,9 @@ public class PollutionHandler {
|
||||
} else {
|
||||
data.pollution[S] *= 0.99F;
|
||||
}
|
||||
|
||||
|
||||
data.pollution[H] *= 0.999F;
|
||||
|
||||
|
||||
/* SPREADING */
|
||||
//apply new data to self
|
||||
PollutionData newData = newPollution.get(chunk.getKey());
|
||||
|
||||
@ -3,9 +3,10 @@ package com.hbm.inventory;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
|
||||
public class FluidStack {
|
||||
|
||||
public int fill;
|
||||
|
||||
public FluidType type;
|
||||
public int fill;
|
||||
public int pressure;
|
||||
|
||||
public FluidStack(int fill, FluidType type) {
|
||||
this.fill = fill;
|
||||
@ -13,7 +14,12 @@ public class FluidStack {
|
||||
}
|
||||
|
||||
public FluidStack(FluidType type, int fill) {
|
||||
this(type, fill, 0);
|
||||
}
|
||||
|
||||
public FluidStack(FluidType type, int fill, int pressure) {
|
||||
this.fill = fill;
|
||||
this.type = type;
|
||||
this.pressure = pressure;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ public class OreDictManager {
|
||||
public static final String KEY_TOOL_SCREWDRIVER = "ntmscrewdriver";
|
||||
public static final String KEY_TOOL_HANDDRILL = "ntmhanddrill";
|
||||
public static final String KEY_TOOL_CHEMISTRYSET = "ntmchemistryset";
|
||||
public static final String KEY_TOOL_TORCH = "ntmtorch";
|
||||
|
||||
public static final String KEY_CIRCUIT_BISMUTH = "circuitVersatile";
|
||||
|
||||
@ -482,6 +483,8 @@ public class OreDictManager {
|
||||
OreDictionary.registerOre(KEY_TOOL_HANDDRILL, new ItemStack(hand_drill_desh, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_CHEMISTRYSET, new ItemStack(chemistry_set, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_CHEMISTRYSET, new ItemStack(chemistry_set_boron, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_TORCH, new ItemStack(blowtorch, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre(KEY_TOOL_TORCH, new ItemStack(acetylene_torch, 1, OreDictionary.WILDCARD_VALUE));
|
||||
|
||||
/*
|
||||
* CIRCUITS
|
||||
@ -571,6 +574,8 @@ public class OreDictManager {
|
||||
OreDictionary.registerOre("blockGlassLime", glass_trinitite);
|
||||
OreDictionary.registerOre("blockGlassRed", glass_polonium);
|
||||
OreDictionary.registerOre("blockGlassBlack", glass_ash);
|
||||
|
||||
OreDictionary.registerOre("container1000lubricant", bdcl);
|
||||
|
||||
MaterialShapes.registerCompatShapes();
|
||||
}
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
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 ContainerCompressor extends Container {
|
||||
|
||||
private TileEntityMachineCompressor compressor;
|
||||
|
||||
public ContainerCompressor(InventoryPlayer playerInv, TileEntityMachineCompressor tile) {
|
||||
compressor = tile;
|
||||
|
||||
//Fluid ID
|
||||
this.addSlotToContainer(new Slot(tile, 0, 17, 72));
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tile, 1, 152, 72));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 122 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 180));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return compressor.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(index < 2) {
|
||||
if(!this.mergeItemStack(var5, 2, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(var3.getItem() instanceof IBatteryItem) {
|
||||
if(!this.mergeItemStack(var5, 1, 2, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if(var3.getItem() instanceof IItemFluidIdentifier) {
|
||||
if(!this.mergeItemStack(var5, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ public class FluidType {
|
||||
public double compression = DEFAULT_COMPRESSION;
|
||||
|
||||
public HashMap<Class, Object> containers = new HashMap();
|
||||
private HashMap<Class<? extends FluidTrait>, FluidTrait> traits = new HashMap();
|
||||
public HashMap<Class<? extends FluidTrait>, FluidTrait> traits = new HashMap();
|
||||
//public List<EnumFluidTrait> enumTraits = new ArrayList();
|
||||
|
||||
private ResourceLocation texture;
|
||||
|
||||
@ -1,12 +1,22 @@
|
||||
package com.hbm.inventory.fluid;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.fluid.trait.*;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.*;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.inventory.fluid.trait.FT_Combustible.FuelGrade;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType;
|
||||
@ -20,6 +30,8 @@ import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class Fluids {
|
||||
|
||||
public static final Gson gson = new Gson();
|
||||
|
||||
public static FluidType NONE;
|
||||
public static FluidType WATER;
|
||||
public static FluidType STEAM;
|
||||
@ -155,6 +167,7 @@ public class Fluids {
|
||||
public static final FT_NoContainer NOCON = new FT_NoContainer();
|
||||
public static final FT_NoID NOID = new FT_NoID();
|
||||
public static final FT_Delicious DELICIOUS = new FT_Delicious();
|
||||
public static final FT_Leaded LEADED = new FT_Leaded();
|
||||
|
||||
public static void init() {
|
||||
|
||||
@ -243,9 +256,9 @@ public class Fluids {
|
||||
SALIENT = new FluidType("SALIENT", 0x457F2D, 0, 0, 0, EnumSymbol.NONE).addTraits(DELICIOUS, LIQUID, VISCOUS);
|
||||
XPJUICE = new FluidType("XPJUICE", 0xBBFF09, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS);
|
||||
ENDERJUICE = new FluidType("ENDERJUICE", 0x127766, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS);
|
||||
PETROIL_LEADED = new FluidType("PETROIL_LEADED", 0x44413d, 1, 3, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x2331F6)).addTraits(new FT_Flammable(125_000), new FT_Combustible(FuelGrade.MEDIUM, 450_000), LIQUID);
|
||||
GASOLINE_LEADED = new FluidType("GASOLINE_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x2F775A)).addTraits(new FT_Flammable(400_000), new FT_Combustible(FuelGrade.HIGH, 1_500_000), LIQUID);
|
||||
COALGAS_LEADED = new FluidType("COALGAS_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x1E155F)).addTraits(new FT_Flammable(75_000), new FT_Combustible(FuelGrade.MEDIUM, 250_000), LIQUID);
|
||||
PETROIL_LEADED = new FluidType("PETROIL_LEADED", 0x44413d, 1, 3, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x2331F6)).addTraits(new FT_Flammable(125_000), new FT_Combustible(FuelGrade.MEDIUM, 450_000), LIQUID, LEADED);
|
||||
GASOLINE_LEADED = new FluidType("GASOLINE_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x2F775A)).addTraits(new FT_Flammable(400_000), new FT_Combustible(FuelGrade.HIGH, 1_500_000), LIQUID, LEADED);
|
||||
COALGAS_LEADED = new FluidType("COALGAS_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x1E155F)).addTraits(new FT_Flammable(75_000), new FT_Combustible(FuelGrade.MEDIUM, 250_000), LIQUID, LEADED);
|
||||
SULFURIC_ACID = new FluidType("SULFURIC_ACID", 0xB0AA64, 3, 0, 2, EnumSymbol.ACID).addTraits(new FT_Corrosive(50), LIQUID);
|
||||
COOLANT_HOT = new FluidType("COOLANT_HOT", 0x99525E, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID);
|
||||
MUG = new FluidType("MUG", 0x4B2D28, 0, 0, 0, EnumSymbol.NONE).addTraits(DELICIOUS, LIQUID);
|
||||
@ -562,6 +575,73 @@ public class Fluids {
|
||||
|
||||
registerCalculatedFuel(SYNGAS, (coalHeat * (1000 /* bucket */ / 100 /* mB per coal */) * flammabilityLow * demandLow * complexityChemplant) * 1.5, 1.25, FuelGrade.GAS); //same as coal oil, +50% bonus
|
||||
registerCalculatedFuel(OXYHYDROGEN, 5_000, 3, FuelGrade.GAS); // whatever
|
||||
|
||||
File folder = MainRegistry.configHbmDir;
|
||||
|
||||
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmFluids.json");
|
||||
File template = new File(folder.getAbsolutePath() + File.separatorChar + "_hbmFluids.json");
|
||||
|
||||
if(!config.exists()) {
|
||||
writeDefault(template);
|
||||
} else {
|
||||
readConfig(config);
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeDefault(File file) {
|
||||
|
||||
try {
|
||||
JsonWriter writer = new JsonWriter(new FileWriter(file));
|
||||
writer.setIndent(" ");
|
||||
writer.beginObject();
|
||||
|
||||
for(FluidType type : metaOrder) {
|
||||
writer.name(type.getUnlocalizedName()).beginObject();
|
||||
|
||||
for(Entry<Class<? extends FluidTrait>, FluidTrait> entry : type.traits.entrySet()) {
|
||||
writer.name(FluidTrait.traitNameMap.inverse().get(entry.getKey())).beginObject();
|
||||
entry.getValue().serializeJSON(writer);
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
writer.endObject();
|
||||
writer.close();
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void readConfig(File config) {
|
||||
|
||||
try {
|
||||
JsonObject json = gson.fromJson(new FileReader(config), JsonObject.class);
|
||||
|
||||
for(FluidType type : metaOrder) {
|
||||
|
||||
JsonElement element = json.get(type.getUnlocalizedName());
|
||||
if(element != null) {
|
||||
type.traits.clear();
|
||||
JsonObject obj = element.getAsJsonObject();
|
||||
|
||||
for(Entry<String, JsonElement> entry : obj.entrySet()) {
|
||||
Class<? extends FluidTrait> traitClass = FluidTrait.traitNameMap.get(entry.getKey());
|
||||
try {
|
||||
FluidTrait trait = traitClass.newInstance();
|
||||
trait.deserializeJSON(entry.getValue().getAsJsonObject());
|
||||
type.addTraits(trait);
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerCalculatedFuel(FluidType type, double base, double combustMult, FuelGrade grade) {
|
||||
|
||||
@ -238,7 +238,7 @@ public class FluidTank {
|
||||
list.add(fluid + "/" + maxFluid + "mB");
|
||||
|
||||
if(this.pressure != 0) {
|
||||
list.add(EnumChatFormatting.RED + "" + this.pressure + "mB/l");
|
||||
list.add(EnumChatFormatting.RED + "" + this.pressure + " PU");
|
||||
}
|
||||
|
||||
type.addInfo(list);
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -11,6 +14,8 @@ public class FT_Combustible extends FluidTrait {
|
||||
protected FuelGrade fuelGrade;
|
||||
protected long combustionEnergy;
|
||||
|
||||
public FT_Combustible() { }
|
||||
|
||||
public FT_Combustible(FuelGrade grade, long energy) {
|
||||
this.fuelGrade = grade;
|
||||
this.combustionEnergy = energy;
|
||||
@ -53,4 +58,16 @@ public class FT_Combustible extends FluidTrait {
|
||||
return this.grade;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
writer.name("energy").value(combustionEnergy);
|
||||
writer.name("grade").value(fuelGrade.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeJSON(JsonObject obj) {
|
||||
this.combustionEnergy = obj.get("energy").getAsLong();
|
||||
this.fuelGrade = FuelGrade.valueOf(obj.get("grade").getAsString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@ -11,10 +16,12 @@ public class FT_Coolable extends FluidTrait {
|
||||
|
||||
protected HashMap<CoolingType, Double> efficiency = new HashMap();
|
||||
|
||||
public final FluidType coolsTo;
|
||||
public FluidType coolsTo;
|
||||
public int amountReq;
|
||||
public int amountProduced;
|
||||
public final int heatEnergy;
|
||||
public int heatEnergy;
|
||||
|
||||
public FT_Coolable() { }
|
||||
|
||||
public FT_Coolable(FluidType type, int req, int prod, int heat) {
|
||||
this.coolsTo = type;
|
||||
@ -56,4 +63,28 @@ public class FT_Coolable extends FluidTrait {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
writer.name("coolsTo").value(this.coolsTo.getUnlocalizedName());
|
||||
writer.name("amountReq").value(this.amountReq);
|
||||
writer.name("amountProd").value(this.amountProduced);
|
||||
writer.name("heatEnergy").value(this.heatEnergy);
|
||||
|
||||
for(Entry<CoolingType, Double> entry : this.efficiency.entrySet()) {
|
||||
writer.name(entry.getKey().name()).value(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeJSON(JsonObject obj) {
|
||||
this.coolsTo = Fluids.fromName(obj.get("coolsTo").getAsString());
|
||||
this.amountReq = obj.get("amountReq").getAsInt();
|
||||
this.amountProduced = obj.get("amountProd").getAsInt();
|
||||
this.heatEnergy = obj.get("heatEnergy").getAsInt();
|
||||
|
||||
for(CoolingType type : CoolingType.values()) {
|
||||
if(obj.has(type.name())) efficiency.put(type, obj.get(type.name()).getAsDouble());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class FT_Corrosive extends FluidTrait {
|
||||
@ -9,6 +13,8 @@ public class FT_Corrosive extends FluidTrait {
|
||||
/* 0-100 */
|
||||
private int rating;
|
||||
|
||||
public FT_Corrosive() { }
|
||||
|
||||
public FT_Corrosive(int rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
@ -29,4 +35,14 @@ public class FT_Corrosive extends FluidTrait {
|
||||
else
|
||||
info.add(EnumChatFormatting.YELLOW + "[Corrosive]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
writer.name("rating").value(rating);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeJSON(JsonObject obj) {
|
||||
this.rating = obj.get("rating").getAsInt();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -11,6 +14,8 @@ public class FT_Flammable extends FluidTrait {
|
||||
/** How much heat energy (usually translates into HE 1:1) 1000mB hold */
|
||||
private long energy;
|
||||
|
||||
public FT_Flammable() { }
|
||||
|
||||
public FT_Flammable(long energy) {
|
||||
this.energy = energy;
|
||||
}
|
||||
@ -28,4 +33,14 @@ public class FT_Flammable extends FluidTrait {
|
||||
if(energy > 0)
|
||||
info.add(EnumChatFormatting.YELLOW + "Provides " + EnumChatFormatting.RED + "" + BobMathUtil.getShortNumber(energy) + "TU " + EnumChatFormatting.YELLOW + "per bucket");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
writer.name("energy").value(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeJSON(JsonObject obj) {
|
||||
this.energy = obj.get("energy").getAsLong();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class FT_Heatable extends FluidTrait {
|
||||
|
||||
@ -71,4 +77,45 @@ public class FT_Heatable extends FluidTrait {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
|
||||
writer.name("steps").beginArray();
|
||||
|
||||
for(HeatingStep step : steps) {
|
||||
writer.beginObject();
|
||||
writer.name("typeProduced").value(step.typeProduced.getUnlocalizedName());
|
||||
writer.name("amountReq").value(step.amountReq);
|
||||
writer.name("amountProd").value(step.amountProduced);
|
||||
writer.name("heatReq").value(step.heatReq);
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
writer.endArray();
|
||||
|
||||
for(Entry<HeatingType, Double> entry : this.efficiency.entrySet()) {
|
||||
writer.name(entry.getKey().name()).value(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeJSON(JsonObject obj) {
|
||||
|
||||
JsonArray steps = obj.get("steps").getAsJsonArray();
|
||||
|
||||
for(int i = 0; i < steps.size(); i++) {
|
||||
JsonObject step = steps.get(i).getAsJsonObject();
|
||||
this.steps.add(new HeatingStep(
|
||||
step.get("amountReq").getAsInt(),
|
||||
step.get("heatReq").getAsInt(),
|
||||
Fluids.fromName(step.get("typeProduced").getAsString()),
|
||||
step.get("amountProd").getAsInt()
|
||||
));
|
||||
}
|
||||
|
||||
for(HeatingType type : HeatingType.values()) {
|
||||
if(obj.has(type.name())) efficiency.put(type, obj.get(type.name()).getAsDouble());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
@Deprecated //use FT_Toxin instead
|
||||
@ -10,6 +14,8 @@ public class FT_Poison extends FluidTrait {
|
||||
protected boolean withering = false;
|
||||
protected int level = 0;
|
||||
|
||||
public FT_Poison() { }
|
||||
|
||||
public FT_Poison(boolean withering, int level) {
|
||||
this.withering = withering;
|
||||
this.level = level;
|
||||
@ -27,4 +33,14 @@ public class FT_Poison extends FluidTrait {
|
||||
public void addInfoHidden(List<String> info) {
|
||||
info.add(EnumChatFormatting.GREEN + "[Toxic Fumes]");
|
||||
}
|
||||
|
||||
@Override public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
writer.name("level").value(this.level);
|
||||
writer.name("withering").value(this.withering);
|
||||
}
|
||||
|
||||
@Override public void deserializeJSON(JsonObject obj) {
|
||||
this.level = obj.get("level").getAsInt();
|
||||
this.withering = obj.get("withering").getAsBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.util.ArmorRegistry;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
@ -132,4 +136,76 @@ public class FT_Toxin extends FluidTrait {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
|
||||
writer.name("entries").beginArray();
|
||||
|
||||
for(ToxinEntry entry : entries) {
|
||||
writer.beginObject();
|
||||
|
||||
if(entry instanceof ToxinDirectDamage) {
|
||||
ToxinDirectDamage e = (ToxinDirectDamage) entry;
|
||||
writer.name("type").value("directdamage");
|
||||
writer.name("amount").value(e.amount);
|
||||
writer.name("source").value(e.damage.damageType);
|
||||
writer.name("delay").value(e.delay);
|
||||
writer.name("hazmat").value(e.fullBody);
|
||||
writer.name("masktype").value(e.clazz.name());
|
||||
}
|
||||
if(entry instanceof ToxinEffects) {
|
||||
ToxinEffects e = (ToxinEffects) entry;
|
||||
writer.name("type").value("effects");
|
||||
writer.name("effects").beginArray();
|
||||
writer.setIndent("");
|
||||
for(PotionEffect effect : e.effects) {
|
||||
writer.beginArray();
|
||||
writer.value(effect.getPotionID()).value(effect.getDuration()).value(effect.getAmplifier()).value(effect.getIsAmbient());
|
||||
writer.endArray();
|
||||
}
|
||||
writer.endArray();
|
||||
writer.setIndent(" ");
|
||||
writer.name("hazmat").value(e.fullBody);
|
||||
writer.name("masktype").value(e.clazz.name());
|
||||
}
|
||||
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
writer.endArray();
|
||||
}
|
||||
|
||||
@Override public void deserializeJSON(JsonObject obj) {
|
||||
JsonArray array = obj.get("entries").getAsJsonArray();
|
||||
|
||||
for(int i = 0; i < array.size(); i++) {
|
||||
JsonObject entry = array.get(i).getAsJsonObject();
|
||||
String name = entry.get("type").getAsString();
|
||||
|
||||
if(name.equals("directdamage")) {
|
||||
ToxinDirectDamage e = new ToxinDirectDamage(
|
||||
new DamageSource(entry.get("source").getAsString()),
|
||||
entry.get("amount").getAsFloat(),
|
||||
entry.get("delay").getAsInt(),
|
||||
HazardClass.valueOf(entry.get("masktype").getAsString()),
|
||||
entry.get("hazmat").getAsBoolean()
|
||||
);
|
||||
this.entries.add(e);
|
||||
}
|
||||
|
||||
if(name.equals("effects")) {
|
||||
ToxinEffects e = new ToxinEffects(
|
||||
HazardClass.valueOf(entry.get("masktype").getAsString()),
|
||||
entry.get("hazmat").getAsBoolean()
|
||||
);
|
||||
JsonArray effects = entry.get("effects").getAsJsonArray();
|
||||
for(int j = 0; j < effects.size(); j++) {
|
||||
JsonArray effect = effects.get(j).getAsJsonArray();
|
||||
PotionEffect potion = new PotionEffect(effect.get(0).getAsInt(), effect.get(1).getAsInt(), effect.get(2).getAsInt(), effect.get(3).getAsBoolean());
|
||||
e.effects.add(potion);
|
||||
}
|
||||
this.entries.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
|
||||
@ -12,6 +15,8 @@ public class FT_VentRadiation extends FluidTrait {
|
||||
|
||||
float radPerMB = 0;
|
||||
|
||||
public FT_VentRadiation() { }
|
||||
|
||||
public FT_VentRadiation(float rad) {
|
||||
this.radPerMB = rad;
|
||||
}
|
||||
@ -29,4 +34,14 @@ public class FT_VentRadiation extends FluidTrait {
|
||||
public void addInfo(List<String> info) {
|
||||
info.add(EnumChatFormatting.YELLOW + "[Radioactive]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeJSON(JsonWriter writer) throws IOException {
|
||||
writer.name("radiation").value(radPerMB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeJSON(JsonObject obj) {
|
||||
this.radPerMB = obj.get("radiation").getAsFloat();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,42 @@
|
||||
package com.hbm.inventory.fluid.trait;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.*;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class FluidTrait {
|
||||
|
||||
public static HashBiMap<String, Class<? extends FluidTrait>> traitNameMap = HashBiMap.create();
|
||||
|
||||
static {
|
||||
traitNameMap.put("combustible", FT_Combustible.class); // x
|
||||
traitNameMap.put("coolable", FT_Coolable.class); // x
|
||||
traitNameMap.put("corrosive", FT_Corrosive.class); // x
|
||||
traitNameMap.put("flammable", FT_Flammable.class); // x
|
||||
traitNameMap.put("heatable", FT_Heatable.class); // x
|
||||
traitNameMap.put("poison", FT_Poison.class); // x
|
||||
traitNameMap.put("toxin", FT_Toxin.class); // x
|
||||
traitNameMap.put("ventradiation", FT_VentRadiation.class); // x
|
||||
|
||||
traitNameMap.put("gaseous", FT_Gaseous.class);
|
||||
traitNameMap.put("gaseous_art", FT_Gaseous_ART.class);
|
||||
traitNameMap.put("liquid", FT_Liquid.class);
|
||||
traitNameMap.put("viscous", FT_Viscous.class);
|
||||
traitNameMap.put("plasma", FT_Plasma.class);
|
||||
traitNameMap.put("amat", FT_Amat.class);
|
||||
traitNameMap.put("leadcontainer", FT_LeadContainer.class);
|
||||
traitNameMap.put("delicious", FT_Delicious.class);
|
||||
traitNameMap.put("leaded", FT_Leaded.class);
|
||||
traitNameMap.put("noid", FT_NoID.class);
|
||||
traitNameMap.put("nocontainer", FT_NoContainer.class);
|
||||
}
|
||||
|
||||
/** Important information that should always be displayed */
|
||||
public void addInfo(List<String> info) { }
|
||||
@ -14,4 +44,7 @@ public abstract class FluidTrait {
|
||||
public void addInfoHidden(List<String> info) { }
|
||||
|
||||
public void onFluidRelease(World world, int x, int y, int z, FluidTank tank, int overflowAmount) { }
|
||||
|
||||
public void serializeJSON(JsonWriter writer) throws IOException { }
|
||||
public void deserializeJSON(JsonObject obj) { }
|
||||
}
|
||||
|
||||
@ -49,10 +49,18 @@ public class FluidTraitSimple {
|
||||
info.add(EnumChatFormatting.DARK_RED + "[Requires hazardous material tank to hold]");
|
||||
}
|
||||
}
|
||||
|
||||
public static class FT_Delicious extends FluidTrait {
|
||||
@Override public void addInfoHidden(List<String> info) {
|
||||
info.add(EnumChatFormatting.DARK_GREEN + "[Delicious]");
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
public static class FT_Leaded extends FluidTrait {
|
||||
@Override public void addInfoHidden(List<String> info) {
|
||||
info.add(EnumChatFormatting.BLUE + "[Leaded Fuel]");
|
||||
}
|
||||
}
|
||||
|
||||
public static class FT_NoID extends FluidTrait { }
|
||||
public static class FT_NoContainer extends FluidTrait { }
|
||||
|
||||
@ -7,132 +7,177 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.items.special.ItemBookLore.*;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
// and you may ask yourself: vaer, why do this? this is basically just a copy of GUIScreenGuide.
|
||||
// and I would answer, shut the fuck up nerd, the guide book system is too involved for my small
|
||||
// brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks
|
||||
public class GUIBookLore extends GuiScreen {
|
||||
protected int xSize;
|
||||
protected int ySize;
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book_lore.png");
|
||||
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
protected static int sizeX = 272;
|
||||
protected static int sizeY = 182;
|
||||
|
||||
private NBTTagCompound tag; //Used for save-dependent information, like the MKU recipe
|
||||
private BookLoreType type;
|
||||
protected String key;
|
||||
protected NBTTagCompound tag;
|
||||
|
||||
public int itemTexture;
|
||||
//judgement
|
||||
protected int color;
|
||||
|
||||
protected GUIPage mainPage;
|
||||
protected GUIPage auxPage;
|
||||
protected GUIPageButton button;
|
||||
|
||||
int page = 0;
|
||||
int maxPage;
|
||||
protected int page;
|
||||
protected int maxPage;
|
||||
|
||||
public GUIBookLore(EntityPlayer player) {
|
||||
ItemStack stack = player.getHeldItem();
|
||||
if(!stack.hasTagCompound()) return;
|
||||
this.tag = stack.getTagCompound();
|
||||
this.key = tag.getString("k");
|
||||
if(key.isEmpty()) return;
|
||||
|
||||
type = BookLoreType.getTypeFromStack(player.getHeldItem());
|
||||
tag = player.getHeldItem().getTagCompound(); //compound is created or gotten in method above
|
||||
GUIAppearance setup = type.appearance;
|
||||
|
||||
mainPage = setup.mainPage;
|
||||
auxPage = setup.auxPage;
|
||||
button = setup.button;
|
||||
itemTexture = setup.itemTexture;
|
||||
|
||||
if(type.pages <= 1) {
|
||||
xSize = auxPage.sizeX;
|
||||
ySize = auxPage.sizeY;
|
||||
} else {
|
||||
xSize = mainPage.sizeX;
|
||||
ySize = mainPage.sizeY;
|
||||
}
|
||||
|
||||
maxPage = mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages - 1;
|
||||
this.color = tag.getInteger("cov_col");
|
||||
if(color <= 0)
|
||||
color = 0x303030;
|
||||
this.maxPage = (int)Math.ceil(tag.getInteger("p") / 2D) - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
if(key == null || key.isEmpty()) this.mc.thePlayer.closeScreen();
|
||||
this.guiLeft = (this.width - this.sizeX) / 2;
|
||||
this.guiTop = (this.height - this.sizeY) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
this.drawGuiContainerBackgroundLayer(f, i, j);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
this.drawGuiContainerForegroundLayer(i, j);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
|
||||
if(page == maxPage && (page + 1) * 2 > type.pages) { //odd numbered pages
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(auxPage.texture);
|
||||
func_146110_a(guiLeft, guiTop, auxPage.u, auxPage.v, auxPage.sizeX, auxPage.sizeY, 512, 512);
|
||||
} else {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(mainPage.texture);
|
||||
func_146110_a(guiLeft, guiTop, mainPage.u, mainPage.v, mainPage.sizeX, mainPage.sizeY, 512, 512);
|
||||
float r = (float)(color >> 16 & 255) / 255F;
|
||||
float g = (float)(color >> 8 & 255) / 255F;
|
||||
float b = (float)(color & 255) / 255F;
|
||||
GL11.glColor4f(r, g, b, 1.0F);
|
||||
func_146110_a(guiLeft, guiTop, 0, 0, sizeX, sizeY, 512, 512);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
func_146110_a(guiLeft + 7, guiTop + 7, 0, 182, 258, 165, 512, 512);
|
||||
|
||||
final boolean overY = j >= guiTop + 155 && j < guiTop + 165;
|
||||
if(page > 0) {
|
||||
if(overY && i >= guiLeft + 24 && i <= guiLeft + 42)
|
||||
func_146110_a(guiLeft + 24, guiTop + 155, 295, 13, 18, 10, 512, 512);
|
||||
else
|
||||
func_146110_a(guiLeft + 24, guiTop + 155, 272, 13, 18, 10, 512, 512);
|
||||
}
|
||||
|
||||
int width = page == maxPage && (page + 1) * 2 > type.pages ? auxPage.sizeX : mainPage.sizeX;
|
||||
|
||||
if(page > 0)
|
||||
button.renderButton(this, width, guiLeft, guiTop, false, i, j);
|
||||
|
||||
if(page < maxPage)
|
||||
button.renderButton(this, width, guiLeft, guiTop, true, i, j);
|
||||
if(page < maxPage) {
|
||||
if(overY && i >= guiLeft + 230 && i <= guiLeft + 248)
|
||||
func_146110_a(guiLeft + 230, guiTop + 155, 295, 0, 18, 10, 512, 512);
|
||||
else
|
||||
func_146110_a(guiLeft + 230, guiTop + 155, 272, 0, 18, 10, 512, 512);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
String key = "book_lore." + type.keyI18n + ".page.";
|
||||
String k = "book_lore." + key + ".page.";
|
||||
|
||||
if(mainPage.isTwoPages) {
|
||||
int defacto = page * 2 + 1;
|
||||
String text = type.resolveKey(key + defacto, tag);
|
||||
for(int i = 0; i < 2; i++) {
|
||||
int defacto = this.page * 2 + i;
|
||||
|
||||
if((page + 1) * 2 <= type.pages) { //Checks if text should be rendered as an aux or a main page
|
||||
mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
if(defacto < tag.getInteger("p")) {
|
||||
String text;
|
||||
NBTTagCompound argTag = tag.getCompoundTag("p" + defacto);
|
||||
|
||||
text = type.resolveKey(key + (defacto + 1), tag); //kinda awkward, but no way around it
|
||||
mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, true);
|
||||
} else
|
||||
auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
|
||||
} else {
|
||||
String text = type.resolveKey(key + (page + 1), tag);
|
||||
|
||||
if(page < maxPage)
|
||||
mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
else
|
||||
auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false);
|
||||
if(argTag.hasNoTags())
|
||||
text = I18nUtil.resolveKey(k + defacto);
|
||||
else {
|
||||
List<String> args = new ArrayList();
|
||||
int index = 1;
|
||||
String arg = argTag.getString("a1");
|
||||
|
||||
while(!arg.isEmpty()) {
|
||||
args.add(arg);
|
||||
index++;
|
||||
arg = argTag.getString("a" + index);
|
||||
}
|
||||
|
||||
text = I18nUtil.resolveKey(k + defacto, args.toArray());
|
||||
}
|
||||
|
||||
float scale = 1;
|
||||
int width = 100;
|
||||
int widthScaled = (int) (width * scale);
|
||||
|
||||
List<String> lines = new ArrayList();
|
||||
String[] words = text.split(" ");
|
||||
|
||||
lines.add(words[0]);
|
||||
int indent = this.fontRendererObj.getStringWidth(words[0]);
|
||||
|
||||
for(int w = 1; w < words.length; w++) {
|
||||
if(words[w].equals("$")) {
|
||||
if(w + 1 < words.length && !words[w + 1].equals("$")) {
|
||||
lines.add(words[++w]);
|
||||
indent = this.fontRendererObj.getStringWidth(words[w]);
|
||||
} else
|
||||
lines.add("");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
indent += this.fontRendererObj.getStringWidth(" " + words[w]);
|
||||
|
||||
if(indent <= widthScaled) {
|
||||
String last = lines.get(lines.size() - 1);
|
||||
lines.set(lines.size() - 1, last += (" " + words[w]));
|
||||
} else {
|
||||
lines.add(words[w]);
|
||||
indent = this.fontRendererObj.getStringWidth(words[w]);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(1F/scale, 1F/scale, 1F);
|
||||
|
||||
for(int l = 0; l < lines.size(); l++) {
|
||||
this.fontRendererObj.drawString(lines.get(l),
|
||||
(int)((guiLeft + 20 + i * 130) * scale),
|
||||
(int)((guiTop + 20) * scale + (9 * l)),
|
||||
0x0F0F0F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int i, int j, int k) {
|
||||
int q = 0; //if both buttons are somehow simultaneously clicked then obviously something's wrong already
|
||||
if(j < guiTop + 155 || j >= guiTop + 165) return;
|
||||
|
||||
if(page > 0)
|
||||
q = button.handleInput(xSize, guiLeft, guiTop, false, i, j);
|
||||
|
||||
if(page < maxPage && q == 0)
|
||||
q = button.handleInput(xSize, guiLeft, guiTop, true, i, j);
|
||||
|
||||
if(q != 0) {
|
||||
if(page > 0 && i >= guiLeft + 24 && i <= guiLeft + 42) {
|
||||
page--;
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
|
||||
if(page < maxPage && i >= guiLeft + 230 && i <= guiLeft + 248) {
|
||||
page++;
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
this.page += q;
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,208 +187,4 @@ public class GUIBookLore extends GuiScreen {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
// turn page buttons, one-page, both page textures, sizes, positions, etc.
|
||||
public enum GUIAppearance {
|
||||
GUIDEBOOK(new GUIPage(272, 182, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F).setMargins(20, 20, 20),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
0), //Guide Book
|
||||
LOOSEPAPER(new GUIPage(130, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(12, 10, 16).setUV(133, 0),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
1), //Singular loose page
|
||||
LOOSEPAPERS(new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(12, 10, 16),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
2), //Collection of loose pages
|
||||
NOTEBOOK(new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(10, 10, 16).setUV(0, 165),
|
||||
new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(10, 10, 16).setUV(133, 165),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
3);
|
||||
|
||||
public int itemTexture;
|
||||
|
||||
protected GUIPage mainPage; //"Main" page, usually two pages. GUI accounts for one-paged main pages.
|
||||
protected GUIPage auxPage; //"Aux" page, AKA the final page if the max pages is oddly numbered.
|
||||
//If two-sided, text will be positioned on the left page.
|
||||
protected GUIPageButton button;
|
||||
|
||||
private GUIAppearance(GUIPage main, GUIPage aux, GUIPageButton button, int texture) {
|
||||
this.mainPage = main;
|
||||
this.auxPage = aux;
|
||||
this.button = button;
|
||||
this.itemTexture = texture;
|
||||
}
|
||||
|
||||
private GUIAppearance(GUIPage main, GUIPageButton button, int texture) {
|
||||
this.mainPage = main;
|
||||
this.auxPage = main;
|
||||
this.button = button;
|
||||
this.itemTexture = texture;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class GUIPage {
|
||||
protected ResourceLocation texture;
|
||||
|
||||
//UV positioning
|
||||
protected int u = 0; //X/U pos in texture
|
||||
protected int v = 0; //Y/V pos in texture
|
||||
|
||||
protected int sizeX; //X size of the page
|
||||
protected int sizeY; //Y size of the page
|
||||
|
||||
//Text positioning
|
||||
protected int marginInner = 10; //Margin from inner edge of page
|
||||
protected int marginOuter = 10; //Margin from outer edge of page
|
||||
protected int marginY = 20; //Margin from upper edge of page
|
||||
protected boolean isTwoPages = true; //Has two pages to display text
|
||||
protected float scale = 1.0F; //Scale of the text; larger values are smaller
|
||||
protected int spacing = 9; //12 is a more comfortable spacing
|
||||
|
||||
protected GUIPage(int x, int y, ResourceLocation texture, boolean twoPages) {
|
||||
this.sizeX = x;
|
||||
this.sizeY = y;
|
||||
this.texture = texture;
|
||||
this.isTwoPages = twoPages;
|
||||
}
|
||||
|
||||
protected GUIPage(int x, int y, ResourceLocation texture) {
|
||||
this.sizeX = x;
|
||||
this.sizeY = y;
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
protected GUIPage setUV(int u, int v) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GUIPage setScale(float scale) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GUIPage setMargins(int inner, int outer, int upper) {
|
||||
this.marginInner = inner;
|
||||
this.marginOuter = outer;
|
||||
this.marginY = upper;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GUIPage setSpacing(int spacing) {
|
||||
this.spacing = spacing;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void renderText(String text, FontRenderer renderer, int left, int top, boolean secondPage) {
|
||||
int width = (isTwoPages ? sizeX / 2 : sizeX) - marginInner - marginOuter;
|
||||
int widthScaled = (int) (width * scale);
|
||||
|
||||
List<String> lines = new ArrayList();
|
||||
String[] words = text.split(" ");
|
||||
|
||||
lines.add(words[0]);
|
||||
int indent = renderer.getStringWidth(words[0]);
|
||||
|
||||
for(int w = 1; w < words.length; w++) {
|
||||
|
||||
if(words[w].equals("$")) {
|
||||
if(w + 1 < words.length && !words[w + 1].equals("$")) {
|
||||
lines.add(words[++w]);
|
||||
indent = renderer.getStringWidth(words[w]);
|
||||
} else
|
||||
lines.add("");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
indent += renderer.getStringWidth(" " + words[w]);
|
||||
|
||||
if(indent <= widthScaled) {
|
||||
String last = lines.get(lines.size() - 1);
|
||||
lines.set(lines.size() - 1, last += (" " + words[w]));
|
||||
} else {
|
||||
lines.add(words[w]);
|
||||
indent = renderer.getStringWidth(words[w]);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(1F/scale, 1F/scale, 1F);
|
||||
|
||||
int sideOffset = secondPage ? sizeX / 2 + marginInner : marginOuter;
|
||||
|
||||
for(int l = 0; l < lines.size(); l++) {
|
||||
renderer.drawString(lines.get(l), (int)((left + sideOffset) * scale), (int)((top + marginY) * scale + (spacing * l)), 4210752);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private static class GUIPageButton {
|
||||
protected ResourceLocation texture;
|
||||
|
||||
protected int sizeX; //size of a single button; full texture is 2*sizeX : 2*sizeZ
|
||||
protected int sizeY;
|
||||
protected int x; //x position on page, relative to edge of the page it is on.
|
||||
protected int y; //y position on page, relative to the top edge of the page.
|
||||
|
||||
/* Left, Unsel | Right, Unsel
|
||||
* Left, Sel | Right, Sel
|
||||
*/
|
||||
protected int u = 0; //upper lefthand corner where the button textures lie.
|
||||
protected int v = 0; //assumes uniform size for each.
|
||||
protected int sizeU = sizeX * 2; //Size of UV texture
|
||||
protected int sizeV = sizeY * 2;
|
||||
|
||||
protected GUIPageButton(int sizeX, int sizeY, int x, int y, ResourceLocation tex) {
|
||||
this.sizeX = sizeX;
|
||||
this.sizeY = sizeY;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.texture = tex;
|
||||
}
|
||||
|
||||
protected GUIPageButton setUV(int u, int v, int sizeU, int sizeV) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.sizeU = sizeU;
|
||||
this.sizeV = sizeV;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void renderButton(GuiScreen screen, int width, int left, int top, boolean rightPage, int i, int j) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
boolean overY = j >= top + y && j < top + y + sizeY;
|
||||
|
||||
if(!rightPage) {
|
||||
if(i >= left + x && i < left + x + sizeX && overY) {
|
||||
func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeU, sizeV);
|
||||
} else {
|
||||
func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeU, sizeV);
|
||||
}
|
||||
} else {
|
||||
if(i >= left + width - x - sizeX && i < left + width - x && overY) {
|
||||
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeU, sizeV);
|
||||
} else {
|
||||
func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeU, sizeV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int handleInput(int width, int left, int top, boolean rightPage, int i, int j) {
|
||||
boolean overY = j >= top + y && j < top + y + sizeY;
|
||||
if(!rightPage) {
|
||||
if(i >= left + x && i < left + x + sizeX && overY)
|
||||
return -1;
|
||||
} else {
|
||||
if(i >= left + width - x - sizeX && i < left + width - x && overY)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
50
src/main/java/com/hbm/inventory/gui/GUICompressor.java
Normal file
50
src/main/java/com/hbm/inventory/gui/GUICompressor.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCompressor;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICompressor extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_compressor.png");
|
||||
private TileEntityMachineCompressor solidifier;
|
||||
|
||||
public GUICompressor(InventoryPlayer invPlayer, TileEntityMachineCompressor tedf) {
|
||||
super(new ContainerCompressor(invPlayer, tedf));
|
||||
solidifier = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 204;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
//solidifier.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 36, 16, 52);
|
||||
//this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 18, 16, 52, solidifier.power, solidifier.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
|
||||
String name = this.solidifier.hasCustomInventoryName() ? this.solidifier.getInventoryName() : I18n.format(this.solidifier.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xC7C1A3);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class MatDistribution extends SerializableRecipe {
|
||||
registerOre(OreDictManager.AL.ore(), MAT_ALUMINIUM, INGOT.q(2), MAT_STONE, QUART.q(1));
|
||||
}
|
||||
|
||||
registerOre(OreDictManager.COAL.ore(), MAT_COAL, GEM.q(4), MAT_STONE, QUART.q(1));
|
||||
registerOre(OreDictManager.COAL.ore(), MAT_CARBON, GEM.q(3), MAT_STONE, QUART.q(1));
|
||||
registerOre(OreDictManager.GOLD.ore(), MAT_GOLD, INGOT.q(2), MAT_LEAD, NUGGET.q(3), MAT_STONE, QUART.q(1));
|
||||
registerOre(OreDictManager.U.ore(), MAT_URANIUM, INGOT.q(2), MAT_LEAD, NUGGET.q(3), MAT_STONE, QUART.q(1));
|
||||
registerOre(OreDictManager.TH232.ore(), MAT_THORIUM, INGOT.q(2), MAT_URANIUM, NUGGET.q(3), MAT_STONE, QUART.q(1));
|
||||
|
||||
@ -281,7 +281,7 @@ public class AssemblerRecipes {
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_flare, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 12), new OreDictStack(IRON.ingot(), 12), new OreDictStack(CU.plate528(), 4), new ComparableStack(ModItems.tank_steel, 1), new ComparableStack(ModBlocks.deco_pipe_quad, 8), new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(ModItems.thermo_element, 3), },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_coker, 1), new AStack[] {new OreDictStack(STEEL.plate(), 24), new OreDictStack(IRON.ingot(), 12), new OreDictStack(CU.plate528(), 8), new OreDictStack(RUBBER.ingot(), 4), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModBlocks.steel_grate, 4) },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_refinery, 1), new AStack[] {new OreDictStack(STEEL.plate528(), 16), new OreDictStack(CU.plate(), 16), new ComparableStack(ModItems.hull_big_steel, 6), new ComparableStack(ModItems.pipes_steel, 2), new ComparableStack(ModItems.plate_polymer, 8), new ComparableStack(ModItems.circuit_red_copper, 1) },350);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.plate_polymer, 4), new ComparableStack(ModItems.bolt_tungsten, 4), new ComparableStack(ModItems.coil_copper, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit_copper, 1), new ComparableStack(ModItems.canister_full, 1, Fluids.LUBRICANT.getID()), },160);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.plate_polymer, 4), new ComparableStack(ModItems.bolt_tungsten, 4), new ComparableStack(ModItems.coil_copper, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit_copper, 1), new OreDictStack(Fluids.LUBRICANT.getDict(1000)), },160);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_chemplant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.plate528(), 6), new ComparableStack(ModItems.tank_steel, 4), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.coil_tungsten, 3), new ComparableStack(ModItems.circuit_copper, 2), new ComparableStack(ModItems.circuit_red_copper, 1), new ComparableStack(ModItems.plate_polymer, 8), },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_crystallizer, 1), new AStack[] {new ComparableStack(ModItems.hull_big_steel, 4), new ComparableStack(ModItems.pipes_steel, 1), new OreDictStack(DESH.ingot(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.blades_advanced_alloy, 2), new OreDictStack(STEEL.ingot(), 16), new OreDictStack(TI.plate(), 16), new ComparableStack(Blocks.glass, 4), new ComparableStack(ModItems.circuit_gold, 1), },400);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_fluidtank, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new OreDictStack(STEEL.plate528(), 6), new ComparableStack(ModItems.hull_big_steel, 4), new OreDictStack(ANY_TAR.any(), 4), },150);
|
||||
@ -293,7 +293,7 @@ public class AssemblerRecipes {
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_turbinegas, 1), new AStack[] {new ComparableStack(ModItems.hull_big_steel, 4), new ComparableStack(ModItems.hull_small_steel, 6), new ComparableStack(ModItems.generator_steel, 2), new ComparableStack(ModItems.bolt_compound, 4), new ComparableStack(ModBlocks.steel_scaffold, 8), new ComparableStack(ModBlocks.deco_pipe_quad, 4), new ComparableStack(ModItems.turbine_tungsten, 3), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.ingot_rubber, 4), new ComparableStack(ModItems.circuit_red_copper, 3)}, 600);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_teleporter, 1), new AStack[] {new OreDictStack(TI.ingot(), 8), new OreDictStack(ALLOY.plate528(), 12), new ComparableStack(ModItems.wire_gold, 32), new ComparableStack(ModItems.entanglement_kit, 1), new ComparableStack(ModBlocks.machine_battery, 1) },300);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_schrabidium_transmutator, 1), new AStack[] {new OreDictStack(MAGTUNG.ingot(), 1), new OreDictStack(TI.ingot(), 24), new OreDictStack(ALLOY.plate(), 18), new OreDictStack(STEEL.plate(), 12), new ComparableStack(ModItems.plate_desh, 6), new OreDictStack(RUBBER.ingot(), 8), new ComparableStack(ModBlocks.machine_battery, 5), new ComparableStack(ModItems.circuit_gold, 5), },500);
|
||||
makeRecipe(new ComparableStack(ModBlocks.fusion_conductor, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new ComparableStack(ModItems.coil_advanced_alloy, 5), },150);
|
||||
makeRecipe(new ComparableStack(ModBlocks.fusion_conductor, 1), new AStack[] {new ComparableStack(ModItems.coil_advanced_alloy, 5), }, 100);
|
||||
makeRecipe(new ComparableStack(ModBlocks.fusion_center, 1), new AStack[] {new OreDictStack(ANY_HARDPLASTIC.ingot(), 4), new OreDictStack(STEEL.plate528(), 6), new ComparableStack(ModItems.wire_advanced_alloy, 24), },200);
|
||||
makeRecipe(new ComparableStack(ModBlocks.fusion_motor, 1), new AStack[] {new OreDictStack(TI.ingot(), 4), new OreDictStack(STEEL.ingot(), 2), new ComparableStack(ModItems.motor, 4), },250);
|
||||
makeRecipe(new ComparableStack(ModBlocks.fusion_heater, 1), new AStack[] {new OreDictStack(W.ingot(), 4), new OreDictStack(STEEL.plate528(), 2), new OreDictStack(OreDictManager.getReflector(), 2), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.magnetron, 1), new ComparableStack(ModItems.wire_advanced_alloy, 4), },150);
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.hbm.inventory.recipes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
public class CompressorRecipes extends SerializableRecipe {
|
||||
|
||||
public static HashMap<Pair<FluidType, Integer>, CompressorRecipe> recipes = new HashMap();
|
||||
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
|
||||
}
|
||||
|
||||
public static class CompressorRecipe {
|
||||
|
||||
public FluidStack output;
|
||||
public int inputAmount;
|
||||
|
||||
public CompressorRecipe(int input, FluidStack output) {
|
||||
this.output = output;
|
||||
this.inputAmount = input;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "hbmCompressor.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRecipeObject() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecipes() {
|
||||
recipes.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readRecipe(JsonElement recipe) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
|
||||
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ public class CrucibleRecipes extends SerializableRecipe {
|
||||
|
||||
if(!ores.isEmpty()) {
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
stacks.add(ItemScraps.create(new MaterialStack(convert, (int) (shape.q(1) * out / in))));
|
||||
stacks.add(ItemScraps.create(new MaterialStack(convert, (int) (shape.q(1) * out / in)), true));
|
||||
map.put(new OreDictStack(name), stacks);
|
||||
}
|
||||
}
|
||||
@ -257,7 +257,7 @@ public class CrucibleRecipes extends SerializableRecipe {
|
||||
for(Entry<String, List<MaterialStack>> entry : Mats.materialOreEntries.entrySet()) {
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
for(MaterialStack mat : entry.getValue()) {
|
||||
stacks.add(ItemScraps.create(mat));
|
||||
stacks.add(ItemScraps.create(mat, true));
|
||||
}
|
||||
map.put(new OreDictStack(entry.getKey()), stacks);
|
||||
}
|
||||
@ -265,7 +265,7 @@ public class CrucibleRecipes extends SerializableRecipe {
|
||||
for(Entry<ComparableStack, List<MaterialStack>> entry : Mats.materialEntries.entrySet()) {
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
for(MaterialStack mat : entry.getValue()) {
|
||||
stacks.add(ItemScraps.create(mat));
|
||||
stacks.add(ItemScraps.create(mat, true));
|
||||
}
|
||||
map.put(entry.getKey().copy(), stacks);
|
||||
}
|
||||
@ -293,7 +293,7 @@ public class CrucibleRecipes extends SerializableRecipe {
|
||||
for(Mold mold : ItemMold.molds) {
|
||||
ItemStack out = mold.getOutput(material);
|
||||
if(out != null) {
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(material, mold.getCost()));
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(material, mold.getCost()), true);
|
||||
ItemStack shape = new ItemStack(ModItems.mold, 1, mold.id);
|
||||
ItemStack basin = new ItemStack(mold.size == 0 ? ModBlocks.foundry_mold : mold.size == 1 ? ModBlocks.foundry_basin : Blocks.fire);
|
||||
ItemStack[] entry = new ItemStack[] {scrap, shape, basin, out};
|
||||
|
||||
@ -1007,6 +1007,7 @@ public class ModItems {
|
||||
public static Item cap_sunset;
|
||||
public static Item cap_star;
|
||||
public static Item ring_pull;
|
||||
public static Item bdcl;
|
||||
//public static Item canned_beef;
|
||||
//public static Item canned_tuna;
|
||||
//public static Item canned_mystery;
|
||||
@ -3344,6 +3345,7 @@ public class ModItems {
|
||||
cbt_device = new ItemSyringe().setUnlocalizedName("cbt_device").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":cbt_device");
|
||||
cigarette = new ItemCigarette().setUnlocalizedName("cigarette").setFull3D().setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":cigarette");
|
||||
crackpipe = new ItemCigarette().setUnlocalizedName("crackpipe").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":crackpipe");
|
||||
bdcl = new ItemBDCL().setUnlocalizedName("bdcl").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":bdcl");
|
||||
|
||||
attachment_mask = new ItemModGasmask().setUnlocalizedName("attachment_mask").setTextureName(RefStrings.MODID + ":attachment_mask");
|
||||
attachment_mask_mono = new ItemModGasmask().setUnlocalizedName("attachment_mask_mono").setTextureName(RefStrings.MODID + ":attachment_mask_mono");
|
||||
@ -5361,7 +5363,7 @@ public class ModItems {
|
||||
record_glass = new ItemModRecord("glass").setUnlocalizedName("record_glass").setCreativeTab(null).setTextureName(RefStrings.MODID + ":record_glass");
|
||||
|
||||
book_guide = new ItemGuideBook().setUnlocalizedName("book_guide").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":book_guide");
|
||||
book_lore = new ItemBookLore().setUnlocalizedName("book_lore").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape");
|
||||
book_lore = new ItemBookLore().setUnlocalizedName("book_lore").setCreativeTab(null).setTextureName(RefStrings.MODID + ":book_pages");
|
||||
holotape_image = new ItemHolotapeImage().setUnlocalizedName("holotape_image").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape");
|
||||
holotape_damaged = new Item().setUnlocalizedName("holotape_damaged").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape_damaged");
|
||||
|
||||
@ -7625,6 +7627,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(cbt_device, cbt_device.getUnlocalizedName());
|
||||
GameRegistry.registerItem(cigarette, cigarette.getUnlocalizedName());
|
||||
GameRegistry.registerItem(crackpipe, crackpipe.getUnlocalizedName());
|
||||
GameRegistry.registerItem(bdcl, bdcl.getUnlocalizedName());
|
||||
|
||||
//Armor mods
|
||||
GameRegistry.registerItem(attachment_mask, attachment_mask.getUnlocalizedName());
|
||||
|
||||
34
src/main/java/com/hbm/items/food/ItemBDCL.java
Normal file
34
src/main/java/com/hbm/items/food/ItemBDCL.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.hbm.items.food;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemBDCL extends Item {
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack p_77661_1_) {
|
||||
return EnumAction.drink;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
--stack.stackSize;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@ -9,25 +9,39 @@ import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemAutogen;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ItemScraps extends ItemAutogen {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon liquidIcon;
|
||||
@SideOnly(Side.CLIENT) public IIcon addiviceIcon;
|
||||
|
||||
public ItemScraps() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
super.registerIcons(reg);
|
||||
this.liquidIcon = reg.registerIcon(RefStrings.MODID + ":scraps_liquid");
|
||||
this.addiviceIcon = reg.registerIcon(RefStrings.MODID + ":scraps_additive");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
@ -38,8 +52,48 @@ public class ItemScraps extends ItemAutogen {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int layer) {
|
||||
|
||||
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
|
||||
|
||||
NTMMaterial mat = Mats.matById.get(stack.getItemDamage());
|
||||
|
||||
if(mat != null) {
|
||||
return mat.moltenColor;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getColorFromItemStack(stack, layer);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconIndex(ItemStack stack) {
|
||||
|
||||
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
|
||||
|
||||
NTMMaterial mat = Mats.matById.get(stack.getItemDamage());
|
||||
|
||||
if(mat != null) {
|
||||
if(mat.smeltable == mat.smeltable.SMELTABLE) return this.liquidIcon;
|
||||
if(mat.smeltable == mat.smeltable.ADDITIVE) return this.addiviceIcon;
|
||||
}
|
||||
}
|
||||
|
||||
return this.getIconFromDamage(stack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
|
||||
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
|
||||
MaterialStack contents = getMats(stack);
|
||||
if(contents != null) {
|
||||
return I18nUtil.resolveKey(contents.material.getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
|
||||
return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
|
||||
}
|
||||
|
||||
@ -48,7 +102,13 @@ public class ItemScraps extends ItemAutogen {
|
||||
MaterialStack contents = getMats(stack);
|
||||
|
||||
if(contents != null) {
|
||||
list.add(I18nUtil.resolveKey(contents.material.getUnlocalizedName()) + ", " + Mats.formatAmount(contents.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||
|
||||
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
|
||||
list.add(Mats.formatAmount(contents.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||
if(contents.material.smeltable == contents.material.smeltable.ADDITIVE) list.add(EnumChatFormatting.DARK_RED + "Additive, not castable!");
|
||||
} else {
|
||||
list.add(I18nUtil.resolveKey(contents.material.getUnlocalizedName()) + ", " + Mats.formatAmount(contents.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,11 +129,16 @@ public class ItemScraps extends ItemAutogen {
|
||||
}
|
||||
|
||||
public static ItemStack create(MaterialStack stack) {
|
||||
return create(stack, false);
|
||||
}
|
||||
|
||||
public static ItemStack create(MaterialStack stack, boolean liquid) {
|
||||
if(stack.material == null)
|
||||
return new ItemStack(ModItems.nothing); //why do i bother adding checks for fucking everything when they don't work
|
||||
ItemStack scrap = new ItemStack(ModItems.scraps, 1, stack.material.id);
|
||||
scrap.stackTagCompound = new NBTTagCompound();
|
||||
scrap.stackTagCompound.setInteger("amount", stack.amount);
|
||||
if(liquid) scrap.stackTagCompound.setBoolean("liquid", true);
|
||||
return scrap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package com.hbm.items.special;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import com.hbm.inventory.gui.GUIBookLore;
|
||||
import com.hbm.inventory.gui.GUIBookLore.GUIAppearance;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
@ -42,47 +44,71 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
BookLoreType type = BookLoreType.getTypeFromStack(stack);
|
||||
if(!stack.hasTagCompound()) return;
|
||||
String key = stack.stackTagCompound.getString("k");
|
||||
if(key.isEmpty()) return;
|
||||
|
||||
if(type.hasAuthor) {
|
||||
String unloc = I18nUtil.resolveKey("book_lore.author", I18nUtil.resolveKey("book_lore." + type.keyI18n + ".author"));
|
||||
|
||||
list.add(unloc);
|
||||
}
|
||||
key = "book_lore." + key + ".author";
|
||||
String loc = I18nUtil.resolveKey(key);
|
||||
if(!loc.equals(key))
|
||||
list.add(I18nUtil.resolveKey("book_lore.author", loc));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
BookLoreType type = BookLoreType.getTypeFromStack(stack);
|
||||
if(!stack.hasTagCompound()) return "book_lore.test";
|
||||
String key = stack.stackTagCompound.getString("k");
|
||||
|
||||
return "book_lore." + type.keyI18n;
|
||||
return "book_lore." + (key.isEmpty() ? "test" : key);
|
||||
}
|
||||
|
||||
protected IIcon[] icons;
|
||||
//Textures
|
||||
|
||||
public final static String[] itemTextures = new String[] { ":book_guide", ":paper_loose", ":papers_loose", ":notebook" };
|
||||
@SideOnly(Side.CLIENT) protected IIcon[] overlays;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
String[] iconStrings = itemTextures;
|
||||
this.icons = new IIcon[itemTextures.length];
|
||||
super.registerIcons(reg);
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
this.icons[i] = reg.registerIcon(RefStrings.MODID + itemTextures[i]);
|
||||
this.overlays = new IIcon[2];
|
||||
this.overlays[0] = reg.registerIcon(RefStrings.MODID + ":book_cover");
|
||||
this.overlays[1] = reg.registerIcon(RefStrings.MODID + ":book_title");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() { return true; }
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) { return 3; }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int meta, int pass) {
|
||||
if(pass == 0) return this.itemIcon;
|
||||
return overlays[pass - 1];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
switch(pass) {
|
||||
default: return 0xFFFFFF;
|
||||
case 1: //book cover
|
||||
if(stack.hasTagCompound()) {
|
||||
int color = stack.stackTagCompound.getInteger("cov_col");
|
||||
if(color > 0) return color;
|
||||
}
|
||||
return 0x303030;
|
||||
case 2: //title color
|
||||
if(stack.hasTagCompound()) {
|
||||
int color = stack.stackTagCompound.getInteger("tit_col");
|
||||
if(color > 0) return color;
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack stack) {
|
||||
return this.getIcon(stack, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
BookLoreType type = BookLoreType.getTypeFromStack(stack);
|
||||
|
||||
return this.icons[type.appearance.itemTexture];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
@ -95,88 +121,25 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
||||
return new GUIBookLore(player);
|
||||
}
|
||||
|
||||
public enum BookLoreType {
|
||||
TEST(true, "test", 5, GUIAppearance.NOTEBOOK),
|
||||
BOOK_IODINE(true, "book_iodine", 3, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_PHOSPHOROUS(true, "book_phosphorous", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_DUST(true, "book_dust", 3, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_MERCURY(true, "book_mercury", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_FLOWER(true, "book_flower", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
BOOK_SYRINGE(true, "book_syringe", 2, GUIAppearance.LOOSEPAPERS) {
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag.getInteger("mku_slot"));
|
||||
}},
|
||||
RESIGNATION_NOTE(true, "resignation_note", 3, GUIAppearance.NOTEBOOK),
|
||||
MEMO_STOCKS(false, "memo_stocks", 1, GUIAppearance.LOOSEPAPER),
|
||||
MEMO_SCHRAB_GSA(false, "memo_schrab_gsa", 2, GUIAppearance.LOOSEPAPERS),
|
||||
MEMO_SCHRAB_RD(false, "memo_schrab_rd", 4, GUIAppearance.LOOSEPAPERS),
|
||||
MEMO_SCHRAB_NUKE(true, "memo_schrab_nuke", 3, GUIAppearance.LOOSEPAPERS),
|
||||
;
|
||||
public static ItemStack createBook(String key, int pages, int colorCov, int colorTit) {
|
||||
ItemStack book = new ItemStack(ModItems.book_lore);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("k", key);
|
||||
tag.setShort("p", (short)pages);
|
||||
tag.setInteger("cov_col", colorCov);
|
||||
tag.setInteger("tit_col", colorTit);
|
||||
|
||||
//Why? it's quite simple; i am too burnt out and also doing it the other way
|
||||
//is too inflexible for my taste
|
||||
public final GUIAppearance appearance; //gui and item texture appearance
|
||||
|
||||
public boolean hasAuthor = false;
|
||||
public final String keyI18n;
|
||||
public final int pages;
|
||||
|
||||
private BookLoreType(Boolean author, String key, int max, GUIAppearance appearance) {
|
||||
this.hasAuthor = author;
|
||||
this.keyI18n = key;
|
||||
this.pages = max;
|
||||
this.appearance = appearance;
|
||||
book.stackTagCompound = tag;
|
||||
return book;
|
||||
}
|
||||
|
||||
public static void addArgs(ItemStack book, int page, String... args) {
|
||||
if(!book.hasTagCompound()) return;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
for(int i = 0; i < args.length; i++) {
|
||||
data.setString("a" + (i + 1), args[i]);
|
||||
}
|
||||
|
||||
private BookLoreType(String key, int max, GUIAppearance appearance) {
|
||||
this.keyI18n = key;
|
||||
this.pages = max;
|
||||
this.appearance = appearance;
|
||||
}
|
||||
|
||||
/** Function to resolve I18n keys using potential save-dependent information, a la format specifiers. */
|
||||
public String resolveKey(String key, NBTTagCompound tag) {
|
||||
return I18nUtil.resolveKey(key, tag);
|
||||
}
|
||||
|
||||
public static BookLoreType getTypeFromStack(ItemStack stack) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
int ordinal = tag.getInteger("Book_Lore_Type");
|
||||
|
||||
return BookLoreType.values()[Math.abs(ordinal) % BookLoreType.values().length];
|
||||
}
|
||||
|
||||
public static ItemStack setTypeForStack(ItemStack stack, BookLoreType num) {
|
||||
|
||||
if(stack.getItem() instanceof ItemBookLore) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
tag.setInteger("Book_Lore_Type", num.ordinal());
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
book.stackTagCompound.setTag("p" + page, data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,10 +23,20 @@ public class ItemPollutionDetector extends Item {
|
||||
|
||||
PollutionData data = PollutionHandler.getPollutionData(world, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ));
|
||||
if(data == null) data = new PollutionData();
|
||||
|
||||
float soot = data.pollution[PollutionType.SOOT.ordinal()];
|
||||
float poison = data.pollution[PollutionType.POISON.ordinal()];
|
||||
float heavymetal = data.pollution[PollutionType.HEAVYMETAL.ordinal()];
|
||||
float fallout = data.pollution[PollutionType.FALLOUT.ordinal()];
|
||||
|
||||
soot = ((int) (soot * 100)) / 100F;
|
||||
poison = ((int) (poison * 100)) / 100F;
|
||||
heavymetal = ((int) (heavymetal * 100)) / 100F;
|
||||
fallout = ((int) (fallout * 100)) / 100F;
|
||||
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Soot: " + data.pollution[PollutionType.SOOT.ordinal()]).color(EnumChatFormatting.YELLOW).flush(), 100, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Poison: " + data.pollution[PollutionType.POISON.ordinal()]).color(EnumChatFormatting.YELLOW).flush(), 101, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Heavy metal: " + data.pollution[PollutionType.HEAVYMETAL.ordinal()]).color(EnumChatFormatting.YELLOW).flush(), 102, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Fallout: " + data.pollution[PollutionType.FALLOUT.ordinal()]).color(EnumChatFormatting.YELLOW).flush(), 103, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Soot: " + soot).color(EnumChatFormatting.YELLOW).flush(), 100, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Poison: " + poison).color(EnumChatFormatting.YELLOW).flush(), 101, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Heavy metal: " + heavymetal).color(EnumChatFormatting.YELLOW).flush(), 102, 2000), (EntityPlayerMP) entity);
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Fallout: " + fallout).color(EnumChatFormatting.YELLOW).flush(), 103, 2000), (EntityPlayerMP) entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import com.hbm.potion.HbmPotion;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@ -39,7 +40,7 @@ import net.minecraft.util.Vec3;
|
||||
|
||||
public class ItemAmmoHIMARS extends Item {
|
||||
|
||||
public static HIMARSRocket[] itemTypes = new HIMARSRocket[ /* >>> */ 7 /* <<< */ ];
|
||||
public static HIMARSRocket[] itemTypes = new HIMARSRocket[ /* >>> */ 8 /* <<< */ ];
|
||||
|
||||
public static final int SMALL = 0;
|
||||
public static final int LARGE = 1;
|
||||
@ -48,6 +49,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
public static final int SMALL_TB = 4;
|
||||
public static final int LARGE_TB = 5;
|
||||
public static final int SMALL_MINI_NUKE = 6;
|
||||
public static final int SMALL_LAVA = 7;
|
||||
|
||||
public ItemAmmoHIMARS() {
|
||||
this.setHasSubtypes(true);
|
||||
@ -64,6 +66,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
list.add(new ItemStack(item, 1, SMALL_HE));
|
||||
list.add(new ItemStack(item, 1, SMALL_WP));
|
||||
list.add(new ItemStack(item, 1, SMALL_TB));
|
||||
list.add(new ItemStack(item, 1, SMALL_LAVA));
|
||||
list.add(new ItemStack(item, 1, SMALL_MINI_NUKE));
|
||||
list.add(new ItemStack(item, 1, LARGE));
|
||||
list.add(new ItemStack(item, 1, LARGE_TB));
|
||||
@ -103,6 +106,11 @@ public class ItemAmmoHIMARS extends Item {
|
||||
list.add(r + "Deals nuclear damage");
|
||||
list.add(r + "Destroys blocks");
|
||||
break;
|
||||
case SMALL_LAVA:
|
||||
list.add(y + "Strength: 20");
|
||||
list.add(r + "Creates volcanic lava");
|
||||
list.add(r + "Destroys blocks");
|
||||
break;
|
||||
case LARGE:
|
||||
list.add(y + "Strength: 50");
|
||||
list.add(y + "Damage modifier: 5x");
|
||||
@ -139,13 +147,13 @@ public class ItemAmmoHIMARS extends Item {
|
||||
public void onUpdate(EntityArtilleryRocket rocket) { }
|
||||
}
|
||||
|
||||
public static void standardExplosion(EntityArtilleryRocket rocket, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks) {
|
||||
public static void standardExplosion(EntityArtilleryRocket rocket, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks, Block slag, int slagMeta) {
|
||||
rocket.worldObj.playSoundEffect(rocket.posX, rocket.posY, rocket.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rocket.worldObj.rand.nextFloat() * 0.2F);
|
||||
Vec3 vec = Vec3.createVectorHelper(rocket.motionX, rocket.motionY, rocket.motionZ).normalize();
|
||||
ExplosionVNT xnt = new ExplosionVNT(rocket.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, size);
|
||||
if(breaksBlocks) {
|
||||
xnt.setBlockAllocator(new BlockAllocatorStandard(48));
|
||||
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop().withBlockEffect(new BlockMutatorDebris(ModBlocks.block_slag, 1)));
|
||||
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop().withBlockEffect(new BlockMutatorDebris(slag, slagMeta)));
|
||||
}
|
||||
xnt.setEntityProcessor(new EntityProcessorCross(7.5).withRangeMod(rangeMod));
|
||||
xnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
@ -163,9 +171,10 @@ public class ItemAmmoHIMARS extends Item {
|
||||
|
||||
private void init() {
|
||||
/* STANDARD ROCKETS */
|
||||
this.itemTypes[SMALL] = new HIMARSRocket("standard", "himars_standard", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, false); }};
|
||||
this.itemTypes[SMALL_HE] = new HIMARSRocket("standard_he", "himars_standard_he", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, true); }};
|
||||
this.itemTypes[LARGE] = new HIMARSRocket("single", "himars_single", 1) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 50F, 5F, true); }};
|
||||
this.itemTypes[SMALL] = new HIMARSRocket("standard", "himars_standard", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.slag, 1); }};
|
||||
this.itemTypes[SMALL_HE] = new HIMARSRocket("standard_he", "himars_standard_he", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, true, ModBlocks.slag, 1); }};
|
||||
this.itemTypes[SMALL_LAVA] = new HIMARSRocket("standard_lava", "himars_standard_lava", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, true, ModBlocks.volcanic_lava_block, 0); }};
|
||||
this.itemTypes[LARGE] = new HIMARSRocket("single", "himars_single", 1) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 50F, 5F, true, ModBlocks.slag, 1); }};
|
||||
|
||||
this.itemTypes[SMALL_MINI_NUKE] = new HIMARSRocket("standard_mini_nuke", "himars_standard_mini_nuke", 0) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
@ -177,7 +186,7 @@ public class ItemAmmoHIMARS extends Item {
|
||||
|
||||
this.itemTypes[SMALL_WP] = new HIMARSRocket("standard_wp", "himars_standard_wp", 0) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
standardExplosion(rocket, mop, 20F, 3F, false);
|
||||
standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.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);
|
||||
int radius = 30;
|
||||
@ -200,14 +209,14 @@ public class ItemAmmoHIMARS extends Item {
|
||||
|
||||
this.itemTypes[SMALL_TB] = new HIMARSRocket("standard_tb", "himars_standard_tb", 0) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
standardExplosion(rocket, mop, 20F, 10F, true);
|
||||
standardExplosion(rocket, mop, 20F, 10F, true, ModBlocks.slag, 1);
|
||||
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
|
||||
standardMush(rocket, mop, 20);
|
||||
}};
|
||||
|
||||
this.itemTypes[LARGE_TB] = new HIMARSRocket("single_tb", "himars_single_tb", 1) {
|
||||
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
|
||||
standardExplosion(rocket, mop, 50F, 12F, true);
|
||||
standardExplosion(rocket, mop, 50F, 12F, true, ModBlocks.slag, 1);
|
||||
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
|
||||
standardMush(rocket, mop, 35);
|
||||
}};
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
package com.hbm.lib;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ItemAmmoEnums.Ammo357Magnum;
|
||||
import com.hbm.items.ItemAmmoEnums.AmmoFatman;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemBreedingRod.*;
|
||||
import com.hbm.items.machine.ItemBreedingRod.BreedingRodType;
|
||||
import com.hbm.items.machine.ItemZirnoxRod.EnumZirnoxType;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.items.special.ItemBookLore;
|
||||
import com.hbm.items.tool.ItemBlowtorch;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
|
||||
public class HbmChestContents {
|
||||
@ -407,15 +410,26 @@ public class HbmChestContents {
|
||||
new WeightedRandomChestContent(Items.experience_bottle, 0, 1, 3, 1),
|
||||
};
|
||||
|
||||
/** ITEMBOOKLORE ARRAYS */
|
||||
//might make a wrapper class for this, if game-state knowledge using the nbt system becomes that relevant
|
||||
public final static BookLoreType[] books_office_sch = new BookLoreType[] {
|
||||
BookLoreType.RESIGNATION_NOTE,
|
||||
BookLoreType.MEMO_STOCKS,
|
||||
BookLoreType.MEMO_SCHRAB_GSA,
|
||||
BookLoreType.MEMO_SCHRAB_RD,
|
||||
BookLoreType.MEMO_SCHRAB_NUKE,
|
||||
};
|
||||
|
||||
|
||||
/** ITEMBOOKLORE SHIT */
|
||||
//one downside of all this huge flexibility, make a wrapper if it's too annoying
|
||||
public static ItemStack generateOfficeBook(Random rand) { //TODO rework this lore in general
|
||||
String key;
|
||||
int pages;
|
||||
switch(rand.nextInt(5)) {
|
||||
case 0:
|
||||
key = "resignation_note"; pages = 3; break;
|
||||
case 1:
|
||||
key = "memo_stocks"; pages = 1; break;
|
||||
case 2:
|
||||
key = "memo_schrab_gsa"; pages = 2; break;
|
||||
case 3:
|
||||
key = "memo_schrab_rd"; pages = 4; break;
|
||||
case 4:
|
||||
key = "memo_schrab_nuke"; pages = 3; break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
return ItemBookLore.createBook(key, pages, 0x6BC8FF, 0x0A0A0A);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ import com.hbm.world.feature.DepthDeposit;
|
||||
import com.hbm.world.feature.Dud;
|
||||
import com.hbm.world.feature.Geyser;
|
||||
import com.hbm.world.feature.GeyserLarge;
|
||||
import com.hbm.world.feature.GlyphidHive;
|
||||
import com.hbm.world.feature.Meteorite;
|
||||
import com.hbm.world.feature.OilBubble;
|
||||
import com.hbm.world.feature.OilSandBubble;
|
||||
@ -216,6 +217,13 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
}
|
||||
|
||||
if(GeneralConfig.enableDungeons && world.provider.isSurfaceWorld()) {
|
||||
|
||||
if(rand.nextInt(1000) == 0) {
|
||||
int x = i + rand.nextInt(16) + 8;
|
||||
int z = j + rand.nextInt(16) + 8;
|
||||
int y = world.getHeightValue(x, z);
|
||||
GlyphidHive.generate(world, x, y, z, rand);
|
||||
}
|
||||
|
||||
if(biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) {
|
||||
if(WorldConfig.radioStructure > 0 && rand.nextInt(WorldConfig.radioStructure) == 0) {
|
||||
|
||||
@ -19,6 +19,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -587,6 +588,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySawblade.class, new RenderSawblade());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityChemical.class, new RenderChemical());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMist.class, new RenderMist());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAcidBomb.class, new RenderSnowball(Items.slime_ball));
|
||||
//grenades
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeGeneric.class, new RenderSnowball(ModItems.grenade_generic));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeStrong.class, new RenderSnowball(ModItems.grenade_strong));
|
||||
@ -721,6 +723,15 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySiegeSkeleton.class, new RenderSiegeSkeleton());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySiegeTunneler.class, new RenderSiegeTunneler());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGhost.class, new RenderGhost());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphid.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrawler.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBehemoth.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrenda.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBombardier.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBlaster.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidScout.class, new RenderGlyphid());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidNuclear.class, new RenderGlyphidNuclear());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityFBIDrone.class, new RenderDrone());
|
||||
//"particles"
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));
|
||||
|
||||
@ -92,6 +92,7 @@ public class NEIConfig implements IConfigureNEI {
|
||||
API.hideItem(new ItemStack(ModBlocks.transission_hatch));
|
||||
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
|
||||
if(MainRegistry.polaroidID != 11) {
|
||||
API.hideItem(new ItemStack(ModItems.book_secret));
|
||||
API.hideItem(new ItemStack(ModItems.book_of_));
|
||||
|
||||
@ -313,6 +313,8 @@ public class ResourceManager {
|
||||
public static final IModelCustom ufo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/ufo.obj"));
|
||||
public static final IModelCustom mini_ufo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/mini_ufo.obj"));
|
||||
public static final IModelCustom siege_ufo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/siege_ufo.obj"));
|
||||
public static final IModelCustom glyphid = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/glyphid.obj"));
|
||||
public static final IModelCustom drone = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/quadcopter.obj"));
|
||||
|
||||
//ZIRNOX
|
||||
public static final IModelCustom zirnox = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/zirnox.obj"));
|
||||
@ -666,6 +668,14 @@ public class ResourceManager {
|
||||
public static final ResourceLocation iou = new ResourceLocation(RefStrings.MODID, "textures/entity/iou.png");
|
||||
public static final ResourceLocation spider_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/blockspider.png");
|
||||
public static final ResourceLocation ufo_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/ufo.png");
|
||||
public static final ResourceLocation glyphid_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid.png");
|
||||
public static final ResourceLocation glyphid_brawler_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brawler.png");
|
||||
public static final ResourceLocation glyphid_behemoth_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_behemoth.png");
|
||||
public static final ResourceLocation glyphid_brenda_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brenda.png");
|
||||
public static final ResourceLocation glyphid_bombardier_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_bombardier.png");
|
||||
public static final ResourceLocation glyphid_blaster_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_blaster.png");
|
||||
public static final ResourceLocation glyphid_scout_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_scout.png");
|
||||
public static final ResourceLocation glyphid_nuclear_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_nuclear.png");
|
||||
|
||||
//ZIRNOX
|
||||
public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png");
|
||||
|
||||
45
src/main/java/com/hbm/render/entity/mob/RenderDrone.java
Normal file
45
src/main/java/com/hbm/render/entity/mob/RenderDrone.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.hbm.render.entity.mob;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.mob.EntityFBIDrone;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderDrone extends Render {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y + 0.25, z);
|
||||
|
||||
this.bindTexture(getEntityTexture(entity));
|
||||
|
||||
Random rand = new Random(entity.getEntityId());
|
||||
GL11.glRotated(rand.nextDouble() * 360D, 0, 1, 0);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
ResourceManager.drone.renderAll();
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getEntityTexture((EntityFBIDrone) entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntityFBIDrone entity) {
|
||||
return new ResourceLocation(RefStrings.MODID + ":textures/entity/quadcopter.png");
|
||||
}
|
||||
}
|
||||
172
src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java
Normal file
172
src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java
Normal file
@ -0,0 +1,172 @@
|
||||
package com.hbm.render.entity.mob;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderGlyphid extends RenderLiving {
|
||||
|
||||
public RenderGlyphid() {
|
||||
super(new ModelGlyphid(), 1.0F);
|
||||
this.shadowOpaque = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
EntityGlyphid glyphid = (EntityGlyphid) entity;
|
||||
return glyphid.getSkin();
|
||||
}
|
||||
|
||||
public static class ModelGlyphid extends ModelBase {
|
||||
|
||||
double bite = 0;
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float interp) {
|
||||
bite = entity.getSwingProgress(interp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float limbSwing, float limbSwingAmount, float rotationYaw, float rotationHeadYaw, float rotationPitch, float scale) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -1.5F, 0);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
double s = ((EntityGlyphid) entity).getScale();
|
||||
GL11.glScaled(s, s, s);
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
byte armor = living.getDataWatcher().getWatchableObjectByte(17);
|
||||
//MainRegistry.proxy.displayTooltip("" + limbSwingAmount, 999);
|
||||
|
||||
double walkCycle = limbSwing;
|
||||
|
||||
double speed = 100000D;
|
||||
double chewing = 200000D;
|
||||
double cy0 = Math.sin(walkCycle % (Math.PI * 2));
|
||||
double cy1 = Math.sin(walkCycle % (Math.PI * 2) - Math.PI * 0.5);
|
||||
double cy2 = Math.sin(walkCycle % (Math.PI * 2) - Math.PI);
|
||||
double cy3 = Math.sin(walkCycle % (Math.PI * 2) - Math.PI * 0.75);
|
||||
|
||||
double bite = MathHelper.clamp_double(Math.sin(this.bite * Math.PI * 2 - Math.PI * 0.5), 0, 1) * 20;
|
||||
double headTilt = Math.sin(this.bite * Math.PI) * 30;
|
||||
|
||||
ResourceManager.glyphid.renderPart("Body");
|
||||
if((armor & (1 << 0)) > 0) ResourceManager.glyphid.renderPart("ArmorFront");
|
||||
if((armor & (1 << 1)) > 0) ResourceManager.glyphid.renderPart("ArmorLeft");
|
||||
if((armor & (1 << 2)) > 0) ResourceManager.glyphid.renderPart("ArmorRight");
|
||||
|
||||
/// LEFT ARM ///
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.25, 0.625, 0.0625);
|
||||
GL11.glRotated(10, 0, 1, 0);
|
||||
GL11.glRotated(35 + cy1 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.0625);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftUpper");
|
||||
GL11.glTranslated(0.25, 0.625, 0.4375);
|
||||
GL11.glRotated(-75 - cy1 * 20 + cy0 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.4375);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftMid");
|
||||
GL11.glTranslated(0.25, 0.625, 0.9375);
|
||||
GL11.glRotated(90 - cy0 * 45, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.9375);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftLower");
|
||||
if((armor & (1 << 3)) > 0) ResourceManager.glyphid.renderPart("ArmLeftArmor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
/// RIGHT ARM ///
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-0.25, 0.625, 0.0625);
|
||||
GL11.glRotated(-10, 0, 1, 0);
|
||||
GL11.glRotated(35 + cy2 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.0625);
|
||||
ResourceManager.glyphid.renderPart("ArmRightUpper");
|
||||
GL11.glTranslated(-0.25, 0.625, 0.4375);
|
||||
GL11.glRotated(-75 - cy2 * 20 + cy3 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.4375);
|
||||
ResourceManager.glyphid.renderPart("ArmRightMid");
|
||||
GL11.glTranslated(-0.25, 0.625, 0.9375);
|
||||
GL11.glRotated(90 - cy3 * 45, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.9375);
|
||||
ResourceManager.glyphid.renderPart("ArmRightLower");
|
||||
if((armor & (1 << 4)) > 0) ResourceManager.glyphid.renderPart("ArmRightArmor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(headTilt, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(-bite, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawTop");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(bite, 0, 1, 0);
|
||||
GL11.glRotated(bite, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(-bite, 0, 1, 0);
|
||||
GL11.glRotated(bite, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawRight");
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
double steppy = 15;
|
||||
double bend = 60;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
||||
double c0 = cy0 * (i == 1 ? -1 : 1);
|
||||
double c1 = cy1 * (i == 1 ? -1 : 1);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.25, 0);
|
||||
GL11.glRotated(i * 30 - 15 + c0 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(steppy + c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegLeftUpper");
|
||||
GL11.glTranslated(0.5625, 0.25, 0);
|
||||
GL11.glRotated(-bend - c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(-0.5625, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegLeftLower");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.25, 0);
|
||||
GL11.glRotated(i * 30 - 45 + c0 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(-steppy + c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegRightUpper");
|
||||
GL11.glTranslated(-0.5625, 0.25, 0);
|
||||
GL11.glRotated(bend - c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0.5625, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegRightLower");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
package com.hbm.render.entity.mob;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.mob.EntityGlyphid;
|
||||
import com.hbm.entity.mob.EntityGlyphidNuclear;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderGlyphidNuclear extends RenderLiving {
|
||||
|
||||
public RenderGlyphidNuclear() {
|
||||
super(new ModelGlyphid(), 1.0F);
|
||||
this.shadowOpaque = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
EntityGlyphid glyphid = (EntityGlyphid) entity;
|
||||
return glyphid.getSkin();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntityLivingBase entity, float interp) {
|
||||
this.preRenderCallback((EntityGlyphidNuclear) entity, interp);
|
||||
}
|
||||
|
||||
protected void preRenderCallback(EntityGlyphidNuclear entity, float interp) {
|
||||
float swell = (float) (entity.deathTicks + interp) / 95F;
|
||||
float flash = 1.0F + MathHelper.sin(swell * 100.0F) * swell * 0.01F;
|
||||
|
||||
if(swell < 0.0F) {
|
||||
swell = 0.0F;
|
||||
}
|
||||
|
||||
if(swell > 1.0F) {
|
||||
swell = 1.0F;
|
||||
}
|
||||
|
||||
swell *= swell;
|
||||
swell *= swell;
|
||||
|
||||
float scaleHorizontal = (1.0F + swell * 0.4F) * flash;
|
||||
float scaleVertical = (1.0F + swell * 0.1F) / flash;
|
||||
GL11.glScalef(scaleHorizontal, scaleVertical, scaleHorizontal);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColorMultiplier(EntityLivingBase entity, float lightBrightness, float interp) {
|
||||
return this.getColorMultiplier((EntityGlyphidNuclear) entity, lightBrightness, interp);
|
||||
}
|
||||
|
||||
protected int getColorMultiplier(EntityGlyphidNuclear entity, float lightBrightness, float interp) {
|
||||
float swell = (float) (entity.deathTicks + interp) / 20F;
|
||||
|
||||
|
||||
|
||||
|
||||
int a = (int) (swell * 0.2F * 255.0F);
|
||||
|
||||
if((int) (swell * 10.0F) % 4 < 2)
|
||||
return a *= 0.75;
|
||||
|
||||
if(a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
|
||||
if(a > 255) {
|
||||
a = 255;
|
||||
}
|
||||
|
||||
short r = 255;
|
||||
short g = 255;
|
||||
short b = 255;
|
||||
return a << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
|
||||
public static class ModelGlyphid extends ModelBase {
|
||||
|
||||
double bite = 0;
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float interp) {
|
||||
bite = entity.getSwingProgress(interp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float limbSwing, float limbSwingAmount, float rotationYaw, float rotationHeadYaw, float rotationPitch, float scale) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslatef(0, -1.5F, 0);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
double s = ((EntityGlyphid) entity).getScale();
|
||||
GL11.glScaled(s, s, s);
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
byte armor = living.getDataWatcher().getWatchableObjectByte(17);
|
||||
|
||||
double walkCycle = limbSwing;
|
||||
|
||||
double speed = 100000D;
|
||||
double chewing = 200000D;
|
||||
double cy0 = Math.sin(walkCycle % (Math.PI * 2));
|
||||
double cy1 = Math.sin(walkCycle % (Math.PI * 2) - Math.PI * 0.5);
|
||||
double cy2 = Math.sin(walkCycle % (Math.PI * 2) - Math.PI);
|
||||
double cy3 = Math.sin(walkCycle % (Math.PI * 2) - Math.PI * 0.75);
|
||||
|
||||
double bite = MathHelper.clamp_double(Math.sin(this.bite * Math.PI * 2 - Math.PI * 0.5), 0, 1) * 20;
|
||||
double headTilt = Math.sin(this.bite * Math.PI) * 30;
|
||||
|
||||
ResourceManager.glyphid.renderPart("Body");
|
||||
if((armor & (1 << 0)) > 0) ResourceManager.glyphid.renderPart("ArmorFront");
|
||||
if((armor & (1 << 1)) > 0) ResourceManager.glyphid.renderPart("ArmorLeft");
|
||||
if((armor & (1 << 2)) > 0) ResourceManager.glyphid.renderPart("ArmorRight");
|
||||
|
||||
/// LEFT ARM ///
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.25, 0.625, 0.0625);
|
||||
GL11.glRotated(10, 0, 1, 0);
|
||||
GL11.glRotated(35 + cy1 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.0625);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftUpper");
|
||||
GL11.glTranslated(0.25, 0.625, 0.4375);
|
||||
GL11.glRotated(-75 - cy1 * 20 + cy0 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.4375);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftMid");
|
||||
GL11.glTranslated(0.25, 0.625, 0.9375);
|
||||
GL11.glRotated(90 - cy0 * 45, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.9375);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftLower");
|
||||
if((armor & (1 << 3)) > 0) ResourceManager.glyphid.renderPart("ArmLeftArmor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
/// RIGHT ARM ///
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-0.25, 0.625, 0.0625);
|
||||
GL11.glRotated(-10, 0, 1, 0);
|
||||
GL11.glRotated(35 + cy2 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.0625);
|
||||
ResourceManager.glyphid.renderPart("ArmRightUpper");
|
||||
GL11.glTranslated(-0.25, 0.625, 0.4375);
|
||||
GL11.glRotated(-75 - cy2 * 20 + cy3 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.4375);
|
||||
ResourceManager.glyphid.renderPart("ArmRightMid");
|
||||
GL11.glTranslated(-0.25, 0.625, 0.9375);
|
||||
GL11.glRotated(90 - cy3 * 45, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.9375);
|
||||
ResourceManager.glyphid.renderPart("ArmRightLower");
|
||||
if((armor & (1 << 4)) > 0) ResourceManager.glyphid.renderPart("ArmRightArmor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(headTilt, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(-bite, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawTop");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(bite, 0, 1, 0);
|
||||
GL11.glRotated(bite, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(-bite, 0, 1, 0);
|
||||
GL11.glRotated(bite, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawRight");
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
double steppy = 15;
|
||||
double bend = 60;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
||||
double c0 = cy0 * (i == 1 ? -1 : 1);
|
||||
double c1 = cy1 * (i == 1 ? -1 : 1);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.25, 0);
|
||||
GL11.glRotated(i * 30 - 15 + c0 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(steppy + c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegLeftUpper");
|
||||
GL11.glTranslated(0.5625, 0.25, 0);
|
||||
GL11.glRotated(-bend - c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(-0.5625, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegLeftLower");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.25, 0);
|
||||
GL11.glRotated(i * 30 - 45 + c0 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(-steppy + c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegRightUpper");
|
||||
GL11.glTranslated(-0.5625, 0.25, 0);
|
||||
GL11.glRotated(bend - c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0.5625, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegRightLower");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glTranslated(0, 1, 0);
|
||||
GL11.glRotated(90, 1, 0, 0);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.mini_nuke_tex);
|
||||
ResourceManager.projectiles.renderPart("MiniNuke");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ 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;
|
||||
@ -14,11 +15,35 @@ public class RenderCompressor extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
switch(tile.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.compressor_tex);
|
||||
ResourceManager.compressor.renderAll();
|
||||
ResourceManager.compressor.renderPart("Compressor");
|
||||
|
||||
double h = (System.currentTimeMillis() * 0.005) % 6D;
|
||||
|
||||
if(h > 3) h = 6 - h;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, h - 3, 0);
|
||||
ResourceManager.compressor.renderPart("Pump");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 1.5, 0);
|
||||
GL11.glRotated((System.currentTimeMillis() * -0.5) % 360, 1, 0, 0);
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
ResourceManager.compressor.renderPart("Fan");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
|
||||
@ -3,14 +3,12 @@ package com.hbm.render.tileentity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.render.util.IconUtil;
|
||||
import com.hbm.render.util.SmallBlockPronter;
|
||||
import com.hbm.tileentity.machine.TileEntityITERStruct;
|
||||
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderITERMultiblock extends TileEntitySpecialRenderer {
|
||||
|
||||
@ -19,50 +17,35 @@ public class RenderITERMultiblock extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
SmallBlockPronter.startDrawing();
|
||||
|
||||
int[][][] layout = TileEntityITERStruct.layout;
|
||||
|
||||
for(int iy = -2; iy <= 2; iy++) {
|
||||
int iny = 2 - Math.abs(iy);
|
||||
|
||||
for(int ix = 0; ix < layout[0].length; ix++) {
|
||||
for(int iz = 0; iz < layout[0][0].length; iz++) {
|
||||
|
||||
int block = layout[iny][ix][iz];
|
||||
|
||||
switch(block) {
|
||||
case 0:
|
||||
continue;
|
||||
case 1: SmallBlockPronter.drawSmolBlockAt(ModBlocks.fusion_conductor, 1, ix - 7F, iy + 2, iz - 7F); break;
|
||||
case 2: SmallBlockPronter.drawSmolBlockAt(ModBlocks.fusion_center, 0, ix - 7F, iy + 2, iz - 7F); break;
|
||||
case 3: SmallBlockPronter.drawSmolBlockAt(ModBlocks.fusion_motor, 0, ix - 7F, iy + 2, iz - 7F); break;
|
||||
case 4: SmallBlockPronter.drawSmolBlockAt(ModBlocks.reinforced_glass, 0, ix - 7F, iy + 2, iz - 7F); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SmallBlockPronter.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
ResourceLocation magnet = IconUtil.getTextureFromBlockAndSide(ModBlocks.fusion_conductor, 2);
|
||||
ResourceLocation solenoid = IconUtil.getTextureFromBlockAndSide(ModBlocks.fusion_center, 2);
|
||||
ResourceLocation motor = IconUtil.getTextureFromBlock(ModBlocks.fusion_motor);
|
||||
ResourceLocation glass = IconUtil.getTextureFromBlock(ModBlocks.reinforced_glass);
|
||||
|
||||
int[][][] layout = TileEntityITERStruct.layout;
|
||||
|
||||
for(int iy = -2; iy <= 2; iy ++) {
|
||||
|
||||
int iny = 2 - Math.abs(iy);
|
||||
|
||||
for(int ix = 0; ix < layout[0].length; ix++) {
|
||||
|
||||
for(int iz = 0; iz < layout[0][0].length; iz++) {
|
||||
|
||||
int block = layout[iny][ix][iz];
|
||||
|
||||
switch(block) {
|
||||
case 0: continue;
|
||||
case 1: bindTexture(magnet); break;
|
||||
case 2: bindTexture(solenoid); break;
|
||||
case 3: bindTexture(motor); break;
|
||||
case 4: bindTexture(glass); break;
|
||||
}
|
||||
|
||||
SmallBlockPronter.renderSmolBlockAt(ix - 6F, iy + 3, iz - 7F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL12;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.loader.HFRWavefrontObject;
|
||||
import com.hbm.render.util.HorsePronter;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
@ -30,8 +31,9 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glTranslated(0, 0, 0.75);
|
||||
/*GL11.glTranslated(0, 0, 0.75);
|
||||
this.bindTexture(new ResourceLocation(RefStrings.MODID, "textures/models/horse/dyx.png"));
|
||||
HorsePronter.reset();
|
||||
//HorsePronter.pose(HorsePronter.id_lfl, 0, System.currentTimeMillis() % 360 / 10D, 0);
|
||||
@ -59,7 +61,126 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
float f15 = icon.getMaxU();
|
||||
float f4 = icon.getMinV();
|
||||
float f5 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f15, f4, f14, f5, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f15, f4, f14, f5, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);*/
|
||||
|
||||
double speed = 100D;
|
||||
double chewing = 200D;
|
||||
double cy0 = Math.sin(System.currentTimeMillis() / speed % (Math.PI * 2));
|
||||
double cy1 = Math.sin(System.currentTimeMillis() / speed % (Math.PI * 2) - Math.PI * 0.5);
|
||||
double cy2 = Math.sin(System.currentTimeMillis() / speed % (Math.PI * 2) - Math.PI);
|
||||
double cy3 = Math.sin(System.currentTimeMillis() / speed % (Math.PI * 2) - Math.PI * 0.75);
|
||||
|
||||
double cy4 = Math.sin(System.currentTimeMillis() / chewing % (Math.PI * 2));
|
||||
double cy5 = Math.sin(System.currentTimeMillis() / chewing % (Math.PI * 2) - Math.PI * 0.5);
|
||||
|
||||
this.bindTexture(ResourceManager.glyphid_tex);
|
||||
ResourceManager.glyphid.renderPart("Body");
|
||||
ResourceManager.glyphid.renderPart("ArmorFront");
|
||||
ResourceManager.glyphid.renderPart("ArmorLeft");
|
||||
ResourceManager.glyphid.renderPart("ArmorRight");
|
||||
|
||||
/// LEFT ARM ///
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.25, 0.625, 0.0625);
|
||||
GL11.glRotated(10, 0, 1, 0);
|
||||
GL11.glRotated(35 + cy1 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.0625);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftUpper");
|
||||
GL11.glTranslated(0.25, 0.625, 0.4375);
|
||||
GL11.glRotated(-75 - cy1 * 20 + cy0 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.4375);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftMid");
|
||||
GL11.glTranslated(0.25, 0.625, 0.9375);
|
||||
GL11.glRotated(90 - cy0 * 45, 1, 0, 0);
|
||||
GL11.glTranslated(-0.25, -0.625, -0.9375);
|
||||
ResourceManager.glyphid.renderPart("ArmLeftLower");
|
||||
ResourceManager.glyphid.renderPart("ArmLeftArmor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
/// RIGHT ARM ///
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-0.25, 0.625, 0.0625);
|
||||
GL11.glRotated(-10, 0, 1, 0);
|
||||
GL11.glRotated(35 + cy2 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.0625);
|
||||
ResourceManager.glyphid.renderPart("ArmRightUpper");
|
||||
GL11.glTranslated(-0.25, 0.625, 0.4375);
|
||||
GL11.glRotated(-75 - cy2 * 20 + cy3 * 20, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.4375);
|
||||
ResourceManager.glyphid.renderPart("ArmRightMid");
|
||||
GL11.glTranslated(-0.25, 0.625, 0.9375);
|
||||
GL11.glRotated(90 - cy3 * 45, 1, 0, 0);
|
||||
GL11.glTranslated(0.25, -0.625, -0.9375);
|
||||
ResourceManager.glyphid.renderPart("ArmRightLower");
|
||||
ResourceManager.glyphid.renderPart("ArmRightArmor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(cy5 * 15 + 15, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(-7.5 - cy4 * 7.5, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawTop");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(7.5 + cy4 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(7.5 + cy4 * 7.5, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.5, 0.25);
|
||||
GL11.glRotated(-7.5 - cy4 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(7.5 + cy4 * 7.5, 1, 0, 0);
|
||||
GL11.glTranslated(0, -0.5, -0.25);
|
||||
ResourceManager.glyphid.renderPart("JawRight");
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
double steppy = 15;
|
||||
double bend = 60;
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
|
||||
double c0 = cy0 * (i == 1 ? -1 : 1);
|
||||
double c1 = cy1 * (i == 1 ? -1 : 1);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.25, 0);
|
||||
GL11.glRotated(i * 30 - 15 + c0 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(steppy + c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegLeftUpper");
|
||||
GL11.glTranslated(0.5625, 0.25, 0);
|
||||
GL11.glRotated(-bend - c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(-0.5625, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegLeftLower");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0.25, 0);
|
||||
GL11.glRotated(i * 30 - 45 + c0 * 7.5, 0, 1, 0);
|
||||
GL11.glRotated(-steppy + c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegRightUpper");
|
||||
GL11.glTranslated(-0.5625, 0.25, 0);
|
||||
GL11.glRotated(bend - c1 * steppy, 0, 0, 1);
|
||||
GL11.glTranslated(0.5625, -0.25, 0);
|
||||
ResourceManager.glyphid.renderPart("LegRightLower");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
this.bindTexture(ResourceManager.universal);
|
||||
GL11.glScaled(0.05, 0.05, 0.05);
|
||||
ResourceManager.sphere_uv.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre;
|
||||
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
|
||||
import com.hbm.blocks.generic.BlockDynamicSlag.TileEntitySlag;
|
||||
import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter;
|
||||
import com.hbm.blocks.generic.BlockGlyphidSpawner.TileEntityGlpyhidSpawner;
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre;
|
||||
import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe;
|
||||
@ -193,6 +194,7 @@ public class TileMappings {
|
||||
put(TileEntityPipeGauge.class, "tileentity_pipe_gauge");
|
||||
put(TileEntityMachineBAT9000.class, "tileentity_bat9000");
|
||||
put(TileEntityMachineOrbus.class, "tileentity_orbus");
|
||||
put(TileEntityGlpyhidSpawner.class, "tileentity_glyphid_spawner");
|
||||
|
||||
put(TileEntityLoot.class, "tileentity_ntm_loot");
|
||||
put(TileEntityBobble.class, "tileentity_ntm_bobblehead");
|
||||
|
||||
@ -4,9 +4,15 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
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.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityGeiger extends TileEntity {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityGeiger extends TileEntity implements SimpleComponent {
|
||||
|
||||
int timer = 0;
|
||||
int ticker = 0;
|
||||
@ -57,5 +63,15 @@ public class TileEntityGeiger extends TileEntity {
|
||||
int rads = (int)Math.ceil(ChunkRadiationManager.proxy.getRadiation(worldObj, xCoord, yCoord, zCoord));
|
||||
return rads;
|
||||
}
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "ntm_geiger";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getRads(Context context, Arguments args) {
|
||||
return new Object[] {check()};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Leaded;
|
||||
import com.hbm.inventory.gui.GUIOilburner;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
@ -73,7 +74,10 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
|
||||
|
||||
this.heatEnergy += heat * toBurn;
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * burnRate * 0.5F);
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * burnRate * 0.5F);
|
||||
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * burnRate * 0.5F);
|
||||
}
|
||||
|
||||
shouldCool = false;
|
||||
}
|
||||
|
||||
@ -151,9 +151,10 @@ public class TileEntityITERStruct extends TileEntity {
|
||||
|
||||
int b = layout[ly][x][z];
|
||||
Block block = worldObj.getBlock(xCoord + x - width, yCoord + y, zCoord + z - width);
|
||||
int meta = worldObj.getBlockMetadata(xCoord + x - width, yCoord + y, zCoord + z - width);
|
||||
|
||||
switch(b) {
|
||||
case 1: if(block != ModBlocks.fusion_conductor) { return; } break;
|
||||
case 1: if(block != ModBlocks.fusion_conductor || meta != 1) { return; } break;
|
||||
case 2: if(block != ModBlocks.fusion_center) { return; } break;
|
||||
case 3: if(block != ModBlocks.fusion_motor) { return; } break;
|
||||
case 4: if(block != ModBlocks.reinforced_glass) { return; } break;
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Combustible;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Leaded;
|
||||
import com.hbm.inventory.gui.GUICombustionEngine;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemPistons.EnumPistonType;
|
||||
@ -86,7 +87,10 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachineBase imp
|
||||
this.power += toBurn * (trait.getCombustionEnergy() / 10_000D) * eff;
|
||||
fill -= toBurn;
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * setting * 0.1F);
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * setting * 0.1F);
|
||||
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * setting * 0.1F);
|
||||
}
|
||||
|
||||
if(toBurn > 0) {
|
||||
wasOn = true;
|
||||
|
||||
@ -1,21 +1,45 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCompressor;
|
||||
import com.hbm.inventory.gui.GUICompressor;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
public class TileEntityMachineCompressor extends TileEntityMachineBase {
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineCompressor extends TileEntityMachineBase implements IGUIProvider {
|
||||
|
||||
public TileEntityMachineCompressor() {
|
||||
super(0);
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
return "container.machineCompressor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerCompressor(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUICompressor(player.inventory, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
@ -15,6 +17,7 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Combustible;
|
||||
import com.hbm.inventory.fluid.trait.FT_Combustible.FuelGrade;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Leaded;
|
||||
import com.hbm.inventory.gui.GUIMachineDiesel;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
@ -203,6 +206,9 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
|
||||
tank.setFill(tank.getFill() - 1);
|
||||
if(tank.getFill() < 0)
|
||||
tank.setFill(0);
|
||||
|
||||
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 0.5F);
|
||||
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * 0.5F);
|
||||
|
||||
if(power + getHEFromFuel() <= powerCap) {
|
||||
power += getHEFromFuel();
|
||||
|
||||
@ -64,11 +64,11 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
public static int coalGenRate = 20;
|
||||
public static double rtgHeatMult = 0.15D;
|
||||
public static double waterPowerMult = 1.0D;
|
||||
public static double lubePowerMult = 1.0D;
|
||||
public static double heatExponent = 1.1D;
|
||||
public static double lubePowerMult = 1.5D;
|
||||
public static double heatExponent = 1.15D;
|
||||
public static int waterRate = 10;
|
||||
public static int lubeRate = 1;
|
||||
public static long fluidHeatDiv = 5_000L;
|
||||
public static long fluidHeatDiv = 1_000L;
|
||||
|
||||
@Override
|
||||
public String getConfigName() {
|
||||
@ -275,7 +275,7 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
|
||||
public int getPowerFromFuel(boolean con) {
|
||||
FluidType type = tanks[1].getTankType();
|
||||
return type.hasTrait(FT_Flammable.class) ? (int)(type.getTrait(FT_Flammable.class).getHeatEnergy() / (con ? 1000L : fluidHeatDiv)) : 0;
|
||||
return type.hasTrait(FT_Flammable.class) ? (int)(type.getTrait(FT_Flammable.class).getHeatEnergy() / (con ? 5000L : fluidHeatDiv)) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -400,7 +400,7 @@ public class TileEntityReactorResearch extends TileEntityMachineBase implements
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getLevel(Context context, Arguments args) {
|
||||
return new Object[] {level};
|
||||
return new Object[] {level * 100};
|
||||
}
|
||||
|
||||
@Callback
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous_ART;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Leaded;
|
||||
import com.hbm.inventory.gui.GUIMachineGasFlare;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
@ -160,7 +161,10 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
||||
if(worldObj.getTotalWorldTime() % 3 == 0)
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord + 11, this.zCoord, "hbm:weapon.flamethrowerShoot", 1.5F, 0.75F);
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 5);
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 5);
|
||||
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,6 +203,10 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
||||
for(Entity e : affected) e.setFire(5);
|
||||
Random rand = worldObj.rand;
|
||||
ParticleUtil.spawnGasFlame(worldObj, xCoord + rand.nextDouble(), yCoord + 1.5 + rand.nextDouble() * 3, zCoord + rand.nextDouble(), rand.nextGaussian() * 0.05, 0.1, rand.nextGaussian() * 0.05);
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 70);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -383,10 +383,10 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSteamType(Context context, Arguments args) {
|
||||
FluidType type = steam.getTankType();
|
||||
if(type == Fluids.STEAM) {return new Object[] {"0"};}
|
||||
else if(type == Fluids.HOTSTEAM) {return new Object[] {"1"};}
|
||||
else if(type == Fluids.SUPERHOTSTEAM) {return new Object[] {"2"};}
|
||||
else if(type == Fluids.ULTRAHOTSTEAM) {return new Object[] {"3"};}
|
||||
if(type == Fluids.STEAM) {return new Object[] {0};}
|
||||
else if(type == Fluids.HOTSTEAM) {return new Object[] {1};}
|
||||
else if(type == Fluids.SUPERHOTSTEAM) {return new Object[] {2};}
|
||||
else if(type == Fluids.ULTRAHOTSTEAM) {return new Object[] {3};}
|
||||
else {return new Object[] {"Unknown Error"};}
|
||||
}
|
||||
|
||||
@ -401,16 +401,16 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
}
|
||||
if(type == 0) {
|
||||
steam.setTankType(Fluids.STEAM);
|
||||
return new Object[] {"true"};
|
||||
return new Object[] {true};
|
||||
} else if(type == 1) {
|
||||
steam.setTankType(Fluids.HOTSTEAM);
|
||||
return new Object[] {"true"};
|
||||
return new Object[] {true};
|
||||
} else if(type == 2) {
|
||||
steam.setTankType(Fluids.SUPERHOTSTEAM);
|
||||
return new Object[] {"true"};
|
||||
return new Object[] {true};
|
||||
} else {
|
||||
steam.setTankType(Fluids.ULTRAHOTSTEAM);
|
||||
return new Object[] {"true"};
|
||||
return new Object[] {true};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,8 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
@ -18,6 +20,7 @@ import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Amat;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous_ART;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Leaded;
|
||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Liquid;
|
||||
import com.hbm.inventory.gui.GUIMachineFluidTank;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
@ -179,6 +182,11 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
Random rand = worldObj.rand;
|
||||
ParticleUtil.spawnGasFlame(worldObj, xCoord + rand.nextDouble(), yCoord + 0.5 + rand.nextDouble(), zCoord + rand.nextDouble(), rand.nextGaussian() * 0.2, 0.1, rand.nextGaussian() * 0.2);
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 50);
|
||||
if(type.hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * 50);
|
||||
}
|
||||
|
||||
} else if(type.hasTrait(FT_Gaseous.class) || type.hasTrait(FT_Gaseous_ART.class)) {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
|
||||
@ -40,7 +40,7 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn
|
||||
return 0;
|
||||
|
||||
if(simulate)
|
||||
return 0;
|
||||
return maxReceive;
|
||||
|
||||
recursionBrake = true;
|
||||
|
||||
|
||||
128
src/main/java/com/hbm/world/feature/GlyphidHive.java
Normal file
128
src/main/java/com/hbm/world/feature/GlyphidHive.java
Normal file
@ -0,0 +1,128 @@
|
||||
package com.hbm.world.feature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class GlyphidHive {
|
||||
|
||||
public static final int[][][] schematic = new int[][][] {
|
||||
{
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
},
|
||||
{
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,1,1,9,1,1,0,0,0},
|
||||
{0,0,1,1,9,9,9,1,1,0,0},
|
||||
{0,0,1,9,9,9,9,9,1,0,0},
|
||||
{0,0,1,1,9,9,9,1,1,0,0},
|
||||
{0,0,0,1,1,9,1,1,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
},
|
||||
{
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,4,4,4,0,0,0,0},
|
||||
{0,0,0,1,1,9,1,1,0,0,0},
|
||||
{0,0,1,1,9,9,9,1,1,0,0},
|
||||
{0,3,1,9,9,9,9,9,1,5,0},
|
||||
{0,3,9,9,9,9,9,9,9,5,0},
|
||||
{0,3,1,9,9,9,9,9,1,5,0},
|
||||
{0,0,1,1,9,9,9,1,1,0,0},
|
||||
{0,0,0,1,1,9,1,1,0,0,0},
|
||||
{0,0,0,0,2,2,2,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
},
|
||||
{
|
||||
{0,0,0,0,0,4,0,0,0,0,0},
|
||||
{0,0,0,0,4,4,4,0,0,0,0},
|
||||
{0,0,0,1,4,9,4,1,0,0,0},
|
||||
{0,0,1,1,9,9,9,1,1,0,0},
|
||||
{0,3,3,9,9,9,9,9,5,5,0},
|
||||
{3,3,9,9,9,9,9,9,9,5,5},
|
||||
{0,3,3,9,9,9,9,9,5,5,0},
|
||||
{0,0,1,1,9,9,9,1,1,0,0},
|
||||
{0,0,0,1,2,9,2,1,0,0,0},
|
||||
{0,0,0,0,2,2,2,0,0,0,0},
|
||||
{0,0,0,0,0,2,0,0,0,0,0},
|
||||
},
|
||||
{
|
||||
{0,0,0,0,4,4,4,0,0,0,0},
|
||||
{0,0,0,1,4,4,4,1,0,0,0},
|
||||
{0,0,1,1,4,9,4,1,1,0,0},
|
||||
{0,1,1,1,9,9,0,1,1,1,0},
|
||||
{3,3,3,9,9,9,9,9,5,5,5},
|
||||
{3,3,9,9,9,9,9,9,9,5,5},
|
||||
{3,3,3,9,9,9,9,9,5,5,5},
|
||||
{0,1,1,1,9,9,9,1,1,1,0},
|
||||
{0,0,1,1,2,9,2,1,1,0,0},
|
||||
{0,0,0,1,2,2,2,1,0,0,0},
|
||||
{0,0,0,0,2,2,2,0,0,0,0},
|
||||
},
|
||||
{
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,1,1,1,1,1,1,1,0,0},
|
||||
{0,1,1,1,1,1,1,1,1,1,0},
|
||||
{1,1,1,1,1,1,1,1,1,1,1},
|
||||
{1,1,1,1,1,1,1,1,1,1,1},
|
||||
{1,1,1,1,1,1,1,1,1,1,1},
|
||||
{0,1,1,1,1,1,1,1,1,1,0},
|
||||
{0,0,1,1,1,1,1,1,1,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
},
|
||||
{
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,1,1,1,1,1,1,1,0,0},
|
||||
{0,1,1,1,1,1,1,1,1,1,0},
|
||||
{0,1,1,1,1,1,1,1,1,1,0},
|
||||
{0,1,1,1,1,1,1,1,1,1,0},
|
||||
{0,0,1,1,1,1,1,1,1,0,0},
|
||||
{0,0,0,1,1,1,1,1,0,0,0},
|
||||
{0,0,0,0,1,1,1,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
}
|
||||
};
|
||||
|
||||
public static void generate(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
int orientation = rand.nextInt(4) + 2;
|
||||
|
||||
for(int i = 0; i < 11; i++) {
|
||||
for(int j = 0; j < 7; j++) {
|
||||
for(int k = 0; k < 11; k++) {
|
||||
|
||||
int block = schematic[6 - j][i][k];
|
||||
|
||||
if(block == 1 || (block != orientation && block > 1 && block < 6)) {
|
||||
world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base);
|
||||
}
|
||||
if(block == 9) {
|
||||
world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner);
|
||||
}
|
||||
}
|
||||
@ -568,7 +568,8 @@ public class CivilianFeatures {
|
||||
this.fillWithBlocks(world, box, sizeX - 4, 3, sizeZ - 2, sizeX - 2, 3, sizeZ - 2, ModBlocks.steel_roof, Blocks.air, false);
|
||||
if(!hasPlacedLoot[1]) {
|
||||
this.hasPlacedLoot[1] = this.generateInvContents(world, box, rand, ModBlocks.crate_iron, sizeX - 2, 1, 3, HbmChestContents.nukeTrash, 9);
|
||||
generateLoreBook(world, box, rand, sizeX - 2, 1, 3, 1, HbmChestContents.books_office_sch);
|
||||
if(rand.nextInt(2) == 0)
|
||||
generateLoreBook(world, box, sizeX - 2, 1, 3, 1, HbmChestContents.generateOfficeBook(rand));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -8,9 +8,8 @@ import com.hbm.blocks.generic.BlockBobble.BobbleType;
|
||||
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
|
||||
import com.hbm.config.StructureConfig;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWeb;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -267,7 +266,7 @@ abstract public class Component extends StructureComponent {
|
||||
case 2: //North
|
||||
dirMeta ^= 2; break; //Flip second bit
|
||||
case 3: //East
|
||||
dirMeta = Math.abs(dirMeta - 1) % 4; break; //fuck you modulo
|
||||
dirMeta = (dirMeta + 3) % 4; break; //fuck you modulo
|
||||
}
|
||||
|
||||
//hee hoo
|
||||
@ -383,7 +382,7 @@ abstract public class Component extends StructureComponent {
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks
|
||||
if(!box.isVecInside(posX, posY, posZ) || world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks
|
||||
return true;
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box);
|
||||
@ -414,7 +413,7 @@ abstract public class Component extends StructureComponent {
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks
|
||||
if(!box.isVecInside(posX, posY, posZ) || world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks
|
||||
return false;
|
||||
|
||||
this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box);
|
||||
@ -435,19 +434,17 @@ abstract public class Component extends StructureComponent {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void generateLoreBook(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ, int slot, BookLoreType[] books) {
|
||||
protected void generateLoreBook(World world, StructureBoundingBox box, int featureX, int featureY, int featureZ, int slot, ItemStack stack) { //kept for compat
|
||||
int posX = this.getXWithOffset(featureX, featureZ);
|
||||
int posY = this.getYWithOffset(featureY);
|
||||
int posZ = this.getZWithOffset(featureX, featureZ);
|
||||
|
||||
if(!box.isVecInside(posX, posY, posZ)) return;
|
||||
|
||||
IInventory inventory = (IInventory) world.getTileEntity(posX, posY, posZ);
|
||||
|
||||
if(inventory != null) {
|
||||
ItemStack book = new ItemStack(ModItems.book_lore);
|
||||
int i = rand.nextInt(books.length);
|
||||
|
||||
BookLoreType.setTypeForStack(book, books[i]);
|
||||
inventory.setInventorySlotContents(slot, book);
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ public class OfficeFeatures {
|
||||
randomlyFillWithBlocks(world, box, rand, 0.25F, 10, 3, 7, sizeX - 1, 3, sizeZ - 1, Blocks.web);
|
||||
//Doors
|
||||
placeDoor(world, box, ModBlocks.door_office, 3, false, rand.nextBoolean(), 2, 1, 7);
|
||||
placeDoor(world, box, ModBlocks.door_office, 3, false, rand.nextBoolean(), 3, 1, 7);
|
||||
placeDoor(world, box, ModBlocks.door_office, 3, true, rand.nextBoolean(), 3, 1, 7);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, false, rand.nextBoolean(), 5, 1, 6);
|
||||
|
||||
//Woot
|
||||
@ -209,7 +209,8 @@ public class OfficeFeatures {
|
||||
this.hasPlacedLoot[0] = generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 8);
|
||||
if(!this.hasPlacedLoot[1]) {
|
||||
this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(3), 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D);
|
||||
generateLoreBook(world, box, rand, 6, 1, 1, 7, HbmChestContents.books_office_sch);
|
||||
if(rand.nextInt(2) == 0)
|
||||
generateLoreBook(world, box, 6, 1, 1, 7, HbmChestContents.generateOfficeBook(rand));
|
||||
}
|
||||
|
||||
//0b00/0 West, 0b01/1 East, 0b10/2 North, 0b11/3 South, 0b100/4 West UD, 0b101 East UD, 0b110 North UD, 0b111 South UD
|
||||
@ -431,12 +432,12 @@ public class OfficeFeatures {
|
||||
placeDoor(world, box, Blocks.wooden_door, 3, true, rand.nextBoolean(), 2, 1, 14);
|
||||
placeDoor(world, box, Blocks.wooden_door, 0, false, rand.nextBoolean(), 0, 1, 12);
|
||||
placeDoor(world, box, Blocks.wooden_door, 0, true, rand.nextBoolean(), 0, 1, 13);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, false, rand.nextBoolean(), 6, 1, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, false, rand.nextBoolean(), 5, 5, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 3, false, rand.nextBoolean(), 6, 1, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 3, false, rand.nextBoolean(), 5, 5, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 2, false, rand.nextBoolean(), 4, 5, 11);
|
||||
placeDoor(world, box, ModBlocks.door_office, 0, false, rand.nextBoolean(), 10, 9, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 3, false, rand.nextBoolean(), 10, 9, 3);
|
||||
placeDoor(world, box, ModBlocks.door_office, 1, false, rand.nextBoolean(), 3, 9, 10);
|
||||
placeDoor(world, box, ModBlocks.door_metal, 0, false, rand.nextBoolean(), 5, 13, 3);
|
||||
placeDoor(world, box, ModBlocks.door_metal, 3, false, rand.nextBoolean(), 5, 13, 3);
|
||||
//Furniture
|
||||
//Floor 1
|
||||
int NorthStairMeta = getStairMeta(2);
|
||||
@ -533,7 +534,8 @@ public class OfficeFeatures {
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 5, HbmChestContents.filingCabinet, 4);
|
||||
|
||||
generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(2), 1, 9, 13, HbmChestContents.officeTrash, 10, 1.0D);
|
||||
generateLoreBook(world, box, rand, 1, 9, 13, 7, HbmChestContents.books_office_sch);
|
||||
if(rand.nextInt(2) == 0)
|
||||
generateLoreBook(world, box, 1, 9, 13, 7, HbmChestContents.generateOfficeBook(rand));
|
||||
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 13, HbmChestContents.filingCabinet, 4);
|
||||
generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 9, 13, HbmChestContents.filingCabinet, 4);
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.world.generator.room;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.crafting.handlers.MKUCraftingHandler;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.items.special.ItemBookLore;
|
||||
import com.hbm.tileentity.machine.storage.TileEntitySafe;
|
||||
import com.hbm.world.generator.CellularDungeon;
|
||||
import com.hbm.world.generator.CellularDungeonRoom;
|
||||
@ -53,7 +53,7 @@ public class TestDungeonRoom8 extends CellularDungeonRoom {
|
||||
if(r == 0)
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, new ItemStack(ModItems.book_of_));
|
||||
else if(r < 4)
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, generateMKU(world));
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, generateBook(world));
|
||||
else
|
||||
((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, new ItemStack(Items.book));
|
||||
}
|
||||
@ -61,57 +61,51 @@ public class TestDungeonRoom8 extends CellularDungeonRoom {
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack generateMKU(World world) {
|
||||
ItemStack book = new ItemStack(ModItems.book_lore);
|
||||
int i = world.rand.nextInt(books.length);
|
||||
|
||||
BookLoreType.setTypeForStack(book, books[i]);
|
||||
book.stackTagCompound.setInteger("mku_slot", getSlot(world, books[i]));
|
||||
|
||||
return book;
|
||||
}
|
||||
|
||||
public static int getSlot(World world, BookLoreType type) {
|
||||
|
||||
public static ItemStack generateBook(World world) {
|
||||
MKUCraftingHandler.generateRecipe(world);
|
||||
ItemStack[] recipe = MKUCraftingHandler.MKURecipe;
|
||||
|
||||
if(recipe == null) return new ItemStack(ModItems.flame_pony);
|
||||
|
||||
String key;
|
||||
int pages;
|
||||
Item item;
|
||||
//fucking kill me
|
||||
switch(type) {
|
||||
case BOOK_DUST:
|
||||
item = ModItems.dust; break;
|
||||
case BOOK_FLOWER:
|
||||
item = ModItems.morning_glory; break;
|
||||
case BOOK_IODINE:
|
||||
switch(world.rand.nextInt(6)) {
|
||||
case 0:
|
||||
key = "book_iodine"; pages = 3;
|
||||
item = ModItems.powder_iodine; break;
|
||||
case BOOK_MERCURY:
|
||||
item = ModItems.ingot_mercury; break;
|
||||
case BOOK_PHOSPHOROUS:
|
||||
case 1:
|
||||
key = "book_phosphorous"; pages = 2;
|
||||
item = ModItems.powder_fire; break;
|
||||
case BOOK_SYRINGE:
|
||||
case 2:
|
||||
key = "book_dust"; pages = 3;
|
||||
item = ModItems.dust; break;
|
||||
case 3:
|
||||
key = "book_mercury"; pages = 2;
|
||||
item = ModItems.ingot_mercury; break;
|
||||
case 4:
|
||||
key = "book_flower"; pages = 2;
|
||||
item = ModItems.morning_glory; break;
|
||||
case 5:
|
||||
key = "book_syringe"; pages = 2;
|
||||
item = ModItems.syringe_metal_empty; break;
|
||||
default:
|
||||
item = ModItems.nothing; break;
|
||||
return new ItemStack(ModItems.flame_pony);
|
||||
}
|
||||
|
||||
if(recipe == null) //take no chances
|
||||
return -2;
|
||||
|
||||
int s = 1;
|
||||
for(int i = 0; i < 9; i++) {
|
||||
|
||||
if(recipe[i] != null && recipe[i].getItem() == item) {
|
||||
return i + 1;
|
||||
s = i + 1; break;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
ItemStack book = ItemBookLore.createBook(key, pages, 0x271E44, 0xFBFFF4);
|
||||
ItemBookLore.addArgs(book, pages - 1, String.valueOf(s));
|
||||
|
||||
return book;
|
||||
}
|
||||
|
||||
private final static BookLoreType[] books = new BookLoreType[] {
|
||||
BookLoreType.BOOK_IODINE, BookLoreType.BOOK_PHOSPHOROUS, BookLoreType.BOOK_DUST, BookLoreType.BOOK_MERCURY, BookLoreType.BOOK_FLOWER, BookLoreType.BOOK_SYRINGE
|
||||
};
|
||||
|
||||
/*public static ItemStack genetateMKU(World world) {
|
||||
|
||||
ItemStack book = new ItemStack(Items.written_book);
|
||||
|
||||
@ -505,6 +505,14 @@ digamma.title=DIGAMMA-DIAGNOSEGERÄT
|
||||
entity.entity_cyber_crab.name=Cyber-Krabbe
|
||||
entity.entity_elder_one.name=Quackos der Älteste
|
||||
entity.entity_fucc_a_ducc.name=Ente
|
||||
entity.entity_glyphid.name=Glyphid
|
||||
entity.entity_glyphid_behemoth.name=Glyphid-Behemoth
|
||||
entity.entity_glyphid_blaster.name=Glyphid-Blaster
|
||||
entity.entity_glyphid_bombardier.name=Glyphid-Bombardierer
|
||||
entity.entity_glyphid_brawler.name=Glyphid-Schläger
|
||||
entity.entity_glyphid_brenda.name=Brenda
|
||||
entity.entity_glyphid_nuclear.name=Der dicke Johnson
|
||||
entity.entity_glyphid_scout.name=Glyphid-Späher
|
||||
entity.entity_ntm_fbi.name=FBI Agent
|
||||
entity.entity_ntm_radiation_blaze.name=Kernschmelze-Elementar
|
||||
entity.hbm.entity_ntm_ufo.name=Marsianisches Invasionsschiff
|
||||
@ -1152,6 +1160,7 @@ item.battery_steam_large.name=Großer dampfbetriebener Energiespeichertank
|
||||
item.battery_su.name=Einwegbatterie
|
||||
item.battery_su_l.name=Große Einwegbatterie
|
||||
item.battery_trixite.name=Billige Spark-Batterie-Nachmache
|
||||
item.bdcl.name=BDCL
|
||||
item.beta.name=Beta-Features
|
||||
item.big_sword.name=Großes Schwert
|
||||
item.billet_am_mix.name=Reaktorfähiges Americiumbillet
|
||||
@ -3804,6 +3813,7 @@ tile.furnace_steel.name=Stahlofen
|
||||
tile.furnace_steel.desc=Sehr großer Ofen mit Produktionsboni.$Benötigt externe Hitzequelle.$Wärmetransferrate: ΔT*0.05 TU/t$(Δ heißt Differenz, T heißt Temparatur)
|
||||
tile.fusion_center.name=Zentralmagnetstück
|
||||
tile.fusion_conductor.name=Supraleiter-Magnet
|
||||
tile.fusion_conductor_welded.name=Supraleiter-Magnet (Verschweißt)
|
||||
tile.fusion_core.name=Fusionsreaktorsteuerung
|
||||
tile.fusion_hatch.name=Fusionsreaktorzugriffsluke
|
||||
tile.fusion_heater.name=Plasmaerhitzer-Komponente
|
||||
@ -3835,6 +3845,8 @@ tile.glass_polonium.name=Poloniumglas
|
||||
tile.glass_quartz.name=Quarzglas
|
||||
tile.glass_trinitite.name=Trinity-Glas
|
||||
tile.glass_uranium.name=Uranglas
|
||||
tile.glyphid_base.name=Glyphidnest
|
||||
tile.glyphid_spawner.name=Glyphidnest-Spawner
|
||||
tile.gneiss_brick.name=Schieferziegel
|
||||
tile.gneiss_chiseled.name=Gemeißelter Schiefer
|
||||
tile.gneiss_tile.name=Schieferfliese
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user