Search in sources :

Example 1 with SlabBlock

use of net.minecraft.block.SlabBlock in project NetherEx by LogicTechCorp.

the class DataGenerationHandler method gatherLootTables.

private static IDataProvider gatherLootTables(DataGenerator generator) {
    ModLootTableProvider provider = new ModLootTableProvider(NetherEx.MOD_ID, generator);
    // Block loot tables
    for (Block block : ForgeRegistries.BLOCKS) {
        if (block.getRegistryName().getNamespace().equals(NetherEx.MOD_ID)) {
            if (block == NetherExBlocks.QUARTZ_ORE.get()) {
                continue;
            }
            if (block.getLootTable() != LootTables.EMPTY) {
                if (block instanceof SlabBlock) {
                    provider.addSlabBlockLootTable(block);
                } else {
                    provider.addBasicBlockLootTable(block);
                }
            }
        }
    }
    provider.addOreBlockLootTable(NetherExBlocks.RIME_ORE.get(), NetherExItems.RIME_CRYSTAL.get());
    provider.addSilkBlockLootTable(NetherExBlocks.BROWN_ELDER_MUSHROOM_CAP.get());
    provider.addSilkBlockLootTable(NetherExBlocks.RED_ELDER_MUSHROOM_CAP.get());
    provider.addSilkBlockLootTable(NetherExBlocks.ELDER_MUSHROOM_STEM.get());
    provider.addSilkBlockLootTable(NetherExBlocks.SOUL_GLASS.get());
    provider.addSilkBlockLootTable(NetherExBlocks.SOUL_GLASS_PANE.get());
    // Entity loot tables
    provider.addEmptyEntityLootTable(NetherExEntityTypes.MOGUS.get());
    provider.addBasicEntityLootTable(MogusEntity.Variant.BROWN.getLootTable(), NetherExBlocks.BROWN_ELDER_MUSHROOM.get());
    provider.addBasicEntityLootTable(MogusEntity.Variant.RED.getLootTable(), NetherExBlocks.RED_ELDER_MUSHROOM.get());
    provider.addBasicEntityLootTable(MogusEntity.Variant.WHITE.getLootTable(), NetherExItems.ENOKI_MUSHROOM.get());
    provider.addEmptyEntityLootTable(NetherExEntityTypes.SALAMANDER.get());
    provider.addBasicEntityLootTable(SalamanderEntity.Variant.ORANGE.getLootTable(), NetherExItems.ORANGE_SALAMANDER_HIDE.get());
    provider.addBasicEntityLootTable(SalamanderEntity.Variant.BLACK.getLootTable(), NetherExItems.BLACK_SALAMANDER_HIDE.get());
    provider.addBasicEntityLootTable(NetherExEntityTypes.SPINOUT.get(), Items.QUARTZ);
    provider.addEmptyEntityLootTable(NetherExEntityTypes.SPORE.get());
    provider.addBasicEntityLootTable(NetherExEntityTypes.SPORE_CREEPER.get(), NetherExItems.SPORE.get());
    provider.addBasicEntityLootTable(NetherExEntityTypes.WIGHT.get(), NetherExItems.RIME_CRYSTAL.get());
    provider.addBasicEntityLootTable(NetherExEntityTypes.COOLMAR_SPIDER.get(), NetherExItems.COOLMAR_SPIDER_FANG.get());
    return provider;
}
Also used : ModLootTableProvider(logictechcorp.libraryex.data.loottable.ModLootTableProvider) SlabBlock(net.minecraft.block.SlabBlock) SlabBlock(net.minecraft.block.SlabBlock) Block(net.minecraft.block.Block)

Example 2 with SlabBlock

use of net.minecraft.block.SlabBlock in project Client by MatHax.

the class SelfProtect method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    if (antiAnchorAura.get() && mc.world.getBlockState(mc.player.getBlockPos().up(2)).getBlock() == Blocks.RESPAWN_ANCHOR && mc.world.getBlockState(mc.player.getBlockPos().up()).getBlock() == Blocks.AIR)
        BlockUtils.place(mc.player.getBlockPos().add(0, 1, 0), InvUtils.findInHotbar(itemStack -> Block.getBlockFromItem(itemStack.getItem()) instanceof SlabBlock), rotate.get(), 15, swing.get(), false, true);
    BlockPos top = mc.player.getBlockPos().up(2);
    if (antiCEVBreaker.get() && mc.world.getBlockState(top).getBlock() == Blocks.OBSIDIAN) {
        Iterator<Entity> iterator = mc.world.getEntities().iterator();
        coder: while (true) {
            while (true) {
                if (!iterator.hasNext())
                    break coder;
                Entity crystal = iterator.next();
                if (crystal instanceof EndCrystalEntity && crystal.getBlockPos().equals(top.up())) {
                    mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.attack(crystal, mc.player.isSneaking()));
                    ceved = true;
                } else if (ceved) {
                    BlockUtils.place(top.up(), InvUtils.findInHotbar(Items.OBSIDIAN), rotate.get(), 50, true);
                    ceved = false;
                }
            }
        }
    }
    if (antiTNTAura.get()) {
        if (mc.world.getBlockState(top).getBlock().equals(Blocks.TNT)) {
            if (rotate.get())
                Rotations.rotate(Rotations.getYaw(top), Rotations.getPitch(top), () -> mine(top));
            else
                mine(top);
            tntAured = true;
        } else if (tntAured) {
            if (placeObsidian.get())
                BlockUtils.place(top, InvUtils.findInHotbar(Items.OBSIDIAN), rotate.get(), 50, true);
            tntAured = false;
        }
    }
    if (antiBedAura.get()) {
        if (onlyInHole.get() && !PlayerUtils.isInHole2(true))
            return;
        BlockPos head = mc.player.getBlockPos().up();
        if (mc.world.getBlockState(head).getBlock() instanceof BedBlock && !breaking) {
            Rotations.rotate(Rotations.getYaw(head), Rotations.getPitch(head), 50, () -> sendMinePackets(head));
            breaking = true;
        } else if (breaking) {
            Rotations.rotate(Rotations.getYaw(head), Rotations.getPitch(head), 50, () -> sendStopPackets(head));
            breaking = false;
        }
        if (smart.get()) {
            if (mc.world.getBlockState(head).getBlock() instanceof BedBlock)
                bedAured = true;
            else if (bedAured) {
                if (placeStringTop.get())
                    place(mc.player.getBlockPos().up(2));
                if (placeStringMiddle.get())
                    place(mc.player.getBlockPos().up(1));
                if (placeStringBottom.get())
                    place(mc.player.getBlockPos());
                tntAured = false;
            }
        } else if (!smart.get()) {
            if (placeStringTop.get())
                place(mc.player.getBlockPos().up(2));
            if (placeStringMiddle.get())
                place(mc.player.getBlockPos().up(1));
            if (placeStringBottom.get())
                place(mc.player.getBlockPos());
        }
    }
}
Also used : BedBlock(net.minecraft.block.BedBlock) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) SlabBlock(net.minecraft.block.SlabBlock) BlockPos(net.minecraft.util.math.BlockPos) EventHandler(mathax.client.eventbus.EventHandler)

Aggregations

SlabBlock (net.minecraft.block.SlabBlock)2 ModLootTableProvider (logictechcorp.libraryex.data.loottable.ModLootTableProvider)1 EventHandler (mathax.client.eventbus.EventHandler)1 BedBlock (net.minecraft.block.BedBlock)1 Block (net.minecraft.block.Block)1 Entity (net.minecraft.entity.Entity)1 EndCrystalEntity (net.minecraft.entity.decoration.EndCrystalEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1