| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package chylex.hee.block; | ||
| import java.util.ArrayList; | ||
| import net.minecraft.block.BlockOre; | ||
| import net.minecraft.enchantment.EnchantmentHelper; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.stats.StatList; | ||
| import net.minecraft.world.World; | ||
| import net.minecraftforge.event.ForgeEventFactory; | ||
|
|
||
| public abstract class BlockAbstractOre extends BlockOre{ | ||
| protected BlockAbstractOre(){} | ||
|
|
||
| @Override | ||
| public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta){ | ||
| player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)],1); | ||
| player.addExhaustion(0.025F); | ||
|
|
||
| if (canSilkHarvest(world,player,x,y,z,meta) && EnchantmentHelper.getSilkTouchModifier(player)){ | ||
| ArrayList<ItemStack> items = new ArrayList<>(); | ||
|
|
||
| ItemStack is = createStackedBlock(meta); | ||
| if (is != null)items.add(is); | ||
|
|
||
| ForgeEventFactory.fireBlockHarvesting(items,world,this,x,y,z,meta,0,1F,true,player); | ||
| for(ItemStack item:items)dropBlockAsItem(world,x,y,z,item); | ||
| } | ||
| else{ | ||
| int fortune = EnchantmentHelper.getFortuneModifier(player); | ||
| ArrayList<ItemStack> items = getDrops(world,x,y,z,meta,fortune); | ||
|
|
||
| onOreMined(player,items,x,y,z,meta,fortune); | ||
| for(ItemStack item:items)dropBlockAsItem(world,x,y,z,item); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Triggers when the ore is mined without Silk Touch. | ||
| */ | ||
| protected abstract void onOreMined(EntityPlayer player, ArrayList<ItemStack> drops, int x, int y, int z, int meta, int fortune); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.MovingObjectPosition; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.world.structure.island.biome.IslandBiomeBase; | ||
|
|
||
| public class BlockBiomeIslandCore extends Block{ | ||
| public BlockBiomeIslandCore(){ | ||
| super(Material.rock); | ||
| disableStats(); | ||
| } | ||
|
|
||
| @Override | ||
| public int tickRate(World world){ | ||
| return 4; | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockAdded(World world, int x, int y, int z){ | ||
| super.onBlockAdded(world,x,y,z); | ||
| world.scheduleBlockUpdate(x,y,z,this,tickRate(world)); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| world.scheduleBlockUpdate(x,y,z,this,tickRate(world)); | ||
|
|
||
| int meta = world.getBlockMetadata(x,y,z); | ||
|
|
||
| for(IslandBiomeBase biome:IslandBiomeBase.biomeList){ | ||
| if (biome.biomeID == meta){ | ||
| biome.updateCore(world,x,y,z); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){ | ||
| return null; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.Entity; | ||
| import net.minecraft.entity.EntityLivingBase; | ||
| import net.minecraft.entity.boss.IBossDisplayData; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.stats.StatList; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.DamageSource; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.HardcoreEnderExpansion; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockCorruptedEnergy extends Block{ | ||
| private static final Material corruptedEnergy = new MaterialCorruptedEnergy(); | ||
|
|
||
| private static final byte[] offsetX = new byte[]{ -1, 1, 0, 0, 0, 0 }, | ||
| offsetY = new byte[]{ 0, 0, -1, 1, 0, 0 }, | ||
| offsetZ = new byte[]{ 0, 0, 0, 0, -1, 1 }; | ||
|
|
||
| private boolean isHighLevel; | ||
|
|
||
| public BlockCorruptedEnergy(boolean isHighLevel){ | ||
| super(corruptedEnergy); | ||
| setTickRandomly(true); | ||
| this.isHighLevel = isHighLevel; | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockAdded(World world, int x, int y, int z){ | ||
| world.scheduleBlockUpdate(x,y,z,this,tickRate(world)); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| if (world.isRemote){ | ||
| for(int a = 0; a < 3; a++){ | ||
| HardcoreEnderExpansion.fx.corruptedEnergy(world,x,y,z); | ||
| HardcoreEnderExpansion.fx.enderGoo(world,x,y,z); | ||
| } | ||
| if (world.rand.nextInt(5) == 0)world.spawnParticle("explode",x+0.5D,y+0.5D,z+0.5D,rand.nextDouble()-0.5D,rand.nextDouble()-0.5D,rand.nextDouble()-0.5D); | ||
| return; | ||
| } | ||
|
|
||
| int meta = world.getBlockMetadata(x,y,z); | ||
|
|
||
| if (meta > 1){ | ||
| for(int a = 0; a < 6; a++){ | ||
| if (rand.nextInt(3) == 0){ | ||
| Block block = world.getBlock(x+offsetX[a],y+offsetY[a],z+offsetZ[a]); | ||
| if (block.getMaterial() == Material.air)world.setBlock(x+offsetX[a],y+offsetY[a],z+offsetZ[a],this,meta-1,3); | ||
| else if (!block.isOpaqueCube() && world.getBlock(x+offsetX[a]*2,y+offsetY[a]*2,z+offsetZ[a]*2).getMaterial() == Material.air){ | ||
| world.setBlock(x+offsetX[a]*2,y+offsetY[a]*2,z+offsetZ[a]*2,this,meta-1,3); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (world.rand.nextInt(7) <= 3 || world.rand.nextBoolean()){ | ||
| if (meta == 1){ | ||
| if (isHighLevel)world.setBlock(x,y,z,BlockList.corrupted_energy_low,15,3); | ||
| else world.setBlockToAir(x,y,z); | ||
| return; | ||
| } | ||
| else world.setBlockMetadataWithNotify(x,y,z,meta-1,3); | ||
| } | ||
|
|
||
| world.scheduleBlockUpdate(x,y,z,this,tickRate(world)); | ||
| } | ||
|
|
||
| @Override | ||
| public int tickRate(World world){ | ||
| return 7; | ||
| } | ||
|
|
||
| @Override | ||
| public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ | ||
| if (entity instanceof EntityLivingBase && !(entity instanceof IBossDisplayData)){ | ||
| EntityLivingBase living = (EntityLivingBase)entity; | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
|
|
||
| if (world.rand.nextInt(meta >= 10 ? 3 : (meta >= 5 ? 4 : 5)) == 0 && (living.hurtTime <= 3 || world.rand.nextInt(7) == 0) && living.getHealth() > 0F){ | ||
| if (entity instanceof EntityPlayer){ | ||
| EntityPlayer player = (EntityPlayer)entity; | ||
| if (player.capabilities.isCreativeMode && player.getHealth() <= 1F)return; | ||
| player.addStat(StatList.damageTakenStat,Math.round(10F)); | ||
| } | ||
|
|
||
| living.prevHealth = living.getHealth(); | ||
| living.setHealth(living.getHealth()-1F); | ||
| living.func_110142_aN().func_94547_a(DamageSource.magic,living.prevHealth,1F); // OBFUSCATED combat tracker, second method | ||
| living.hurtTime = 10; | ||
|
|
||
| if (living.getHealth() <= 0F)living.onDeath(DamageSource.magic); | ||
| } | ||
|
|
||
| living.attackEntityFrom(DamageSource.generic,1.5F); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| protected ItemStack createStackedBlock(int meta){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public int getRenderType(){ | ||
| return -1; | ||
| } | ||
|
|
||
| @Override | ||
| public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOpaqueCube(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean canCollideCheck(int meta, boolean holdingBoat){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){} | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void randomDisplayTick(World world, int x, int y, int z, Random rand){ | ||
| if (world.rand.nextBoolean())HardcoreEnderExpansion.fx.corruptedEnergy(world,x,y,z); | ||
| if (world.rand.nextBoolean())HardcoreEnderExpansion.fx.enderGoo(world,x,y,z); | ||
| if (world.rand.nextInt(30) == 0)world.spawnParticle("explode",x+0.5D,y+0.5D,z+0.5D,rand.nextDouble()-0.5D,rand.nextDouble()-0.5D,rand.nextDouble()-0.5D); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| package chylex.hee.block; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockFlower; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.creativetab.CreativeTabs; | ||
| import net.minecraft.entity.Entity; | ||
| import net.minecraft.entity.EntityLivingBase; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.potion.Potion; | ||
| import net.minecraft.potion.PotionEffect; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.DamageSource; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.IBlockAccess; | ||
| import net.minecraft.world.World; | ||
| import net.minecraftforge.common.IShearable; | ||
| import net.minecraftforge.common.util.ForgeDirection; | ||
| import chylex.hee.item.block.ItemBlockWithSubtypes.IBlockSubtypes; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockCrossedDecoration extends BlockFlower implements IShearable, IBlockSubtypes{ | ||
| private static final String[] decorTypes = new String[]{ | ||
| "decor_bullrush_bottom", "decor_bullrush_top", "decor_thorn_bush", "decor_infested_grass", "decor_infested_fern", "decor_infested_tallgrass", | ||
| "decor_lily_fire" | ||
| }; | ||
|
|
||
| public static final byte dataThornBush = 2, dataInfestedGrass = 3, dataInfestedFern = 4, dataInfestedTallgrass = 5, | ||
| dataLilyFire = 6; | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| private IIcon[] iconArray; | ||
|
|
||
| public BlockCrossedDecoration(){ | ||
| super(0); | ||
| setBlockBounds(0.1F,0.0F,0.1F,0.9F,0.8F,0.9F); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean canBlockStay(World world, int x, int y, int z){ | ||
| Block soil = world.getBlock(x,y-1,z); | ||
| return (world.getFullBlockLightValue(x,y,z) >= 8 || world.canBlockSeeTheSky(x,y,z) || world.provider.dimensionId == 1)&& | ||
| (soil != null && soil.canSustainPlant(world,x,y-1,z,ForgeDirection.UP,this)); | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean canPlaceBlockOn(Block block){ | ||
| return block == Blocks.end_stone || block == BlockList.end_terrain || super.canPlaceBlockOn(block); | ||
| } | ||
|
|
||
| @Override | ||
| public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta){ | ||
| super.harvestBlock(world,player,x,y,z,meta); | ||
|
|
||
| if (meta == dataLilyFire)KnowledgeRegistrations.LILYFIRE.tryUnlockFragment(player,1F); | ||
| } | ||
|
|
||
| @Override | ||
| public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune){ | ||
| ArrayList<ItemStack> ret = new ArrayList<>(); | ||
|
|
||
| if (meta == dataLilyFire)ret.add(new ItemStack(this,1,meta)); | ||
|
|
||
| return ret; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
|
|
||
| if (meta == dataLilyFire)return AxisAlignedBB.getBoundingBox(x+0.3F,y,z+0.3F,x+0.7F,y+0.8F,z+0.7F); | ||
| else return super.getSelectedBoundingBoxFromPool(world,x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
| return meta != dataLilyFire; | ||
| } | ||
|
|
||
| @Override | ||
| public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune){ | ||
| ArrayList<ItemStack> ret = new ArrayList<>(); | ||
| ret.add(new ItemStack(this,1,world.getBlockMetadata(x,y,z))); | ||
| return ret; | ||
| } | ||
|
|
||
| @Override | ||
| public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ | ||
| if (world.getBlockMetadata(x,y,z) == dataThornBush){ | ||
| entity.attackEntityFrom(DamageSource.generic,1F); | ||
| if (world.rand.nextInt(80) == 0 && entity instanceof EntityLivingBase){ | ||
| ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.poison.id,30+world.rand.nextInt(40),1,true)); | ||
| } | ||
|
|
||
| if (world.rand.nextInt(66) == 0){ | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(entity,8D))KnowledgeRegistrations.INFESTED_FOREST_BIOME.tryUnlockFragment(observer,0.3F,new short[]{ 1 }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String getUnlocalizedName(ItemStack is){ | ||
| switch(is.getItemDamage()){ | ||
| case BlockCrossedDecoration.dataThornBush: return "tile.crossedDecoration.thornyBush"; | ||
| case BlockCrossedDecoration.dataInfestedFern: return "tile.crossedDecoration.infestedFern"; | ||
| case BlockCrossedDecoration.dataInfestedGrass: return "tile.crossedDecoration.infestedBush"; | ||
| case BlockCrossedDecoration.dataInfestedTallgrass: return "tile.crossedDecoration.infestedGrass"; | ||
| case BlockCrossedDecoration.dataLilyFire: return "tile.crossedDecoration.lilyfire"; | ||
| default: return ""; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return iconArray[meta < decorTypes.length ? meta : 0]; | ||
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| for(int a = 2; a < decorTypes.length; a++){ | ||
| list.add(new ItemStack(item,1,a)); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| iconArray = new IIcon[decorTypes.length]; | ||
|
|
||
| for(int a = 2; a < decorTypes.length; ++a){ | ||
| iconArray[a] = iconRegister.registerIcon("hardcoreenderexpansion:"+decorTypes[a]); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package chylex.hee.block; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockMobSpawner; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.tileentity.TileEntityCustomSpawner; | ||
|
|
||
| public class BlockCustomSpawner extends BlockMobSpawner{ | ||
| public BlockCustomSpawner(){ | ||
| super(); | ||
| disableStats(); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createTileEntity(World world, int metadata){ | ||
| return new TileEntityCustomSpawner().setLogicId(metadata); | ||
| } | ||
|
|
||
| @Override | ||
| public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta){ | ||
| if (!world.isRemote){ | ||
| TileEntityCustomSpawner spawner = (TileEntityCustomSpawner)world.getTileEntity(x,y,z); | ||
| if (spawner != null)spawner.getSpawnerLogic().onBlockBreak(); | ||
| } | ||
|
|
||
| super.breakBlock(world,x,y,z,oldBlock,oldMeta); | ||
| } | ||
|
|
||
| @Override | ||
| public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta){ | ||
| super.harvestBlock(world,player,x,y,z,meta); | ||
|
|
||
| if (meta == 0){ | ||
| KnowledgeRegistrations.DUNGEON_TOWER.tryUnlockFragment(player,0.1F,new short[]{ 0,1,2,3 }); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package chylex.hee.block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.HardcoreEnderExpansion; | ||
| import chylex.hee.tileentity.TileEntityDecompositionTable; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockDecompositionTable extends BlockAbstractInventory{ | ||
| @SideOnly(Side.CLIENT) | ||
| private IIcon iconTop, iconSide, iconBottom; | ||
|
|
||
| public BlockDecompositionTable(){ | ||
| super(Material.rock); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityDecompositionTable(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| player.openGui(HardcoreEnderExpansion.instance,2,world,x,y,z); | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return side == 0 ? iconBottom : side == 1 ? iconTop : iconSide; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| iconTop = iconRegister.registerIcon("hardcoreenderexpansion:decomposition_table_top"); | ||
| iconSide = iconRegister.registerIcon("hardcoreenderexpansion:decomposition_table_side"); | ||
| iconBottom = iconRegister.registerIcon("hardcoreenderexpansion:decomposition_table_bottom"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockDragonEgg; | ||
| import net.minecraft.block.BlockFalling; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.EnumAction; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.entity.block.EntityBlockFallingDragonEgg; | ||
| import chylex.hee.entity.block.EntityBlockTempleDragonEgg; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
| import chylex.hee.packets.PacketPipeline; | ||
| import chylex.hee.packets.client.C20ParticleDragonEggTeleportation; | ||
| import chylex.hee.system.achievements.AchievementManager; | ||
| import chylex.hee.system.savedata.ServerSavefile; | ||
| import chylex.hee.world.biome.BiomeDecoratorHardcoreEnd; | ||
|
|
||
| public class BlockDragonEggCustom extends BlockDragonEgg{ | ||
| public BlockDragonEggCustom(){ | ||
| super(); | ||
| setHardness(1000F).setResistance(2000F).setStepSound(Block.soundTypeStone).setLightLevel(0.125F).setBlockName("dragonEgg").setBlockTextureName("dragon_egg"); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| fallIfPossible(world,x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockAdded(World world, int x, int y, int z){ | ||
| if (x == 9 && z == 6 && y == 249 && world.provider.dimensionId == 1 && !world.isRemote){ | ||
| ServerSavefile save = BiomeDecoratorHardcoreEnd.getCache(world); | ||
| List<String> playersInTemple = save.getPlayersInTemple(); | ||
| if (playersInTemple.size() > 0){ | ||
| save.setPreventTempleDestruction(true); | ||
| for(Object o:world.playerEntities){ | ||
| EntityPlayer player = (EntityPlayer)o; | ||
| if (playersInTemple.contains(player.getCommandSenderName()))player.addStat(AchievementManager.REBIRTH,1); | ||
| } | ||
|
|
||
| world.spawnEntityInWorld(new EntityBlockTempleDragonEgg(world,x+0.5D,y+0.5D,z+0.5D)); | ||
| } | ||
| } | ||
| else super.onBlockAdded(world,x,y,z); | ||
| } | ||
|
|
||
| private void fallIfPossible(World world, int x, int y, int z){ | ||
| if (BlockFalling.func_149831_e(world,x,y-1,z) && y >= 0){ // OBFUSCATED can fall? | ||
| byte checkRange = 32; | ||
|
|
||
| if (!BlockFalling.fallInstantly && world.checkChunksExist(x-checkRange,y-checkRange,z-checkRange,x+checkRange,y+checkRange,z+checkRange)){ | ||
| world.spawnEntityInWorld(new EntityBlockFallingDragonEgg(world,x+0.5F,y+0.5F,z+0.5F)); | ||
| } | ||
| else{ | ||
| world.setBlockToAir(x,y,z); | ||
| while(BlockFalling.func_149831_e(world,x,y-1,z) && y > 0)--y; | ||
| if (y > 0)world.setBlock(x,y,z,this,0,2); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player){ | ||
| if (player != null && player.isSneaking() && player.getHeldItem() != null && | ||
| player.getHeldItem().getItemUseAction() == EnumAction.block){ | ||
| world.setBlockToAir(x,y,z); | ||
| dropBlockAsItem(world,x,y,z,new ItemStack(Blocks.dragon_egg)); | ||
| } | ||
| else teleportNearby(world,x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| teleportNearby(world,x,y,z); | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune){ | ||
| teleportNearby(world,x,y,z); | ||
| } | ||
|
|
||
| // COPIED FROM BlockDragonEgg, tweaked (a lot) | ||
| private void teleportNearby(World world, int x, int y, int z){ | ||
| if (world.getBlock(x,y,z) == this && !world.isRemote){ | ||
| for(int attempt = 0,xx,yy,zz; attempt < 1000; ++attempt){ | ||
| xx = x+world.rand.nextInt(16)-world.rand.nextInt(16); | ||
| yy = y+world.rand.nextInt(8)-world.rand.nextInt(8); | ||
| zz = z+world.rand.nextInt(16)-world.rand.nextInt(16); | ||
|
|
||
| if (world.getBlock(xx,yy,zz).getMaterial() == Material.air){ | ||
| world.setBlock(xx,yy,zz,this,world.getBlockMetadata(x,y,z),2); | ||
| world.setBlockToAir(x,y,z); | ||
|
|
||
| PacketPipeline.sendToAllAround(world.provider.dimensionId,x,y,z,76D,new C20ParticleDragonEggTeleportation(x,y,z,xx,yy,zz)); | ||
|
|
||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,12D))KnowledgeRegistrations.ENDER_DRAGON.tryUnlockFragment(observer,0.25F,new short[]{ 16,17 }); | ||
|
|
||
| return; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.creativetab.CreativeTabs; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.util.MovingObjectPosition; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.entity.boss.EntityMiniBossFireFiend; | ||
| import chylex.hee.item.block.ItemBlockWithSubtypes.IBlockSubtypes; | ||
| import chylex.hee.packets.PacketPipeline; | ||
| import chylex.hee.packets.client.C21ParticleIgneousRockFlame; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockDungeonPuzzle extends Block implements IBlockSubtypes{ | ||
| private static final Material dungeonPuzzle = new MaterialDungeonPuzzle(); | ||
|
|
||
| public static final byte metaUnlit = 0, metaLit = 1, metaWall = 2, metaWallRock = 11, metaWallLit = 12, | ||
| metaSpreadingLitN = 3, metaSpreadingLitS = 4, | ||
| metaSpreadingLitE = 5, metaSpreadingLitW = 6, | ||
| metaSpreadingUnlitN = 7, metaSpreadingUnlitS = 8, | ||
| metaSpreadingUnlitE = 9, metaSpreadingUnlitW = 10, | ||
| dungeonSize = 9; | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| private IIcon[] iconArray; | ||
|
|
||
| public BlockDungeonPuzzle(){ | ||
| super(dungeonPuzzle); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
| byte[] offset = meta == metaSpreadingLitN || meta == metaSpreadingUnlitN ? new byte[]{ 0, -1 } : | ||
| meta == metaSpreadingLitS || meta == metaSpreadingUnlitS ? new byte[]{ 0, 1 } : | ||
| meta == metaSpreadingLitE || meta == metaSpreadingUnlitE ? new byte[]{ 1, 0 } : | ||
| meta == metaSpreadingLitW || meta == metaSpreadingUnlitW ? new byte[]{ -1, 0 } : | ||
| null; | ||
| if (offset == null)return; | ||
|
|
||
| // update nearby | ||
|
|
||
| int tx = x+offset[0],tz = z+offset[1]; | ||
| int targMeta = world.getBlockMetadata(tx,y,tz); | ||
|
|
||
| if (world.getBlock(tx,y,tz) == this){ | ||
| if (targMeta == metaWall){ | ||
| byte[] offx = new byte[]{ 0, 0, 1, -1 },offz = new byte[]{ -1, 1, 0, 0 }; | ||
|
|
||
| for(int a = 0,cmeta; a < 4; a++){ | ||
| if (world.getBlock(tx+offx[a],y,tz+offz[a]) != this)continue; | ||
| if ((cmeta = world.getBlockMetadata(tx+offx[a],y,tz+offz[a])) > metaLit)continue; | ||
| world.setBlockMetadataWithNotify(tx+offx[a],y,tz+offz[a],cmeta == metaUnlit?metaSpreadingLitN+a:metaSpreadingUnlitN+a,2); | ||
| world.scheduleBlockUpdate(tx+offx[a],y,tz+offz[a],this,8); | ||
|
|
||
| PacketPipeline.sendToAllAround(world.provider.dimensionId,tx+offx[a]+0.5D,y+0.5D,tz+offz[a]+0.5D,64D,new C21ParticleIgneousRockFlame(tx+offx[a]+0.5D,y+0.5D,tz+offz[a]+0.5D)); | ||
| } | ||
| } | ||
| else{ | ||
| int finalMeta = targMeta == metaUnlit?(meta >= metaSpreadingUnlitN?meta-4:meta):targMeta == metaLit?(meta >= metaSpreadingUnlitN?meta:meta+4):-1; | ||
| if (finalMeta != -1){ | ||
| world.setBlockMetadataWithNotify(tx,y,tz,finalMeta,2); | ||
| world.scheduleBlockUpdate(tx,y,tz,this,8); | ||
| } | ||
| } | ||
|
|
||
| PacketPipeline.sendToAllAround(world.provider.dimensionId,tx+0.5D,y+0.5D,tz+0.5D,64D,new C21ParticleIgneousRockFlame(tx+0.5D,y+0.5D,tz+0.5D)); | ||
| } | ||
|
|
||
| // update me | ||
|
|
||
| world.setBlockMetadataWithNotify(x,y,z,meta >= metaSpreadingUnlitN ? metaUnlit : metaLit,2); | ||
|
|
||
| // test puzzle finished | ||
|
|
||
| int startX,startZ,cnt = 0; | ||
| boolean isFinished = true; | ||
|
|
||
| for(startX = x; true; --startX){ | ||
| if (world.getBlock(startX,y,z) != this)break; | ||
| } | ||
| for(startZ = z; true; --startZ){ | ||
| if (world.getBlock(x,y,startZ) != this)break; | ||
| } | ||
| ++startX; | ||
| ++startZ; | ||
|
|
||
| for(int xx = startX,testmeta; xx < startX+dungeonSize; xx++){ | ||
| for(int zz = startZ; zz < startZ+dungeonSize; zz++){ | ||
| if (world.getBlock(xx,y,zz) != this)continue; | ||
|
|
||
| ++cnt; | ||
| testmeta = world.getBlockMetadata(xx,y,zz); | ||
|
|
||
| if (testmeta != metaLit && testmeta != metaWall && testmeta != metaWallRock){ | ||
| isFinished = false; | ||
| xx += dungeonSize; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| int cx = startX+((dungeonSize-1)>>1),cz = startZ+((dungeonSize-1)>>1); | ||
|
|
||
| if (isFinished && cnt > 32 && world.getEntitiesWithinAABB(EntityMiniBossFireFiend.class,AxisAlignedBB.getBoundingBox(cx-4,y-8,cz-4,cx+4,y,cz+4)).size() == 0){ | ||
| EntityMiniBossFireFiend fireFiend = new EntityMiniBossFireFiend(world); | ||
| fireFiend.setLocationAndAngles(cx+0.5D,y-4D,cz+0.5D,rand.nextFloat()*360F,0F); | ||
| world.spawnEntityInWorld(fireFiend); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| protected ItemStack createStackedBlock(int meta){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
| if (meta >= metaSpreadingLitN && meta <= metaSpreadingLitW)meta = metaLit; | ||
| else if (meta >= metaSpreadingUnlitN && meta <= metaSpreadingUnlitW)meta = metaUnlit; | ||
|
|
||
| return new ItemStack(this,1,meta); | ||
| } | ||
|
|
||
| @Override | ||
| public String getUnlocalizedName(ItemStack is){ | ||
| switch(is.getItemDamage()){ | ||
| case BlockDungeonPuzzle.metaUnlit: return "tile.dungeonPuzzle.unlit"; | ||
| case BlockDungeonPuzzle.metaLit: return "tile.dungeonPuzzle.lit"; | ||
| case BlockDungeonPuzzle.metaWall: return "tile.dungeonPuzzle.wall"; | ||
| case BlockDungeonPuzzle.metaWallRock: return "tile.dungeonPuzzle.wallRock"; | ||
| case BlockDungeonPuzzle.metaWallLit: return "tile.dungeonPuzzle.wallLit"; | ||
| default: return ""; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return meta == metaLit || meta == metaWallLit || (meta >= metaSpreadingLitN && meta <= metaSpreadingLitW)?iconArray[1]:meta == metaWall?iconArray[2]:meta == metaWallRock?iconArray[3]:iconArray[0]; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| list.add(new ItemStack(item,1,metaUnlit)); | ||
| list.add(new ItemStack(item,1,metaLit)); | ||
| list.add(new ItemStack(item,1,metaWall)); | ||
| list.add(new ItemStack(item,1,metaWallRock)); | ||
| list.add(new ItemStack(item,1,metaWallLit)); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| iconArray = new IIcon[4]; | ||
| iconArray[0] = iconRegister.registerIcon("hardcoreenderexpansion:dungeon_puzzle_unlit"); | ||
| iconArray[1] = iconRegister.registerIcon("hardcoreenderexpansion:dungeon_puzzle_lit"); | ||
| iconArray[2] = iconRegister.registerIcon("hardcoreenderexpansion:dungeon_puzzle_wall"); | ||
| iconArray[3] = iconRegister.registerIcon("hardcoreenderexpansion:dungeon_puzzle_wall_rock"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,206 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockCrops; | ||
| import net.minecraft.block.BlockFlower; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.creativetab.CreativeTabs; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.entity.mob.EntityMobAngryEnderman; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEndFlower extends BlockFlower{ | ||
| private static int[] yOffsets = new int[]{ | ||
| 0,1,2,3,-2,-1 | ||
| }; | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| private IIcon iconDeadFlower; | ||
|
|
||
| protected BlockEndFlower(){ | ||
| super(0); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| super.updateTick(world,x,y,z,rand); | ||
| updateFlowerLogic(world,x,y,z,rand); | ||
| } | ||
|
|
||
| public void updateFlowerLogic(World world, int x, int y, int z, Random rand){ | ||
| if (world.provider.dimensionId != 1 && rand.nextInt(5) <= 1){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
|
|
||
| if (meta > 3 && meta < 15){ | ||
| List<?> nearbyEndermen = world.getEntitiesWithinAABB(EntityMobAngryEnderman.class,AxisAlignedBB.getBoundingBox(x-8D,y-2D,z-8D,x+8D,y+2D,z+8D)); | ||
| if (nearbyEndermen != null && nearbyEndermen.size() > meta)return; | ||
|
|
||
| for(int attempt = 0,spawned = 0; attempt < 30 && spawned<(meta/3)+rand.nextInt(meta/2); attempt++){ | ||
| int px = x+rand.nextInt(8)-4,pz = z+rand.nextInt(8)-4,py; | ||
| for(int a = 0; a < yOffsets.length; a++){ | ||
| py = y+yOffsets[a]; | ||
| if (!world.getBlock(px,py,pz).isOpaqueCube()){ | ||
| EntityMobAngryEnderman enderman = new EntityMobAngryEnderman(world); | ||
| enderman.setCanDespawn(false); | ||
| enderman.setPosition(px+rand.nextFloat(),py+0.01F,pz+rand.nextFloat()); | ||
| world.spawnEntityInWorld(enderman); | ||
|
|
||
| if (++spawned == 1){ | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(enderman,20D))KnowledgeRegistrations.DEATH_FLOWER.tryUnlockFragment(observer,0.7F,new short[]{ 0,1,2,3,4,6,7 }); | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (rand.nextInt(6) == 0){ | ||
| if (++meta == 15){ | ||
| for(int xx = x-8; xx <= x+8; xx++){ | ||
| for(int yy = y-8; yy <= y+8; yy++){ | ||
| for(int zz = z-8; zz <= z+8; zz++){ | ||
| if (xx == x && yy == y && zz == z || rand.nextFloat() < 0.2F)continue; | ||
| if (Math.sqrt(Math.pow(xx-x,2)+Math.pow(yy-y,2)+Math.pow(zz-z,2)) > 4D+rand.nextFloat()*3.8D)continue; | ||
|
|
||
| Block block = world.getBlock(xx,yy,zz); | ||
| if (block == Blocks.air){ | ||
| if (rand.nextInt(7) == 0)setBlock(world,xx,yy,zz,Blocks.web); | ||
| continue; | ||
| } | ||
|
|
||
| if (block == Blocks.grass && world.getBlock(xx,yy+1,zz) == Blocks.air)setBlock(world,xx,yy,zz,Blocks.mycelium); | ||
| else if (block == Blocks.stone)setBlock(world,xx,yy,zz,Blocks.cobblestone); | ||
| else if (block == Blocks.stonebrick)setMeta(world,xx,yy,zz,1); | ||
| else if (block == Blocks.sandstone)setBlock(world,xx,yy,zz,Blocks.sand); | ||
| else if (block == Blocks.cobblestone)setBlock(world,xx,yy,zz,Blocks.gravel); | ||
| else if (block == Blocks.sand)setBlock(world,xx,yy,zz,Blocks.soul_sand); | ||
| else if (block == Blocks.brick_block)setBlock(world,xx,yy,zz,Blocks.nether_brick); | ||
| else if (block == Blocks.fence)setBlock(world,xx,yy,zz,Blocks.nether_brick_fence); | ||
| else if (block == Blocks.torch)setBlock(world,xx,yy,zz,Blocks.redstone_torch); | ||
| else if (block == Blocks.wool || block == Blocks.carpet || block == Blocks.stained_hardened_clay)setMeta(world,xx,yy,zz,15); | ||
| else if (block == Blocks.quartz_block)setMeta(world,xx,yy,zz,1); | ||
| else if (block == Blocks.glass)setBlock(world,xx,yy,zz,Blocks.glass_pane); | ||
| else if (block instanceof BlockFlower)setBlock(world,xx,yy,zz,Blocks.deadbush); | ||
| else if (block instanceof BlockCrops)world.setBlockToAir(xx,yy,zz); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| for(int attempt = 0, xx, yy, zz; attempt < 400; attempt++){ | ||
| xx = x+rand.nextInt(16)-8; | ||
| yy = y+rand.nextInt(16)-8; | ||
| zz = z+rand.nextInt(16)-8; | ||
|
|
||
| if (world.isAirBlock(xx,yy,zz)){ | ||
| world.setBlock(xx,yy,zz,BlockList.energy_cluster); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| boolean spawned = false; | ||
|
|
||
| for(int a = 0; a < 6; a++){ | ||
| int xx = x+rand.nextInt(8)-4,zz = z+rand.nextInt(8)-4,yy; | ||
| for(int b = 0; b < yOffsets.length; b++){ | ||
| yy = y+yOffsets[b]; | ||
| if (!world.getBlock(xx,yy,zz).isOpaqueCube()){ | ||
| EntityMobAngryEnderman enderman = new EntityMobAngryEnderman(world); | ||
| enderman.setPosition(xx+rand.nextFloat(),yy+0.01F,zz+rand.nextFloat()); | ||
| enderman.setCanDespawn(false); | ||
| world.spawnEntityInWorld(enderman); | ||
|
|
||
| if (!spawned){ | ||
| spawned = true; | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(enderman,32D))KnowledgeRegistrations.DEATH_FLOWER.tryUnlockFragment(observer,1F,new short[]{ 0,1,2,3,4,6,7 }); | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| world.setBlockMetadataWithNotify(x,y,z,Math.min(meta,15),3); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private void setBlock(World world, int x, int y, int z, Block newBlock){ | ||
| world.setBlock(x,y,z,newBlock); | ||
| } | ||
|
|
||
| private void setMeta(World world, int x, int y, int z, int newMeta){ | ||
| world.setBlockMetadataWithNotify(x,y,z,newMeta,3); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| ItemStack is = player.inventory.getCurrentItem(); | ||
| if (is == null || is.getItem() != ItemList.end_powder)return false; | ||
|
|
||
| int meta = world.getBlockMetadata(x,y,z); | ||
| if (meta > 0 && meta < 15){ | ||
| if (!world.isRemote){ | ||
| world.setBlockMetadataWithNotify(x,y,z,meta-1,2); | ||
| if (!player.capabilities.isCreativeMode)--is.stackSize; | ||
| world.playAuxSFX(2005,x,y,z,0); | ||
| } | ||
| for(int a = 0; a < 3; a++)world.spawnParticle("portal",x+world.rand.nextFloat(),y+world.rand.nextFloat(),z+world.rand.nextFloat(),0D,0D,0D); | ||
|
|
||
| KnowledgeRegistrations.DEATH_FLOWER.tryUnlockFragment(player,0.18F,new short[]{ 0,1,2,3,4,6,7 }); | ||
| EntityPlayer observer = ObservationUtil.getRandomObserver(player,6D); | ||
| if (observer != player)KnowledgeRegistrations.DEATH_FLOWER.tryUnlockFragment(observer,0.16F,new short[]{ 0,1,2,3,4,6,7 }); | ||
|
|
||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public int damageDropped(int meta){ | ||
| return meta; | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean canPlaceBlockOn(Block block){ | ||
| return block == Blocks.end_stone || block == BlockList.end_terrain || super.canPlaceBlockOn(block); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean canBlockStay(World world, int x, int y, int z){ | ||
| Block soil = world.getBlock(x,y-1,z); | ||
| return soil == Blocks.end_stone || soil == BlockList.end_terrain || soil == Blocks.grass || soil == Blocks.dirt; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return meta == 15?iconDeadFlower:blockIcon; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| list.add(new ItemStack(item,1,0)); | ||
| list.add(new ItemStack(item,1,15)); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| blockIcon = iconRegister.registerIcon(getTextureName()); | ||
| iconDeadFlower = iconRegister.registerIcon(getTextureName()+"_dead"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.BlockFlowerPot; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.proxy.ModCommonProxy; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEndFlowerPot extends BlockFlowerPot{ | ||
| public BlockEndFlowerPot(){ | ||
| super(); | ||
| setTickRandomly(true); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| ((BlockEndFlower)BlockList.death_flower).updateFlowerLogic(world,x,y,z,rand); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| return BlockList.death_flower.onBlockActivated(world,x,y,z,player,side,hitX,hitY,hitZ); | ||
| } | ||
|
|
||
| @Override | ||
| public int getDamageValue(World world, int x, int y, int z){ | ||
| return world.getBlockMetadata(x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune){ | ||
| super.dropBlockAsItemWithChance(world,x,y,z,0,chance,fortune); | ||
| dropBlockAsItem(world,x,y,z,new ItemStack(BlockList.death_flower,1,meta)); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public Item getItem(World world, int x, int y, int z){ | ||
| return Item.getItemFromBlock(BlockList.death_flower); | ||
| } | ||
|
|
||
| @Override | ||
| public int getRenderType(){ | ||
| return ModCommonProxy.renderIdFlowerPot; | ||
| } | ||
|
|
||
| public static ItemStack getPlantForMeta(int meta){ | ||
| return new ItemStack(BlockList.death_flower,1,meta); | ||
| } | ||
|
|
||
| public static int getMetaForPlant(ItemStack is){ | ||
| return is.getItemDamage(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package chylex.hee.block; | ||
| import java.util.ArrayList; | ||
| import java.util.Random; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.MathHelper; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEndPowderOre extends BlockAbstractOre{ | ||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return ItemList.end_powder; | ||
| } | ||
|
|
||
| @Override | ||
| public int quantityDroppedWithBonus(int fortune, Random rand){ | ||
| return 1+rand.nextInt(3+fortune); | ||
| } | ||
|
|
||
| @Override | ||
| public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune){ | ||
| super.dropBlockAsItemWithChance(world,x,y,z,meta,chance,fortune); | ||
| dropXpOnBlockBreak(world,x,y,z,MathHelper.getRandomIntegerInRange(world.rand,2,4)); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onOreMined(EntityPlayer player, ArrayList<ItemStack> drops, int x, int y, int z, int meta, int fortune){ | ||
| if (KnowledgeRegistrations.END_POWDER_ORE.tryUnlockFragment(player,0.1F).stopTrying)return; | ||
| if (KnowledgeRegistrations.END_POWDER.tryUnlockFragment(player,0.1F).stopTrying)return; | ||
|
|
||
| if (KnowledgeRegistrations.END_POWDER.hasSomeFragments(player)){ | ||
| switch(player.worldObj.rand.nextInt(4)){ | ||
| case 0: KnowledgeRegistrations.ENDER_PEARLS_ENH.tryUnlockFragment(player,0.05F); break; | ||
| case 1: KnowledgeRegistrations.TRANSFERENCE_GEM_ENH.tryUnlockFragment(player,0.05F); break; | ||
| case 2: KnowledgeRegistrations.TNT_ENH.tryUnlockFragment(player,0.05F); break; | ||
| case 3: KnowledgeRegistrations.SOUL_CHARM_ENH.tryUnlockFragment(player,0.05F); break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void randomDisplayTick(World world, int x, int y, int z, Random rand){ | ||
| for(int a = 0; a < 2; a++)world.spawnParticle("portal",(x-0.425F+1.75F*rand.nextFloat()),(y+1.5F*rand.nextFloat()),(z-0.425F+1.75F*rand.nextFloat()),0D,0D,0D); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Arrays; | ||
| import java.util.HashSet; | ||
| import java.util.Random; | ||
| import java.util.Set; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.Entity; | ||
| import net.minecraft.entity.EntityLivingBase; | ||
| import net.minecraft.entity.monster.EntityEnderman; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.potion.Potion; | ||
| import net.minecraft.potion.PotionEffect; | ||
| import net.minecraft.util.Vec3; | ||
| import net.minecraft.world.World; | ||
| import net.minecraftforge.event.entity.player.FillBucketEvent; | ||
| import net.minecraftforge.fluids.BlockFluidClassic; | ||
| import net.minecraftforge.fluids.Fluid; | ||
| import chylex.hee.HardcoreEnderExpansion; | ||
| import chylex.hee.entity.boss.EntityBossDragon; | ||
| import chylex.hee.entity.boss.EntityBossEnderDemon; | ||
| import chylex.hee.entity.boss.EntityMiniBossEnderEye; | ||
| import chylex.hee.entity.mob.EntityMobAngryEnderman; | ||
| import chylex.hee.entity.mob.EntityMobBabyEnderman; | ||
| import chylex.hee.entity.mob.EntityMobEnderGuardian; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
| import cpw.mods.fml.common.eventhandler.Event.Result; | ||
| import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEnderGoo extends BlockFluidClassic{ | ||
| public static boolean shouldBattleWater = true; | ||
|
|
||
| public static final Material enderGoo = new MaterialEnderGoo(); | ||
| public static final Fluid fluid = new Fluid("enderGoo").setDensity(1500).setTemperature(220).setViscosity(1500); | ||
|
|
||
| private final byte[] xOff = new byte[]{ -1, 1, 0, 0, 0, 0 }, | ||
| yOff = new byte[]{ 0, 0, -1, 1, 0, 0 }, | ||
| zOff = new byte[]{ 0, 0, 0, 0, -1, 1 }; | ||
|
|
||
| public BlockEnderGoo(){ | ||
| super(fluid,enderGoo); | ||
| disableStats(); | ||
|
|
||
| setQuantaPerBlock(5); | ||
| setTickRate(18); | ||
| setTickRandomly(true); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| super.updateTick(world,x,y,z,rand); | ||
|
|
||
| if (shouldBattleWater){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
| boolean observed = false; | ||
|
|
||
| for(int a = 0; a < 6; a++){ | ||
| if (world.getBlock(x+xOff[a],y+yOff[a],z+zOff[a]).getMaterial() != Material.water)continue; | ||
|
|
||
| if ((rand.nextInt(Math.max(1,10-meta-(world.provider.dimensionId == 1?7:0)+(a == 2 || a == 3?2:0))) == 0)){ | ||
| world.setBlock(x+xOff[a],y+yOff[a],z+zOff[a],this,Math.max(2,world.getBlockMetadata(x,y,z)),3); | ||
| if (rand.nextInt(6-meta) == 0)world.setBlockToAir(x,y,z); | ||
|
|
||
| if (!observed){ | ||
| observed = true; | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,16D))KnowledgeRegistrations.ENDER_GOO.tryUnlockFragment(observer,0.04F); | ||
| } | ||
| } | ||
| else if (world.provider.dimensionId != 1 && rand.nextInt(4) != 0){ | ||
| world.setBlock(x,y,z,Blocks.flowing_water,2,3); | ||
|
|
||
| for(int b = 0,index; b < 2+rand.nextInt(5); b++){ | ||
| index = rand.nextInt(6); | ||
| if (world.getBlock(x+xOff[index],y+yOff[index],z+zOff[index]) == this)world.setBlock(x+xOff[index],y+yOff[index],z+zOff[index],Blocks.flowing_water,2,3); | ||
| } | ||
|
|
||
| return; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec){} | ||
|
|
||
| private static final PotionEffect weakness = new PotionEffect(Potion.weakness.id,5,1,false), | ||
| miningFatigue = new PotionEffect(Potion.digSlowdown.id,5,1,false), | ||
| poison = new PotionEffect(Potion.poison.id,100,2,false); | ||
|
|
||
| private static final Set<Class> unaffectedMobs = new HashSet<>(Arrays.asList(new Class[]{ | ||
| EntityEnderman.class, EntityMobAngryEnderman.class, EntityMobBabyEnderman.class, EntityMobEnderGuardian.class, | ||
| EntityMiniBossEnderEye.class, EntityBossEnderDemon.class, EntityBossDragon.class | ||
| })); | ||
|
|
||
| @Override | ||
| public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ | ||
| if (entity instanceof EntityLivingBase && !unaffectedMobs.contains(entity.getClass())){ | ||
| EntityLivingBase e = (EntityLivingBase)entity; | ||
| e.addPotionEffect(weakness); | ||
| e.addPotionEffect(miningFatigue); | ||
|
|
||
| PotionEffect eff = e.getActivePotionEffect(Potion.poison); | ||
| if (eff == null){ | ||
| e.addPotionEffect(poison); | ||
| if ((eff = e.getActivePotionEffect(Potion.poison)) == null)return; | ||
| } | ||
|
|
||
| if (eff.getDuration() < 102)eff.combine(new PotionEffect(Potion.poison.id,eff.getDuration()+17,eff.getAmplifier(),eff.getIsAmbient())); | ||
|
|
||
| Vec3 vec = Vec3.createVectorHelper(0D,0D,0D); | ||
| super.velocityToAddToEntity(world,x,y,z,entity,vec); | ||
| vec.normalize(); | ||
|
|
||
| entity.addVelocity(vec.xCoord*0.0075D,vec.yCoord*0.005D,vec.zCoord*0.0075D); | ||
| entity.motionX *= 0.25D; | ||
| entity.motionY *= 0.45D; | ||
| entity.motionZ *= 0.25D; | ||
|
|
||
| if (e.ticksExisted%20 == 0){ | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(entity,6D))KnowledgeRegistrations.ENDER_GOO.tryUnlockFragment(observer,0.2F); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public float getFilledPercentage(World world, int x, int y, int z){ | ||
| return 1F-super.getFilledPercentage(world,x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void randomDisplayTick(World world, int x, int y, int z, Random rand){ | ||
| HardcoreEnderExpansion.fx.enderGoo(world,x,y,z); | ||
| } | ||
|
|
||
| @SubscribeEvent | ||
| public void onBucketFill(FillBucketEvent e){ | ||
| if (e.world.getBlock(e.target.blockX,e.target.blockY,e.target.blockZ) == this){ | ||
| e.world.setBlockToAir(e.target.blockX,e.target.blockY,e.target.blockZ); | ||
| e.result = new ItemStack(ItemList.bucket_ender_goo); | ||
| e.setResult(Result.ALLOW); | ||
|
|
||
| KnowledgeRegistrations.ENDER_GOO.tryUnlockFragment(e.entityPlayer,0.08F); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| super.registerBlockIcons(iconRegister); | ||
| fluid.setIcons(blockIcon); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.BlockContainer; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.EntityLivingBase; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.util.MathHelper; | ||
| import net.minecraft.world.IBlockAccess; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.tileentity.TileEntityEndermanHead; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEndermanHead extends BlockContainer{ | ||
| public BlockEndermanHead(){ | ||
| super(Material.circuits); | ||
| setBlockBounds(0.25F,0.0F,0.25F,0.75F,0.5F,0.75F); | ||
| } | ||
|
|
||
| @Override | ||
| public int getRenderType(){ | ||
| return -1; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOpaqueCube(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean renderAsNormalBlock(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ | ||
| switch(world.getBlockMetadata(x,y,z)&7){ | ||
| default: case 1: setBlockBounds(0.25F,0.0F,0.25F,0.75F,0.5F,0.75F); break; | ||
| case 2: setBlockBounds(0.25F,0.25F,0.5F,0.75F,0.75F,1.0F); break; | ||
| case 3: setBlockBounds(0.25F,0.25F,0.0F,0.75F,0.75F,0.5F); break; | ||
| case 4: setBlockBounds(0.5F,0.25F,0.25F,1.0F,0.75F,0.75F); break; | ||
| case 5: setBlockBounds(0.0F,0.25F,0.25F,0.5F,0.75F,0.75F); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ | ||
| setBlockBoundsBasedOnState(world,x,y,z); | ||
| return super.getCollisionBoundingBoxFromPool(world,x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack is){ | ||
| world.setBlockMetadataWithNotify(x,y,z,MathHelper.floor_double((entity.rotationYaw*4F/360F)+2.5D)&3,2); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityEndermanHead(); | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return ItemList.enderman_head; | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItem(World world, int x, int y, int z){ | ||
| return ItemList.enderman_head; | ||
| } | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| @Override | ||
| public void registerBlockIcons(IIconRegister iconRegister){} | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| @Override | ||
| public IIcon getIcon(int side, int meta){ | ||
| return Blocks.soul_sand.getIcon(side,0); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.creativetab.CreativeTabs; | ||
| import net.minecraft.entity.EnumCreatureType; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.IBlockAccess; | ||
| import chylex.hee.item.block.ItemBlockWithSubtypes.IBlockSubtypes; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEndstoneTerrain extends Block implements IBlockSubtypes{ | ||
| private static final Random rand = new Random(); | ||
|
|
||
| private static final String[] types = new String[]{ | ||
| "infested", "burned", "enchanted" | ||
| }; | ||
|
|
||
| public static final byte metaInfested = 0, metaBurned = 1, metaEnchanted = 2; | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| private IIcon[] iconTop,iconSide; | ||
|
|
||
| public BlockEndstoneTerrain(){ | ||
| super(Material.rock); | ||
| } | ||
|
|
||
| @Override | ||
| public int damageDropped(int meta){ | ||
| return meta; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z){ | ||
| switch(world.getBlockMetadata(x,y,z)){ | ||
| case metaInfested: return rand.nextInt(10) <= 2; | ||
| case metaBurned: return false; | ||
| case metaEnchanted: | ||
| default: return true; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String getUnlocalizedName(ItemStack is){ | ||
| switch(is.getItemDamage()){ | ||
| case BlockEndstoneTerrain.metaInfested: return "tile.endStoneTerrain.infested"; | ||
| case BlockEndstoneTerrain.metaBurned: return "tile.endStoneTerrain.burned"; | ||
| case BlockEndstoneTerrain.metaEnchanted: return "tile.endStoneTerrain.enchanted"; | ||
| default: return ""; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| if (meta >= types.length)meta = 0; | ||
| return side == 0 ? blockIcon : (side == 1 ? iconTop[meta] : iconSide[meta]); | ||
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| for(int a = 0; a < types.length; a++)list.add(new ItemStack(item,1,a)); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| blockIcon = iconRegister.registerIcon("end_stone"); | ||
| iconTop = new IIcon[types.length]; | ||
| iconSide = new IIcon[types.length]; | ||
|
|
||
| for(int a = 0; a < types.length; a++){ | ||
| iconTop[a] = iconRegister.registerIcon("hardcoreenderexpansion:endstone_ter_"+types[a]+"_top"); | ||
| iconSide[a] = iconRegister.registerIcon("hardcoreenderexpansion:endstone_ter_"+types[a]+"_side"); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockContainer; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.particle.EffectRenderer; | ||
| import net.minecraft.entity.Entity; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.entity.projectile.EntityArrow; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.MovingObjectPosition; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.entity.fx.EntityEnergyClusterFX; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
| import chylex.hee.mechanics.misc.EnergyClusterData; | ||
| import chylex.hee.system.util.DragonUtil; | ||
| import chylex.hee.system.util.MathUtil; | ||
| import chylex.hee.tileentity.TileEntityEnergyCluster; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEnergyCluster extends BlockContainer{ | ||
| public static final SoundType soundTypeEnergyCluster = new SoundType("stone",5F,1.6F){ | ||
| @Override | ||
| public String getStepResourcePath(){ | ||
| return "dig.glass"; | ||
| } | ||
|
|
||
| @Override | ||
| public String getBreakSound(){ | ||
| return "dig.glass"; | ||
| } | ||
|
|
||
| @Override | ||
| public String func_150496_b(){ // OBFUSCATED placed block sound | ||
| return "dig.glass"; | ||
| } | ||
| }; | ||
|
|
||
| public BlockEnergyCluster(){ | ||
| super(Material.glass); | ||
| setBlockBounds(0.3F,0.3F,0.3F,0.7F,0.7F,0.7F); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityEnergyCluster(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| ItemStack is = player.inventory.getCurrentItem(); | ||
| if (is == null || is.getItem() != ItemList.end_powder)return false; | ||
|
|
||
| TileEntityEnergyCluster tile = (TileEntityEnergyCluster)world.getTileEntity(x,y,z); | ||
| if (tile == null)return false; | ||
|
|
||
| if (tile.data.getWeaknessLevel() > 0){ | ||
| if (!world.isRemote){ | ||
| tile.data.healWeakness(4+world.rand.nextInt(5)-world.rand.nextInt(2)); | ||
| if (tile.data.getWeaknessLevel() == 0)world.playAuxSFX(2005,x,y,z,0); | ||
| } | ||
| } | ||
| else if (tile.data.getBoost() < EnergyClusterData.MAX_BOOST){ | ||
| if (tile.data.getBoost() == 0)world.playAuxSFX(2005,x,y,z,0); | ||
| tile.data.boost(); | ||
| } | ||
| else return false; | ||
|
|
||
| if (world.rand.nextInt(3) == 0){ | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,6D)){ | ||
| KnowledgeRegistrations.ENERGY_CLUSTER.tryUnlockFragment(observer,0.37F,new short[]{ 2,3,4 }); | ||
| } | ||
| } | ||
|
|
||
| tile.synchronize(); | ||
| if (!world.isRemote && !player.capabilities.isCreativeMode)--is.stackSize; | ||
|
|
||
| for(int a = 0; a < 3; a++)world.spawnParticle("portal",x+world.rand.nextFloat(),y+world.rand.nextFloat(),z+world.rand.nextFloat(),0D,0D,0D); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public void breakBlock(World world, int x, int y, int z, Block block, int meta){ | ||
| int newMeta = 3; | ||
|
|
||
| TileEntityEnergyCluster tile = (TileEntityEnergyCluster)world.getTileEntity(x,y,z); | ||
| if (tile != null)newMeta = Math.min(15,3+tile.data.getEnergyAmount()/120); | ||
| if (tile == null || tile.shouldNotExplode)return; | ||
|
|
||
| super.breakBlock(world,x,y,z,block,meta); | ||
| DragonUtil.createExplosion(world,x+0.5D,y+0.5D,z+0.5D,2.8F+(newMeta-3)*0.225F,true); | ||
|
|
||
| for(int xx = x-4; xx <= x+4; xx++){ | ||
| for(int zz = z-4; zz <= z+4; zz++){ | ||
| for(int yy = y-4; yy <= y+4; yy++){ | ||
| if (MathUtil.distance(xx-x,yy-y,zz-z) <= 5D && world.getBlock(xx,yy,zz).getMaterial() == Material.air)world.setBlock(xx,yy,zz,BlockList.corrupted_energy_high,newMeta,3); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,8D)){ | ||
| KnowledgeRegistrations.ENERGY_CLUSTER.tryUnlockFragment(observer,0.37F,new short[]{ 0,1 }); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ | ||
| if (entity instanceof EntityArrow)world.setBlockToAir(x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOpaqueCube(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean renderAsNormalBlock(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public int getRenderType(){ | ||
| return -1; | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public int quantityDropped(Random rand){ | ||
| return 0; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer){ | ||
| for(int a = 0; a < 4; a++)effectRenderer.addEffect(new EntityEnergyClusterFX(world,target.blockX+0.5D,target.blockY+0.5D,target.blockZ+0.5D,0D,0D,0D,0D,0D,0D)); | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer){ | ||
| for(int a = 0; a < 4; a++)effectRenderer.addEffect(new EntityEnergyClusterFX(world,x+0.5D,y+0.5D,z+0.5D,0D,0D,0D,0D,0D,0D)); | ||
| return true; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package chylex.hee.block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.HardcoreEnderExpansion; | ||
| import chylex.hee.tileentity.TileEntityEnergyExtractionTable; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEnergyExtractionTable extends BlockAbstractInventory{ | ||
| @SideOnly(Side.CLIENT) | ||
| private IIcon iconTop, iconSide, iconBottom; | ||
|
|
||
| public BlockEnergyExtractionTable(){ | ||
| super(Material.rock); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityEnergyExtractionTable(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| player.openGui(HardcoreEnderExpansion.instance,3,world,x,y,z); | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return side == 0 ? iconBottom : side == 1 ? iconTop : iconSide; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| iconTop = iconRegister.registerIcon("hardcoreenderexpansion:energy_extraction_table_top"); | ||
| iconSide = iconRegister.registerIcon("hardcoreenderexpansion:energy_extraction_table_side"); | ||
| iconBottom = iconRegister.registerIcon("hardcoreenderexpansion:energy_extraction_table_bottom"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.BlockBrewingStand; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.HardcoreEnderExpansion; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.tileentity.TileEntityEnhancedBrewingStand; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEnhancedBrewingStand extends BlockBrewingStand{ | ||
| @SideOnly(Side.CLIENT) | ||
| private IIcon theIcon; | ||
|
|
||
| public BlockEnhancedBrewingStand(){ | ||
| super(); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityEnhancedBrewingStand(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| player.openGui(HardcoreEnderExpansion.instance,0,world,x,y,z); | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return ItemList.enhanced_brewing_stand; | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItem(World world, int x, int y, int z){ | ||
| return ItemList.enhanced_brewing_stand; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| super.registerBlockIcons(iconRegister); | ||
| theIcon = iconRegister.registerIcon(getTextureName()+"_base"); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIconBrewingStandBase(){ | ||
| return theIcon; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| package chylex.hee.block; | ||
| import java.util.ArrayList; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockContainer; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.Entity; | ||
| import net.minecraft.entity.EntityLivingBase; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.entity.projectile.EntityArrow; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.init.Items; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.Explosion; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.entity.block.EntityBlockEnhancedTNTPrimed; | ||
| import chylex.hee.mechanics.enhancements.EnhancementHandler; | ||
| import chylex.hee.mechanics.enhancements.types.TNTEnhancements; | ||
| import chylex.hee.tileentity.TileEntityEnhancedTNT; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEnhancedTNT extends BlockContainer{ | ||
| @SideOnly(Side.CLIENT) | ||
| private IIcon iconTop; | ||
| @SideOnly(Side.CLIENT) | ||
| private IIcon iconBottom; | ||
|
|
||
| public BlockEnhancedTNT(){ | ||
| super(Material.tnt); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityEnhancedTNT(); | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockAdded(World world, int x, int y, int z){ | ||
| super.onBlockAdded(world,x,y,z); | ||
|
|
||
| if (world.isBlockIndirectlyGettingPowered(x,y,z)){ | ||
| onBlockDestroyedByPlayer(world,x,y,z,1); | ||
| world.setBlockToAir(x,y,z); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor){ | ||
| if (world.isBlockIndirectlyGettingPowered(x,y,z)){ | ||
| onBlockDestroyedByPlayer(world,x,y,z,1); | ||
| world.setBlockToAir(x,y,z); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public int quantityDropped(Random rand){ | ||
| return 1; | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion){ | ||
| if (!world.isRemote){ | ||
| TileEntityEnhancedTNT tile = (TileEntityEnhancedTNT)world.getTileEntity(x,y,z); | ||
|
|
||
| if (tile != null){ | ||
| EntityBlockEnhancedTNTPrimed tnt = new EntityBlockEnhancedTNTPrimed(world,x+0.5F,y+0.5F,z+0.5F,explosion.getExplosivePlacedBy(),tile.getEnhancements()); | ||
| tnt.fuse = tile.getEnhancements().contains(TNTEnhancements.NO_FUSE) ? 1 : world.rand.nextInt(tnt.fuse/4)+tnt.fuse/8; | ||
| world.spawnEntityInWorld(tnt); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z){ | ||
| return tryIgniteTNT(world,x,y,z,false,null) ? false : super.removedByPlayer(world,player,x,y,z); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float hitX, float hitY, float hitZ){ | ||
| if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.flint_and_steel){ | ||
| tryIgniteTNT(world,x,y,z,true,player); | ||
| world.setBlockToAir(x,y,z); | ||
| player.getCurrentEquippedItem().damageItem(1,player); | ||
| return true; | ||
| } | ||
| else return super.onBlockActivated(world,x,y,z,player,meta,hitX,hitY,hitZ); | ||
| } | ||
|
|
||
| @Override | ||
| public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ | ||
| if (!world.isRemote && entity instanceof EntityArrow){ | ||
| EntityArrow arrow = (EntityArrow)entity; | ||
|
|
||
| if (arrow.isBurning()){ | ||
| tryIgniteTNT(world,x,y,z,true,arrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)arrow.shootingEntity : null); | ||
| world.setBlockToAir(x,y,z); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private boolean tryIgniteTNT(World world, int x, int y, int z, boolean ignite, EntityLivingBase igniter){ | ||
| if (!world.isRemote){ | ||
| TileEntityEnhancedTNT tile = (TileEntityEnhancedTNT)world.getTileEntity(x,y,z); | ||
|
|
||
| if (tile != null && (ignite || tile.getEnhancements().contains(TNTEnhancements.TRAP))){ | ||
| EntityBlockEnhancedTNTPrimed tnt = new EntityBlockEnhancedTNTPrimed(world,x+0.5F,y+0.5F,z+0.5F,igniter,tile.getEnhancements()); | ||
| world.spawnEntityInWorld(tnt); | ||
| world.playSoundAtEntity(tnt,"game.tnt.primed",1F,1F); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean canDropFromExplosion(Explosion explosion){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){ | ||
| ArrayList<ItemStack> drops = new ArrayList<>(1); | ||
| TileEntityEnhancedTNT tile = (TileEntityEnhancedTNT)world.getTileEntity(x,y,z); | ||
|
|
||
| if (tile == null)drops.add(new ItemStack(Blocks.tnt)); | ||
| else{ | ||
| ItemStack is = new ItemStack(BlockList.enhanced_tnt); | ||
| for(Enum enhancement:tile.getEnhancements())EnhancementHandler.addEnhancement(is,enhancement); | ||
| drops.add(is); | ||
| } | ||
|
|
||
| return drops; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return side == 0 ? iconBottom : (side == 1 ? iconTop : blockIcon); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| blockIcon = iconRegister.registerIcon(getTextureName()+"_side"); | ||
| iconTop = iconRegister.registerIcon(getTextureName()+"_top"); | ||
| iconBottom = iconRegister.registerIcon(getTextureName()+"_bottom"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockContainer; | ||
| import net.minecraft.block.material.Material; | ||
| 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.tileentity.TileEntity; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.mechanics.essence.EssenceType; | ||
| import chylex.hee.tileentity.TileEntityEssenceAltar; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockEssenceAltar extends BlockContainer{ | ||
| private static final float hitCenter1 = 0.09F, hitCenter2 = 0.9F, hitDist = 0.05F; | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| private IIcon[] iconTop,iconSide,iconBottom; | ||
|
|
||
| public BlockEssenceAltar(){ | ||
| super(Material.iron); | ||
| setBlockBounds(0.0F,0.0F,0.0F,1.0F,0.75F,1.0F); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| if (world.isRemote)return true; | ||
|
|
||
| TileEntityEssenceAltar altar = (TileEntityEssenceAltar)world.getTileEntity(x,y,z); | ||
| if (altar != null){ | ||
| if (side == 1){ | ||
| if (hitX >= hitCenter1-hitDist && hitX <= hitCenter1+hitDist && hitZ >= hitCenter1-hitDist && hitZ <= hitCenter1+hitDist)altar.onSocketClick(player,3); | ||
| else if (hitX >= hitCenter1-hitDist && hitX <= hitCenter1+hitDist && hitZ >= hitCenter2-hitDist && hitZ <= hitCenter2+hitDist)altar.onSocketClick(player,2); | ||
| else if (hitX >= hitCenter2-hitDist && hitX <= hitCenter2+hitDist && hitZ >= hitCenter2-hitDist && hitZ <= hitCenter2+hitDist)altar.onSocketClick(player,1); | ||
| else if (hitX >= hitCenter2-hitDist && hitX <= hitCenter2+hitDist && hitZ >= hitCenter1-hitDist && hitZ <= hitCenter1+hitDist)altar.onSocketClick(player,0); | ||
| else altar.onRightClick(player); | ||
| return true; | ||
| } | ||
| else altar.onRightClick(player); | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta){ | ||
| if (world.isRemote)return; | ||
|
|
||
| TileEntityEssenceAltar altar = (TileEntityEssenceAltar)world.getTileEntity(x,y,z); | ||
| if (altar != null)altar.onBlockDestroy(); | ||
| super.breakBlock(world,x,y,z,oldBlock,oldMeta); | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public int damageDropped(int damage){ | ||
| return damage; | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityEssenceAltar(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOpaqueCube(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean renderAsNormalBlock(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| for(EssenceType essenceType:EssenceType.values()){ | ||
| list.add(new ItemStack(item,1,essenceType.id)); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| if (meta >= iconBottom.length)meta = 0; | ||
| return side == 0 ? iconBottom[meta] : (side == 1 ? iconTop[meta] : iconSide[meta]); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| String s = getTextureName()+"_"; | ||
|
|
||
| iconTop = new IIcon[EssenceType.values().length]; | ||
| iconSide = new IIcon[iconTop.length]; | ||
| iconBottom = new IIcon[iconTop.length]; | ||
|
|
||
| for(int a = 0; a < iconTop.length; a++){ | ||
| iconTop[a] = iconRegister.registerIcon(s+a+"_top"); | ||
| iconSide[a] = iconRegister.registerIcon(s+a+"_side"); | ||
| iconBottom[a] = iconRegister.registerIcon(s+a+"_bottom"); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package chylex.hee.block; | ||
| import java.util.ArrayList; | ||
| import java.util.Random; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.MathHelper; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockIgneousRockOre extends BlockAbstractOre{ | ||
| public BlockIgneousRockOre(){ | ||
| super(); | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return ItemList.igneous_rock; | ||
| } | ||
|
|
||
| @Override | ||
| public int quantityDroppedWithBonus(int fortune, Random rand){ | ||
| return 1; | ||
| } | ||
|
|
||
| @Override | ||
| public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune){ | ||
| super.dropBlockAsItemWithChance(world,x,y,z,meta,chance,fortune); | ||
| dropXpOnBlockBreak(world,x,y,z,MathHelper.getRandomIntegerInRange(world.rand,3,5)); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onOreMined(EntityPlayer player, ArrayList<ItemStack> drops, int x, int y, int z, int meta, int fortune){ | ||
| if (KnowledgeRegistrations.IGNEOUS_ROCK_ORE.tryUnlockFragment(player,0.08F).stopTrying)return; | ||
| KnowledgeRegistrations.IGNEOUS_ROCK.tryUnlockFragment(player,0.06F,new short[]{ 0,1,2 }); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void randomDisplayTick(World world, int x, int y, int z, Random rand){ | ||
| for(int a = 0; a < 2; a++)world.spawnParticle("lava",(x-0.425F+1.75F*rand.nextFloat()),(y+1.5F*rand.nextFloat()),(z-0.425F+1.75F*rand.nextFloat()),0D,0D,0D); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| package chylex.hee.block; | ||
| /*import java.util.Random; | ||
| import net.minecraft.block.BlockCauldron; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.entity.item.EntityItem; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.entity.player.EntityPlayerMP; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.init.Items; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemArmor; | ||
| import net.minecraft.item.ItemArmor.ArmorMaterial; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.HardcoreEnderExpansion; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.proxy.ModCommonProxy; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
| public class BlockInfestationRemedyCauldron extends BlockCauldron{ | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon waterGray; | ||
| public BlockInfestationRemedyCauldron(){ | ||
| super(); | ||
| setTickRandomly(true); | ||
| } | ||
| @Override | ||
| public int getRenderType(){ | ||
| return ModCommonProxy.renderIdInfestationRemedyCauldron; | ||
| } | ||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| if (rand.nextInt(3) == 0 || world.getBlock(x,y-1,z) != Blocks.fire)return; | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
| if (CauldronState.getByMeta(meta).isCooking)world.setBlockMetadataWithNotify(x,y,z,meta+1,3); | ||
| } | ||
| @Override | ||
| public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ | ||
| if (world.isRemote)return true; | ||
| ItemStack is = player.inventory.getCurrentItem(); | ||
| if (is == null)return true; | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
| CauldronState state = CauldronState.getByMeta(meta); | ||
| if (state.canBeBottled && is.getItem() == Items.glass_bottle){ | ||
| ItemStack remedy = new ItemStack(ItemList.infestation_remedy); | ||
| if ((--is.stackSize) <= 0)player.inventory.setInventorySlotContents(player.inventory.currentItem,remedy); | ||
| else if (!player.inventory.addItemStackToInventory(remedy))world.spawnEntityInWorld(new EntityItem(world,x+0.5D,y+1.5D,z+0.5D,remedy)); | ||
| if (player instanceof EntityPlayerMP)((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer); | ||
| if (CauldronState.getByMeta(meta+1) == CauldronState.EMPTY)world.setBlock(x,y,z,Blocks.cauldron,0,3); | ||
| else world.setBlockMetadataWithNotify(x,y,z,meta+1,3); | ||
| return true; | ||
| } | ||
| else if (is.getItem() instanceof ItemArmor){ | ||
| ItemArmor armor = (ItemArmor)is.getItem(); | ||
| if (armor.getArmorMaterial() != ArmorMaterial.CLOTH)return true; | ||
| int red = (int)Math.floor(state.color[0]*255F),green = (int)Math.floor(state.color[1]*255F),blue = (int)Math.floor(state.color[2]*255F); | ||
| armor.func_82813_b(is,red<<16|green<<8|blue); // OBFUSCATED set armor dye | ||
| } | ||
| return true; | ||
| } | ||
| @Override | ||
| public void fillWithRain(World world, int x, int y, int z){} | ||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void randomDisplayTick(World world, int x, int y, int z, Random rand){ | ||
| world.markBlockRangeForRenderUpdate(x,y,z,x,y,z); | ||
| if (CauldronState.getByMeta(world.getBlockMetadata(x,y,z)).isCooking && world.getBlock(x,y-1,z) == Blocks.fire && rand.nextInt(3) == 0){ | ||
| HardcoreEnderExpansion.fx.bubble(world,x+0.5D+(rand.nextFloat()-0.5D)*0.5D,y+0.5F+rand.nextFloat()*0.4F,z+0.5D+(rand.nextFloat()-0.5D)*0.5D,0D,0.03D,0D); | ||
| if (rand.nextInt(7) == 0)world.playSound(x+0.5D,y+0.8D,z+0.5D,"hardcoreenderexpansion:environment.random.bubble",1F,rand.nextFloat()*0.1F+0.95F,false); | ||
| } | ||
| } | ||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| super.registerBlockIcons(iconRegister); | ||
| waterGray = iconRegister.registerIcon("hardcoreenderexpansion:cauldron_water_gray"); | ||
| } | ||
| public static enum CauldronState{ | ||
| HAS_SILVERFISH_BLOOD(0,true,false,false,false,false,new float[]{ 0.4063F,0.1484F,0.5039F }), // 104,38,129 | ||
| HAS_BAT_WING(1,false,true,false,false,false,new float[]{ 0.2929F,0.2656F,0.3828F }), // 75,68,98 | ||
| HAS_DRY_SPLINTER(2,false,false,true,false,false,new float[]{ 0.1523F,0.1328F,0.2852F }), // 39,34,73 | ||
| HAS_SILVERFISH_BLOOD_AND_BAT_WING(3,true,true,false,false,false,new float[]{ 0.3711F,0.2109F,0.3516F }), // 95,54,90 | ||
| HAS_SILVERFISH_BLOOD_AND_DRY_SPLINTER(4,true,false,true,false,false,new float[]{ 0.2109F,0.1094F,0.1758F }), // 54,28,45 | ||
| HAS_BAT_WING_AND_DRY_SPLINTER(5,false,true,true,false,false,new float[]{ 0.1914F,0.1406F,0.0977F }), // 49,36,25 | ||
| HAS_ALL_ITEMS(6,true,true,true,true,false,new float[]{ 0.2305F,0.1172F,0.0821F }), // 59,30,21 | ||
| COOKING_1(7,true,true,true,true,false,new float[]{ 0.2891F,0.1367F,0.1094F }), // 74,35,28 | ||
| COOKING_2(8,true,true,true,true,false,new float[]{ 0.3477F,0.1563F,0.1328F }), // 89,40,34 | ||
| COOKING_3(9,true,true,true,true,false,new float[]{ 0.4063F,0.1758F,0.1602F }), // 104,45,41 | ||
| COOKING_4(10,true,true,true,true,false,new float[]{ 0.4609F,0.1953F,0.1836F }), // 118,50,47 | ||
| COOKING_5(11,true,true,true,true,false,new float[]{ 0.5195F,0.2148F,0.2109F }), // 133,55,54 | ||
| FULL(12,true,true,true,false,true,new float[]{ 0.5781F,0.2344F,0.2344F }), // 148,60,60 | ||
| ALMOST_FULL(13,true,true,true,false,true,new float[]{ 0.5781F,0.2344F,0.2344F }), | ||
| NEARLY_EMPTY(14,true,true,true,false,true,new float[]{ 0.5781F,0.2344F,0.2344F }), | ||
| EMPTY(15,false,false,false,false,false,new float[]{ 0.5781F,0.2344F,0.2344F }); | ||
| public static CauldronState getByMeta(int meta){ | ||
| return values()[Math.min(meta,values().length-1)]; | ||
| } | ||
| public final byte metadata; | ||
| public final boolean hasSilverfishBlood; | ||
| public final boolean hasBatWing; | ||
| public final boolean hasDrySplinter; | ||
| public final boolean isCooking; | ||
| public final boolean canBeBottled; | ||
| public final float[] color; | ||
| CauldronState(int metadata, boolean hasSilverfishBlood, boolean hasBatWing, boolean hasDrySplinter, boolean isCooking, boolean canBeBottled, float[] color){ | ||
| this.metadata = (byte)metadata; | ||
| this.hasSilverfishBlood = hasSilverfishBlood; | ||
| this.hasBatWing = hasBatWing; | ||
| this.hasDrySplinter = hasDrySplinter; | ||
| this.isCooking = isCooking; | ||
| this.canBeBottled = canBeBottled; | ||
| this.color = color; | ||
| } | ||
| public int getLiquidAmount(){ | ||
| return this == NEARLY_EMPTY?1:this == ALMOST_FULL?2:3; | ||
| } | ||
| public CauldronState tryAddItem(Item item){ | ||
| if (hasSilverfishBlood && hasBatWing && hasDrySplinter)return null; | ||
| if (item == ItemList.silverfish_blood){ | ||
| return hasSilverfishBlood?null: | ||
| hasBatWing && hasDrySplinter?HAS_ALL_ITEMS: | ||
| hasBatWing?HAS_SILVERFISH_BLOOD_AND_BAT_WING: | ||
| hasDrySplinter?HAS_SILVERFISH_BLOOD_AND_DRY_SPLINTER: | ||
| null; | ||
| } | ||
| else if (item == ItemList.infested_bat_wing){ | ||
| return hasBatWing?null: | ||
| hasSilverfishBlood && hasDrySplinter?HAS_ALL_ITEMS: | ||
| hasSilverfishBlood?HAS_SILVERFISH_BLOOD_AND_BAT_WING: | ||
| hasDrySplinter?HAS_BAT_WING_AND_DRY_SPLINTER: | ||
| null; | ||
| } | ||
| else if (item == ItemList.dry_splinter){ | ||
| return hasDrySplinter?null: | ||
| hasSilverfishBlood && hasBatWing?HAS_ALL_ITEMS: | ||
| hasSilverfishBlood?HAS_SILVERFISH_BLOOD_AND_DRY_SPLINTER: | ||
| hasBatWing?HAS_BAT_WING_AND_DRY_SPLINTER: | ||
| null; | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
| */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package chylex.hee.block; | ||
| import java.util.ArrayList; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.MathHelper; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.item.ItemList; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.packets.PacketPipeline; | ||
| import chylex.hee.packets.client.C08PlaySound; | ||
|
|
||
| public class BlockInstabilityOrbOre extends BlockAbstractOre{ | ||
| @Override | ||
| public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune){ | ||
| ArrayList<ItemStack> ret = new ArrayList<>(); | ||
|
|
||
| if (world.rand.nextInt(100) > 60-fortune*4){ | ||
| ret.add(new ItemStack(ItemList.instability_orb)); | ||
| dropXpOnBlockBreak(world,x,y,z,MathHelper.getRandomIntegerInRange(world.rand,6,9)); | ||
| } | ||
| else{ | ||
| PacketPipeline.sendToAllAround(world.provider.dimensionId,x+0.5D,y+0.5D,z+0.5D,32D,new C08PlaySound(C08PlaySound.GLASS_BREAK,x+0.5D,y+0.5D,z+0.5D,1F,world.rand.nextFloat()*0.1F+0.92F)); | ||
| } | ||
|
|
||
| return ret; | ||
| } | ||
|
|
||
| @Override | ||
| protected void onOreMined(EntityPlayer player, ArrayList<ItemStack> drops, int x, int y, int z, int meta, int fortune){ | ||
| if (KnowledgeRegistrations.INSTABILITY_ORB_ORE.tryUnlockFragment(player,0.12F).stopTrying)return; | ||
| if (KnowledgeRegistrations.INSTABILITY_ORB.tryUnlockFragment(player,0.07F,new short[]{ 0,2 }).stopTrying)return; | ||
| if (player.worldObj.rand.nextInt(3) != 0)KnowledgeRegistrations.ENHANCED_BREWING_STAND.tryUnlockFragment(player,0.1F,new short[]{ 3 }); | ||
| else KnowledgeRegistrations.ENERGY_EXTRACTION_TABLE.tryUnlockFragment(player,0.15F,new short[]{ 6 }); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.BlockContainer; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.entity.Entity; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.tileentity.TileEntity; | ||
| import net.minecraft.util.AxisAlignedBB; | ||
| import net.minecraft.util.DamageSource; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.proxy.ModCommonProxy; | ||
| import chylex.hee.tileentity.TileEntityLaserBeam; | ||
|
|
||
| public class BlockLaserBeam extends BlockContainer{ | ||
| public static final Material laserBeam = new MaterialLaserBeam(); | ||
|
|
||
| public BlockLaserBeam(){ | ||
| super(laserBeam); | ||
| setBlockBounds(0F,0F,0F,0F,0F,0F); | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int metadata, Random rand, int fortune){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public int getRenderType(){ | ||
| return -1; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOpaqueCube(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean renderAsNormalBlock(){ | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ | ||
| if (entity.isImmuneToFire())return; | ||
| entity.setFire(1); | ||
| entity.attackEntityFrom(DamageSource.magic,ModCommonProxy.opMobs?4F:2F); | ||
| } | ||
|
|
||
| @Override | ||
| public TileEntity createNewTileEntity(World world, int meta){ | ||
| return new TileEntityLaserBeam(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| package chylex.hee.block; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraftforge.fluids.FluidRegistry; | ||
| import chylex.hee.system.creativetab.CreativeTabItemList; | ||
|
|
||
| public final class BlockList{ | ||
| public static final CreativeTabItemList tabOrderedList = new CreativeTabItemList(); | ||
|
|
||
| public static Block obsidian_end; | ||
| public static Block obsidian_stairs; | ||
| public static Block obsidian_special; | ||
| public static Block obsidian_special_glow; | ||
| public static Block essence_altar; | ||
| public static Block enhanced_brewing_stand; | ||
| public static Block enhanced_tnt; | ||
| public static Block decomposition_table; | ||
| public static Block energy_extraction_table; | ||
| public static Block end_powder_ore; | ||
| public static Block stardust_ore; | ||
| public static Block igneous_rock_ore; | ||
| public static Block instability_orb_ore; | ||
| public static Block ender_goo; | ||
| public static Block end_terrain; | ||
| public static Block crossed_decoration; | ||
| public static Block spooky_log; | ||
| public static Block spooky_leaves; | ||
| public static Block soul_charm; | ||
| public static Block death_flower; | ||
| public static Block death_flower_pot; | ||
| public static Block enderman_head; | ||
| //public static Block infestation_cauldron; | ||
| public static Block sphalerite; | ||
| public static Block ravaged_brick; | ||
| public static Block dungeon_puzzle; | ||
| public static Block energy_cluster; | ||
| public static Block corrupted_energy_high; | ||
| public static Block corrupted_energy_low; | ||
| public static Block laser_beam; | ||
| public static Block custom_spawner; | ||
| public static Block temple_end_portal; | ||
| public static Block biome_core; | ||
|
|
||
| public static void loadBlocks(){ | ||
| FluidRegistry.registerFluid(BlockEnderGoo.fluid); | ||
|
|
||
| obsidian_end = (new BlockObsidianEnd()) | ||
| .setHardness(50F).setResistance(2000F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("obsidianEnd").setBlockTextureName("obsidian"); | ||
|
|
||
| obsidian_stairs = new BlockObsidianStairs(Blocks.obsidian,0) | ||
| .setHardness(25F).setResistance(1000F) | ||
| .setBlockName("obsidianStairs"); | ||
|
|
||
| obsidian_special = new BlockObsidianSpecial(false) | ||
| .setHardness(28F).setResistance(2000F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("obsidianSpecial").setBlockTextureName("hardcoreenderexpansion:obsidian_smooth"); | ||
|
|
||
| obsidian_special_glow = new BlockObsidianSpecial(true) | ||
| .setHardness(28F).setResistance(2000F).setLightLevel(1F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("obsidianSpecial").setBlockTextureName("hardcoreenderexpansion:obsidian_smooth"); | ||
|
|
||
| essence_altar = new BlockEssenceAltar() | ||
| .setHardness(8F).setResistance(20F).setLightOpacity(0).setLightLevel(0.4F).setStepSound(Block.soundTypeMetal) | ||
| .setBlockName("essenceAltar").setBlockTextureName("hardcoreenderexpansion:essence_altar"); | ||
|
|
||
| enhanced_brewing_stand = new BlockEnhancedBrewingStand() | ||
| .setHardness(0.65F).setLightLevel(0.125F) | ||
| .setBlockName("brewingStand").setBlockTextureName("hardcoreenderexpansion:enhanced_brewing_stand"); | ||
|
|
||
| enhanced_tnt = new BlockEnhancedTNT() | ||
| .setHardness(0F).setStepSound(Block.soundTypeGrass) | ||
| .setBlockName("tnt").setBlockTextureName("tnt"); | ||
|
|
||
| decomposition_table = new BlockDecompositionTable() | ||
| .setHardness(4F).setResistance(2000F) | ||
| .setBlockName("decompositionTable"); | ||
|
|
||
| energy_extraction_table = new BlockEnergyExtractionTable() | ||
| .setHardness(4F).setResistance(2000F) | ||
| .setBlockName("energyExtractionTable"); | ||
|
|
||
| end_powder_ore = new BlockEndPowderOre() | ||
| .setHardness(3F).setResistance(12F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("endPowderOre").setBlockTextureName("hardcoreenderexpansion:end_powder_ore"); | ||
|
|
||
| stardust_ore = new BlockStardustOre() | ||
| .setHardness(7F).setResistance(4F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("stardustOre").setBlockTextureName("hardcoreenderexpansion:stardust_ore"); | ||
|
|
||
| igneous_rock_ore = new BlockIgneousRockOre() | ||
| .setHardness(2F).setResistance(5F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("igneousRockOre").setBlockTextureName("hardcoreenderexpansion:igneous_rock_ore"); | ||
|
|
||
| instability_orb_ore = new BlockInstabilityOrbOre() | ||
| .setHardness(5.5F).setResistance(3F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("instabilityOrbOre").setBlockTextureName("hardcoreenderexpansion:instability_orb_ore"); | ||
|
|
||
| ender_goo = new BlockEnderGoo() | ||
| .setHardness(150F).setLightOpacity(2) | ||
| .setBlockName("enderGoo").setBlockTextureName("hardcoreenderexpansion:endergoo_flow"); | ||
|
|
||
| end_terrain = new BlockEndstoneTerrain() | ||
| .setHardness(2.5F).setResistance(15F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("endStoneTerrain"); | ||
|
|
||
| crossed_decoration = new BlockCrossedDecoration() | ||
| .setHardness(0F).setStepSound(Block.soundTypeGrass).setCreativeTab(null) | ||
| .setBlockName("crossedDecoration"); | ||
|
|
||
| spooky_log = new BlockSpookyLog() | ||
| .setHardness(0.7F).setStepSound(Block.soundTypeWood) | ||
| .setBlockName("spookyLog"); | ||
|
|
||
| spooky_leaves = new BlockSpookyLeaves() | ||
| .setHardness(0.1F).setStepSound(Block.soundTypeGrass) | ||
| .setBlockName("spookyLeaves").setBlockTextureName("hardcoreenderexpansion:spooky_leaves"); | ||
|
|
||
| soul_charm = new BlockSoulCharm() | ||
| .setHardness(-1F).setResistance(6000000F) | ||
| .setBlockName("soulCharm").setBlockTextureName("hardcoreenderexpansion:empty"); | ||
|
|
||
| death_flower = new BlockEndFlower() | ||
| .setHardness(0F).setResistance(4F).setStepSound(Block.soundTypeGrass).setCreativeTab(null) | ||
| .setBlockName("endFlower").setBlockTextureName("hardcoreenderexpansion:end_flower"); | ||
|
|
||
| death_flower_pot = new BlockEndFlowerPot() | ||
| .setHardness(0F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("flowerPot").setBlockTextureName("flower_pot"); | ||
|
|
||
| enderman_head = new BlockEndermanHead() | ||
| .setHardness(1F).setStepSound(Block.soundTypeStone) | ||
| .setBlockName("endermanHead").setBlockTextureName("hardcoreenderexpansion:enderman_head"); | ||
|
|
||
| /*infestation_cauldron = new BlockInfestationRemedyCauldron() | ||
| .setHardness(2F) | ||
| .setBlockName("cauldron").setBlockTextureName("cauldron");*/ | ||
|
|
||
| sphalerite = new BlockSphalerite() | ||
| .setHardness(1.8F).setResistance(40F) | ||
| .setBlockName("sphalerite").setBlockTextureName("hardcoreenderexpansion:sphalerite"); | ||
|
|
||
| ravaged_brick = new BlockRavagedBrick() | ||
| .setHardness(2.5F).setResistance(15F).setStepSound(Block.soundTypePiston) | ||
| .setBlockName("ravagedBrick"); | ||
|
|
||
| dungeon_puzzle = new BlockDungeonPuzzle() | ||
| .setBlockUnbreakable().setResistance(6000000F).setStepSound(Block.soundTypeMetal) | ||
| .setBlockName("dungeonPuzzle"); | ||
|
|
||
| energy_cluster = new BlockEnergyCluster() | ||
| .setHardness(0.7F).setResistance(0.2F).setStepSound(BlockEnergyCluster.soundTypeEnergyCluster) | ||
| .setBlockName("energyCluster").setBlockTextureName("hardcoreenderexpansion:energy_cluster"); | ||
|
|
||
| corrupted_energy_high = new BlockCorruptedEnergy(true) | ||
| .setBlockUnbreakable().setResistance(6000000F); | ||
|
|
||
| corrupted_energy_low = new BlockCorruptedEnergy(false) | ||
| .setBlockUnbreakable().setResistance(6000000F); | ||
|
|
||
| laser_beam = new BlockLaserBeam() | ||
| .setBlockUnbreakable().setLightLevel(1F).setResistance(6000000F) | ||
| .setBlockName("laserBeam").setBlockTextureName("hardcoreenderexpansion:laser_beam"); | ||
|
|
||
| custom_spawner = new BlockCustomSpawner() | ||
| .setHardness(5F).setStepSound(Block.soundTypeMetal) | ||
| .setBlockName("mobSpawner").setBlockTextureName("mob_spawner"); | ||
|
|
||
| temple_end_portal = new BlockTempleEndPortal() | ||
| .setHardness(-1F).setResistance(6000000F) | ||
| .setBlockName("templeEndPortal"); | ||
|
|
||
| biome_core = new BlockBiomeIslandCore() | ||
| .setBlockUnbreakable().setStepSound(Block.soundTypeStone) | ||
| .setBlockName("biomeIslandCore").setBlockTextureName("bedrock"); | ||
|
|
||
| tabOrderedList.addBlocks( | ||
| obsidian_end,obsidian_special,obsidian_special_glow,obsidian_stairs, | ||
| essence_altar,decomposition_table,energy_extraction_table, | ||
| end_powder_ore,stardust_ore,igneous_rock_ore,instability_orb_ore,energy_cluster, | ||
| sphalerite,end_terrain,spooky_log,spooky_leaves,ravaged_brick,dungeon_puzzle, | ||
| crossed_decoration,death_flower | ||
| ); | ||
| } | ||
|
|
||
| private BlockList(){} // static class | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package chylex.hee.block; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockFalling; | ||
| import net.minecraft.block.BlockStone; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.entity.block.EntityBlockFallingObsidian; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
|
|
||
| public class BlockObsidianEnd extends BlockStone{ | ||
| public BlockObsidianEnd(){ | ||
| super(); | ||
| } | ||
|
|
||
| @Override | ||
| public void onBlockAdded(World world, int x, int y, int z){ | ||
| world.scheduleBlockUpdate(x,y,z,this,tickRate(world)); | ||
| } | ||
|
|
||
| @Override | ||
| public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor){ | ||
| world.scheduleBlockUpdate(x,y,z,this,tickRate(world)); | ||
| } | ||
|
|
||
| @Override | ||
| public void updateTick(World world, int x, int y, int z, Random rand){ | ||
| tryToFall(world,x,y,z); | ||
| } | ||
|
|
||
| private void tryToFall(World world, int x, int y, int z){ | ||
| if (BlockFalling.func_149831_e(world,x,y-1,z) && y >= 0 && !world.isRemote){ | ||
| world.spawnEntityInWorld(new EntityBlockFallingObsidian(world,x+0.5F,y+0.5F,z+0.5F)); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public int tickRate(World world){ | ||
| return 3; | ||
| } | ||
|
|
||
| @Override | ||
| public Item getItemDropped(int meta, Random rand, int fortune){ | ||
| return Item.getItemFromBlock(Blocks.obsidian); | ||
| } | ||
|
|
||
| @Override | ||
| public int quantityDropped(Random rand){ | ||
| return 1; | ||
| } | ||
|
|
||
| @Override | ||
| public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune){ | ||
| super.dropBlockAsItemWithChance(world,x,y,z,meta,chance,fortune); | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,6D))KnowledgeRegistrations.FALLING_OBSIDIAN.tryUnlockFragment(observer,1F,new short[]{ 2,3 }); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
| 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.util.IIcon; | ||
| import net.minecraft.world.World; | ||
| import chylex.hee.item.block.ItemBlockWithSubtypes.IBlockSubtypes; | ||
| import chylex.hee.mechanics.knowledge.KnowledgeRegistrations; | ||
| import chylex.hee.mechanics.knowledge.util.ObservationUtil; | ||
| import chylex.hee.proxy.ModCommonProxy; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
|
|
||
| public class BlockObsidianSpecial extends Block implements IBlockSubtypes{ | ||
| @SideOnly(Side.CLIENT) | ||
| private IIcon iconSmooth,iconPillar,iconPillarTop,iconChiseled,iconChiseledTop; | ||
|
|
||
| /* | ||
| * Metadata | ||
| * 0: smooth | ||
| * 1: chiseled | ||
| * 2: pillar - vertical | ||
| * 3: pillar - NS | ||
| * 4: pillar - EW | ||
| * 5: (smooth) downward particle spawner - 4 blocks | ||
| * 6: (chiseled) upward particle spawner - 5 blocks | ||
| */ | ||
|
|
||
| private final boolean isGlowing; | ||
|
|
||
| public BlockObsidianSpecial(boolean isGlowing){ | ||
| super(Material.rock); | ||
| this.isGlowing = isGlowing; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| if (meta == 1 || meta == 6)return side == 1 ? iconChiseledTop : iconChiseled; | ||
| else if (meta >= 2 && meta <= 4)return (meta == 2 && (side == 0 || side == 1)) || (meta == 3 && (side == 4 || side == 5)) || (meta == 4 && (side == 2 || side == 3))?iconPillarTop:iconPillar; | ||
| return iconSmooth; | ||
| } | ||
|
|
||
| @Override | ||
| public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta){ | ||
| if (meta == 2)meta = side == 0 || side == 1?2:side == 2 || side == 3?4:side == 4 || side == 5?3:meta; | ||
| return meta; | ||
| } | ||
|
|
||
| @Override | ||
| public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune){ | ||
| super.dropBlockAsItemWithChance(world,x,y,z,meta,chance,fortune); | ||
| for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,6D))KnowledgeRegistrations.OBSIDIAN_VARIATIONS.tryUnlockFragment(observer,0.4F); | ||
| } | ||
|
|
||
| @Override | ||
| public int damageDropped(int meta){ | ||
| return meta == 6 ? 1 : meta == 5 ? 0 : meta == 3 || meta == 4 ? 2 : meta; | ||
| } | ||
|
|
||
| @Override | ||
| protected ItemStack createStackedBlock(int meta){ | ||
| if (meta == 3 || meta == 4)return new ItemStack(this,1,2); | ||
| else if (meta == 5)return new ItemStack(this,1,0); | ||
| else if (meta == 6)return new ItemStack(this,1,1); | ||
| else return super.createStackedBlock(meta); | ||
| } | ||
|
|
||
| @Override | ||
| public int getRenderType(){ | ||
| return ModCommonProxy.renderIdObsidianSpecial; | ||
| } | ||
|
|
||
| @Override | ||
| public String getUnlocalizedName(ItemStack is){ | ||
| switch(is.getItemDamage()){ | ||
| default: return isGlowing ? "tile.obsidianSpecialGlowing.smooth" : "tile.obsidianSpecial.smooth"; | ||
| case 1: return isGlowing ? "tile.obsidianSpecialGlowing.chiseled" : "tile.obsidianSpecial.chiseled"; | ||
| case 2: return isGlowing ? "tile.obsidianSpecialGlowing.pillar" : "tile.obsidianSpecial.pillar"; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void randomDisplayTick(World world, int x, int y, int z, Random rand){ | ||
| int meta = world.getBlockMetadata(x,y,z); | ||
|
|
||
| if (meta == 5){ | ||
| for(int a = 0; a < 10; a++){ | ||
| world.spawnParticle("portal",(x+rand.nextFloat()),(y-4F*rand.nextFloat()),(z+rand.nextFloat()),0D,0D,0D); | ||
| world.spawnParticle("largesmoke",(x+rand.nextFloat()),(y-4F*rand.nextFloat()),(z+rand.nextFloat()),0D,0D,0D); | ||
| } | ||
| } | ||
| else if (meta == 6){ | ||
| for(int a = 0; a < 30; a++){ | ||
| world.spawnParticle("portal",(x+rand.nextFloat()),(y+5F*rand.nextFloat()),(z+rand.nextFloat()),0D,0D,0D); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| list.add(new ItemStack(item,1,0)); | ||
| list.add(new ItemStack(item,1,1)); | ||
| list.add(new ItemStack(item,1,2)); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| iconSmooth = iconRegister.registerIcon("hardcoreenderexpansion:obsidian_smooth"); | ||
| iconPillar = iconRegister.registerIcon("hardcoreenderexpansion:obsidian_pillar"); | ||
| iconPillarTop = iconRegister.registerIcon("hardcoreenderexpansion:obsidian_pillar_top"); | ||
| iconChiseled = iconRegister.registerIcon("hardcoreenderexpansion:obsidian_chiseled"); | ||
| iconChiseledTop = iconRegister.registerIcon("hardcoreenderexpansion:obsidian_chiseled_top"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package chylex.hee.block; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.BlockStairs; | ||
|
|
||
| public class BlockObsidianStairs extends BlockStairs{ | ||
| public BlockObsidianStairs(Block sourceBlock, int sourceMetadata){ | ||
| super(sourceBlock,sourceMetadata); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package chylex.hee.block; | ||
| import java.util.List; | ||
| import cpw.mods.fml.relauncher.Side; | ||
| import cpw.mods.fml.relauncher.SideOnly; | ||
| import chylex.hee.item.block.ItemBlockWithSubtypes.IBlockSubtypes; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
| import net.minecraft.client.renderer.texture.IIconRegister; | ||
| import net.minecraft.creativetab.CreativeTabs; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.IIcon; | ||
|
|
||
| public class BlockRavagedBrick extends Block implements IBlockSubtypes{ | ||
| public static byte metaNormal = 0, metaCracked = 1, metaDamaged1 = 2, metaDamaged2 = 3, metaDamaged3 = 4, metaAmount = 5; | ||
|
|
||
| @SideOnly(Side.CLIENT) | ||
| private IIcon[] iconArray; | ||
|
|
||
| public BlockRavagedBrick(){ | ||
| super(Material.rock); | ||
| } | ||
|
|
||
| @Override | ||
| public String getUnlocalizedName(ItemStack is){ | ||
| return getUnlocalizedName(); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void getSubBlocks(Item item, CreativeTabs tab, List list){ | ||
| for(int a = 0; a < metaAmount; a++)list.add(new ItemStack(item,1,a)); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public IIcon getIcon(int side, int meta){ | ||
| return meta >= metaDamaged1 && meta <= metaDamaged3 && (side == 0 || side == 1) ? iconArray[0] : iconArray[meta < metaAmount ? meta : 0]; | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void registerBlockIcons(IIconRegister iconRegister){ | ||
| iconArray = new IIcon[metaAmount]; | ||
| iconArray[0] = iconRegister.registerIcon("hardcoreenderexpansion:ravaged_brick"); | ||
| iconArray[1] = iconRegister.registerIcon("hardcoreenderexpansion:ravaged_brick_cracked"); | ||
| iconArray[2] = iconRegister.registerIcon("hardcoreenderexpansion:ravaged_brick_damaged_1"); | ||
| iconArray[3] = iconRegister.registerIcon("hardcoreenderexpansion:ravaged_brick_damaged_2"); | ||
| iconArray[4] = iconRegister.registerIcon("hardcoreenderexpansion:ravaged_brick_damaged_3"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| package chylex.hee.block; | ||
| import java.lang.reflect.Field; | ||
| import java.lang.reflect.Modifier; | ||
| import java.util.Map; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.ItemBlock; | ||
| import net.minecraft.util.ObjectIntIdentityMap; | ||
| import net.minecraft.util.RegistryNamespaced; | ||
| import net.minecraft.util.RegistrySimple; | ||
| import chylex.hee.system.util.DragonUtil; | ||
| import chylex.hee.system.util.TimeMeasurement; | ||
| import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; | ||
| import cpw.mods.fml.common.registry.GameData; | ||
|
|
||
| public class BlockReplaceHelper{ | ||
| public static void replaceBlock(Block toReplace, Class<? extends Block> blockClass){ | ||
| TimeMeasurement.start("BlockReplace"); | ||
|
|
||
| Field modifiersField = null; | ||
| Class<?>[] classTest = new Class<?>[3]; | ||
|
|
||
| try{ | ||
| modifiersField = Field.class.getDeclaredField("modifiers"); | ||
| modifiersField.setAccessible(true); | ||
|
|
||
| for(Field blockField:Blocks.class.getDeclaredFields()){ | ||
| if (Block.class.isAssignableFrom(blockField.getType())){ | ||
| Block block = (Block)blockField.get(null); | ||
|
|
||
| if (block == toReplace){ | ||
| String registryName = Block.blockRegistry.getNameForObject(block); | ||
| int id = Block.getIdFromBlock(block); | ||
| ItemBlock item = (ItemBlock)Item.getItemFromBlock(block); | ||
| DragonUtil.info("Replacing block - "+id+"/"+registryName); | ||
|
|
||
| Block newBlock = blockClass.newInstance(); | ||
| FMLControlledNamespacedRegistry<Block> registry = GameData.getBlockRegistry(); | ||
| Field map = RegistrySimple.class.getDeclaredFields()[1]; | ||
| map.setAccessible(true); | ||
| ((Map)map.get(registry)).put(registryName,newBlock); | ||
|
|
||
| map = RegistryNamespaced.class.getDeclaredFields()[0]; | ||
| map.setAccessible(true); | ||
| ((ObjectIntIdentityMap)map.get(registry)).func_148746_a(newBlock,id); // OBFUSCATED put object | ||
|
|
||
| blockField.setAccessible(true); | ||
| modifiersField.setInt(blockField,modifiersField.getInt(blockField) & ~Modifier.FINAL); | ||
| blockField.set(null,newBlock); | ||
|
|
||
| Field itemBlockField = ItemBlock.class.getDeclaredFields()[0]; | ||
| itemBlockField.setAccessible(true); | ||
| modifiersField.setInt(itemBlockField,modifiersField.getInt(itemBlockField) & ~Modifier.FINAL); | ||
| itemBlockField.set(item,newBlock); | ||
|
|
||
| classTest[0] = blockField.get(null).getClass(); | ||
| classTest[1] = Block.blockRegistry.getObjectById(id).getClass(); | ||
| classTest[2] = ((ItemBlock)Item.getItemFromBlock(newBlock)).field_150939_a.getClass(); | ||
| } | ||
| } | ||
| } | ||
| }catch(Exception e){ | ||
| e.printStackTrace(); | ||
| } | ||
|
|
||
| TimeMeasurement.finish("BlockReplace"); | ||
|
|
||
| DragonUtil.info("Check field: "+classTest[0]); | ||
| DragonUtil.info("Check registry: "+classTest[1]); | ||
| DragonUtil.info("Check item: "+classTest[2]); | ||
|
|
||
| if (classTest[0] != classTest[1] || classTest[0] != classTest[2] || classTest[0] == null){ | ||
| throw new RuntimeException("Failed class test, replacing "+toReplace.getUnlocalizedName()+" failed!"); | ||
| } | ||
| } | ||
| } |