Search in sources :

Example 81 with EnumFacing

use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.

the class BlockFluidLavaBaseMP method checkForMixing.

protected boolean checkForMixing(World world, BlockPos pos, IBlockState state) {
    boolean flag = false;
    EnumFacing[] aenumfacing = EnumFacing.VALUES;
    int i = aenumfacing.length;
    for (int j = 0; j < i; ++j) {
        EnumFacing enumfacing = aenumfacing[j];
        if (enumfacing != EnumFacing.DOWN && world.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER) {
            flag = true;
            break;
        }
    }
    if (flag) {
        Integer integer = state.getValue(LEVEL);
        if (integer.intValue() == 0) {
            world.setBlockState(pos, this.getObsidianBlock());
            this.triggerMixEffects(world, pos);
            return true;
        }
        if (integer.intValue() <= 4) {
            world.setBlockState(pos, this.getCobblestoneBlock());
            this.triggerMixEffects(world, pos);
            return true;
        }
    }
    return false;
}
Also used : EnumFacing(net.minecraft.util.EnumFacing)

Example 82 with EnumFacing

use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.

the class BlockCrystallizeTorch method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    EnumFacing enumfacing = state.getValue(FACING);
    double d0 = pos.getX() + 0.5D;
    double d1 = pos.getY() + 0.7D;
    double d2 = pos.getZ() + 0.5D;
    double d3 = 0.22D;
    double d4 = 0.27D;
    if (enumfacing.getAxis().isHorizontal()) {
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4 * enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D);
        MorePlanetsCore.PROXY.spawnParticle(EnumParticleTypesMP.CRYSTALLIZE_FLAME, d0 + d4 * enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * enumfacing1.getFrontOffsetZ());
    } else {
        world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D);
        MorePlanetsCore.PROXY.spawnParticle(EnumParticleTypesMP.CRYSTALLIZE_FLAME, d0, d1, d2);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 83 with EnumFacing

use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.

the class BlockFluidCrystallizeLava method checkForMixing.

@Override
protected boolean checkForMixing(World world, BlockPos pos, IBlockState state) {
    boolean flag = false;
    EnumFacing[] aenumfacing = EnumFacing.VALUES;
    int i = aenumfacing.length;
    for (int j = 0; j < i; ++j) {
        EnumFacing enumfacing = aenumfacing[j];
        if (enumfacing != EnumFacing.DOWN && world.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER) {
            flag = true;
            break;
        }
    }
    if (flag) {
        Integer integer = state.getValue(LEVEL);
        if (integer.intValue() == 0) {
            world.setBlockState(pos, this.getObsidianBlock());
            this.triggerMixEffects(world, pos);
            if (world.rand.nextInt(500) == 0) {
                Block.spawnAsEntity(world, pos.up(), new ItemStack(DionaItems.DIONA_ITEM, 1, 4));
            }
            return true;
        }
        if (integer.intValue() <= 4) {
            world.setBlockState(pos, this.getCobblestoneBlock());
            this.triggerMixEffects(world, pos);
            return true;
        }
    }
    return false;
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) ItemStack(net.minecraft.item.ItemStack)

Example 84 with EnumFacing

use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.

the class WorldGenInfectedDeadSavannaTree method generate.

@Override
public boolean generate(World world, Random rand, BlockPos pos) {
    int i = rand.nextInt(3) + rand.nextInt(3) + 5;
    boolean flag = true;
    if (pos.getY() >= 1 && pos.getY() + i + 1 <= 256) {
        for (int j = pos.getY(); j <= pos.getY() + 1 + i; ++j) {
            int k = 1;
            if (j == pos.getY()) {
                k = 0;
            }
            if (j >= pos.getY() + 1 + i - 2) {
                k = 2;
            }
            BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
            for (int l = pos.getX() - k; l <= pos.getX() + k && flag; ++l) {
                for (int i1 = pos.getZ() - k; i1 <= pos.getZ() + k && flag; ++i1) {
                    if (j >= 0 && j < 256) {
                        if (!this.isReplaceable(world, blockpos$mutableblockpos.setPos(l, j, i1))) {
                            flag = false;
                        }
                    } else {
                        flag = false;
                    }
                }
            }
        }
        if (!flag) {
            return false;
        } else {
            BlockPos down = pos.down();
            Block block = world.getBlockState(down).getBlock();
            if ((block == NibiruBlocks.INFECTED_GRASS || block == NibiruBlocks.INFECTED_DIRT || block == NibiruBlocks.INFECTED_FARMLAND) && pos.getY() < 256 - i - 1) {
                block.onPlantGrow(world.getBlockState(down), world, down, pos);
                EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
                int k2 = i - rand.nextInt(4) - 1;
                int l2 = 3 - rand.nextInt(3);
                int i3 = pos.getX();
                int j1 = pos.getZ();
                int k1 = 0;
                for (int l1 = 0; l1 < i; ++l1) {
                    int i2 = pos.getY() + l1;
                    if (l1 >= k2 && l2 > 0) {
                        i3 += enumfacing.getFrontOffsetX();
                        j1 += enumfacing.getFrontOffsetZ();
                        --l2;
                    }
                    BlockPos blockpos = new BlockPos(i3, i2, j1);
                    block = world.getBlockState(blockpos).getBlock();
                    if (block.isAir(world.getBlockState(blockpos), world, blockpos) || block.isLeaves(world.getBlockState(blockpos), world, blockpos)) {
                        this.placeLogAt(world, blockpos);
                        k1 = i2;
                    }
                }
                BlockPos blockpos2 = new BlockPos(i3, k1, j1);
                for (int j3 = -3; j3 <= 3; ++j3) {
                    for (int i4 = -3; i4 <= 3; ++i4) {
                        if (Math.abs(j3) != 3 || Math.abs(i4) != 3) {
                            this.placeLeafAt(world, blockpos2.add(j3, 0, i4));
                        }
                    }
                }
                blockpos2 = blockpos2.up();
                for (int k3 = -1; k3 <= 1; ++k3) {
                    for (int j4 = -1; j4 <= 1; ++j4) {
                        this.placeLeafAt(world, blockpos2.add(k3, 0, j4));
                    }
                }
                this.placeLeafAt(world, blockpos2.east(2));
                this.placeLeafAt(world, blockpos2.west(2));
                this.placeLeafAt(world, blockpos2.south(2));
                this.placeLeafAt(world, blockpos2.north(2));
                i3 = pos.getX();
                j1 = pos.getZ();
                EnumFacing enumfacing1 = EnumFacing.Plane.HORIZONTAL.random(rand);
                if (enumfacing1 != enumfacing) {
                    int l3 = k2 - rand.nextInt(2) - 1;
                    int k4 = 1 + rand.nextInt(3);
                    k1 = 0;
                    for (int l4 = l3; l4 < i && k4 > 0; --k4) {
                        if (l4 >= 1) {
                            int j2 = pos.getY() + l4;
                            i3 += enumfacing1.getFrontOffsetX();
                            j1 += enumfacing1.getFrontOffsetZ();
                            BlockPos blockpos1 = new BlockPos(i3, j2, j1);
                            block = world.getBlockState(blockpos1).getBlock();
                            if (block.isAir(world.getBlockState(blockpos1), world, blockpos2) || block.isLeaves(world.getBlockState(blockpos1), world, blockpos2)) {
                                this.placeLogAt(world, blockpos1);
                                k1 = j2;
                            }
                        }
                        ++l4;
                    }
                    if (k1 > 0) {
                        BlockPos blockpos3 = new BlockPos(i3, k1, j1);
                        for (int i5 = -2; i5 <= 2; ++i5) {
                            for (int k5 = -2; k5 <= 2; ++k5) {
                                if (Math.abs(i5) != 2 || Math.abs(k5) != 2) {
                                    this.placeLeafAt(world, blockpos3.add(i5, 0, k5));
                                }
                            }
                        }
                        blockpos3 = blockpos3.up();
                        for (int j5 = -1; j5 <= 1; ++j5) {
                            for (int l5 = -1; l5 <= 1; ++l5) {
                                this.placeLeafAt(world, blockpos3.add(j5, 0, l5));
                            }
                        }
                    }
                }
                return true;
            } else {
                return false;
            }
        }
    } else {
        return false;
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos)

Example 85 with EnumFacing

use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.

the class CapabilityHandlerMP method register.

public static void register() {
    CapabilityManager.INSTANCE.register(MorePlanetsCapabilityData.class, new Capability.IStorage<MorePlanetsCapabilityData>() {

        @Override
        public NBTBase writeNBT(Capability<MorePlanetsCapabilityData> capability, MorePlanetsCapabilityData instance, EnumFacing side) {
            NBTTagCompound nbt = new NBTTagCompound();
            instance.writeNBT(nbt);
            return nbt;
        }

        @Override
        public void readNBT(Capability<MorePlanetsCapabilityData> capability, MorePlanetsCapabilityData instance, EnumFacing side, NBTBase nbt) {
            instance.readNBT((NBTTagCompound) nbt);
        }
    }, MPCapData::new);
    CommonRegisterHelper.registerForgeEvent(new CapabilityHandlerMP());
}
Also used : Capability(net.minecraftforge.common.capabilities.Capability) NBTBase(net.minecraft.nbt.NBTBase) EnumFacing(net.minecraft.util.EnumFacing) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

EnumFacing (net.minecraft.util.EnumFacing)1673 BlockPos (net.minecraft.util.math.BlockPos)491 IBlockState (net.minecraft.block.state.IBlockState)403 TileEntity (net.minecraft.tileentity.TileEntity)392 ItemStack (net.minecraft.item.ItemStack)192 Block (net.minecraft.block.Block)158 ArrayList (java.util.ArrayList)121 World (net.minecraft.world.World)114 Vec3d (net.minecraft.util.math.Vec3d)104 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)98 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)88 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)73 EntityPlayer (net.minecraft.entity.player.EntityPlayer)65 FluidStack (net.minecraftforge.fluids.FluidStack)65 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)63 Nullable (javax.annotation.Nullable)51 List (java.util.List)48 Nonnull (javax.annotation.Nonnull)47 HashSet (java.util.HashSet)43 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)43