Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arcanephysics.arkoddities.enchantments;
- import arcanephysics.arkoddities.util.Reference;
- import net.minecraft.block.BlockLiquid;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.enchantment.Enchantment;
- import net.minecraft.enchantment.EnumEnchantmentType;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.init.Blocks;
- import net.minecraft.init.Enchantments;
- import net.minecraft.inventory.EntityEquipmentSlot;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.math.MathHelper;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.common.Mod;
- public class EnchantmentMeltingCurse extends Enchantment
- {
- public EnchantmentMeltingCurse()
- {
- super(Rarity.RARE, EnumEnchantmentType.ARMOR_FEET, new EntityEquipmentSlot[] {EntityEquipmentSlot.FEET});
- this.setRegistryName("meltingCurse");
- this.setName("meltingCurse");
- }
- public int getMinEnchantability(int enchantmentLevel)
- {
- return enchantmentLevel * 10;
- }
- public int getMaxEnchantability(int enchantmentLevel)
- {
- return this.getMinEnchantability(enchantmentLevel) + 15;
- }
- public boolean isTreasureEnchantment()
- {
- return true;
- }
- public int getMaxLevel()
- {
- return 2;
- }
- public static void freezeNearby(EntityLivingBase living, World worldIn, BlockPos pos, int level)
- {
- if (living.onGround)
- {
- float f = (float)Math.min(16, 2 + level);
- BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(0, 0, 0);
- for (BlockPos.MutableBlockPos blockpos$mutableblockpos1 : BlockPos.getAllInBoxMutable(pos.add((double)(-f), -1.0D, (double)(-f)), pos.add((double)f, -1.0D, (double)f)))
- {
- if (blockpos$mutableblockpos1.distanceSqToCenter(living.posX, living.posY, living.posZ) <= (double)(f * f))
- {
- blockpos$mutableblockpos.setPos(blockpos$mutableblockpos1.getX(), blockpos$mutableblockpos1.getY() + 1, blockpos$mutableblockpos1.getZ());
- IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos);
- if (iblockstate.getMaterial() == Material.AIR)
- {
- IBlockState iblockstate1 = worldIn.getBlockState(blockpos$mutableblockpos1);
- if (iblockstate1.getMaterial() == Material.WATER && (iblockstate1.getBlock() == net.minecraft.init.Blocks.FROSTED_ICE || iblockstate1.getBlock() == net.minecraft.init.Blocks.FLOWING_WATER) && ((Integer)iblockstate1.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.mayPlace(Blocks.FROSTED_ICE, blockpos$mutableblockpos1, false, EnumFacing.DOWN, (Entity)null))
- {
- worldIn.setBlockState(blockpos$mutableblockpos1, Blocks.FROSTED_ICE.getDefaultState());
- worldIn.scheduleUpdate(blockpos$mutableblockpos1.toImmutable(), Blocks.FROSTED_ICE, MathHelper.getInt(living.getRNG(), 60, 120));
- }
- }
- }
- }
- }
- }
- public boolean canApplyTogether(Enchantment ench)
- {
- return super.canApplyTogether(ench) && ench != Enchantments.DEPTH_STRIDER;
- }
- public boolean isCurse()
- {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement