Search in sources :

Example 1 with Blocks

use of net.minecraft.init.Blocks in project GregTech by GregTechCE.

the class OreDictionaryLoader method init.

public static void init() {
    GTLog.logger.info("Registering OreDict entries.");
    // Simulating oredict registration for vanilla items.
    // Because forge registers event handlers after registering oredicts for vanilla items
    Multimap<String, Object> oreDicts = LinkedListMultimap.create();
    // tree- and wood-related things
    oreDicts.put("logWood", new ItemStack(Blocks.LOG, 1, WILDCARD_VALUE));
    oreDicts.put("logWood", new ItemStack(Blocks.LOG2, 1, WILDCARD_VALUE));
    oreDicts.put("plankWood", new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE));
    oreDicts.put("slabWood", new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE));
    oreDicts.put("stairWood", Blocks.OAK_STAIRS);
    oreDicts.put("stairWood", Blocks.SPRUCE_STAIRS);
    oreDicts.put("stairWood", Blocks.BIRCH_STAIRS);
    oreDicts.put("stairWood", Blocks.JUNGLE_STAIRS);
    oreDicts.put("stairWood", Blocks.ACACIA_STAIRS);
    oreDicts.put("stairWood", Blocks.DARK_OAK_STAIRS);
    oreDicts.put("stickWood", Items.STICK);
    oreDicts.put("treeSapling", new ItemStack(Blocks.SAPLING, 1, WILDCARD_VALUE));
    oreDicts.put("treeLeaves", new ItemStack(Blocks.LEAVES, 1, WILDCARD_VALUE));
    oreDicts.put("treeLeaves", new ItemStack(Blocks.LEAVES2, 1, WILDCARD_VALUE));
    oreDicts.put("vine", Blocks.VINE);
    // Ores
    oreDicts.put("oreGold", Blocks.GOLD_ORE);
    oreDicts.put("oreIron", Blocks.IRON_ORE);
    oreDicts.put("oreLapis", Blocks.LAPIS_ORE);
    oreDicts.put("oreDiamond", Blocks.DIAMOND_ORE);
    oreDicts.put("oreRedstone", Blocks.REDSTONE_ORE);
    oreDicts.put("oreEmerald", Blocks.EMERALD_ORE);
    oreDicts.put("oreQuartz", Blocks.QUARTZ_ORE);
    oreDicts.put("oreCoal", Blocks.COAL_ORE);
    // ingots/nuggets
    oreDicts.put("ingotIron", Items.IRON_INGOT);
    oreDicts.put("ingotGold", Items.GOLD_INGOT);
    oreDicts.put("ingotBrick", Items.BRICK);
    oreDicts.put("ingotBrickNether", Items.NETHERBRICK);
    oreDicts.put("nuggetGold", Items.GOLD_NUGGET);
    oreDicts.put("nuggetIron", Items.IRON_NUGGET);
    // gems and dusts
    oreDicts.put("gemDiamond", Items.DIAMOND);
    oreDicts.put("gemEmerald", Items.EMERALD);
    oreDicts.put("gemQuartz", Items.QUARTZ);
    oreDicts.put("gemPrismarine", Items.PRISMARINE_SHARD);
    oreDicts.put("dustPrismarine", Items.PRISMARINE_CRYSTALS);
    oreDicts.put("dustRedstone", Items.REDSTONE);
    oreDicts.put("dustGlowstone", Items.GLOWSTONE_DUST);
    oreDicts.put("gemLapis", new ItemStack(Items.DYE, 1, 4));
    // storage blocks
    oreDicts.put("blockGold", Blocks.GOLD_BLOCK);
    oreDicts.put("blockIron", Blocks.IRON_BLOCK);
    oreDicts.put("blockLapis", Blocks.LAPIS_BLOCK);
    oreDicts.put("blockDiamond", Blocks.DIAMOND_BLOCK);
    oreDicts.put("blockRedstone", Blocks.REDSTONE_BLOCK);
    oreDicts.put("blockEmerald", Blocks.EMERALD_BLOCK);
    oreDicts.put("blockQuartz", Blocks.QUARTZ_BLOCK);
    oreDicts.put("blockCoal", Blocks.COAL_BLOCK);
    // crops
    oreDicts.put("cropWheat", Items.WHEAT);
    oreDicts.put("cropPotato", Items.POTATO);
    oreDicts.put("cropCarrot", Items.CARROT);
    oreDicts.put("cropNetherWart", Items.NETHER_WART);
    oreDicts.put("sugarcane", Items.REEDS);
    oreDicts.put("blockCactus", Blocks.CACTUS);
    // misc materials
    oreDicts.put("dye", new ItemStack(Items.DYE, 1, WILDCARD_VALUE));
    oreDicts.put("paper", new ItemStack(Items.PAPER));
    // mob drops
    oreDicts.put("slimeball", Items.SLIME_BALL);
    oreDicts.put("enderpearl", Items.ENDER_PEARL);
    oreDicts.put("bone", Items.BONE);
    oreDicts.put("gunpowder", Items.GUNPOWDER);
    oreDicts.put("string", Items.STRING);
    oreDicts.put("netherStar", Items.NETHER_STAR);
    oreDicts.put("leather", Items.LEATHER);
    oreDicts.put("feather", Items.FEATHER);
    oreDicts.put("egg", Items.EGG);
    // records
    oreDicts.put("record", Items.RECORD_13);
    oreDicts.put("record", Items.RECORD_CAT);
    oreDicts.put("record", Items.RECORD_BLOCKS);
    oreDicts.put("record", Items.RECORD_CHIRP);
    oreDicts.put("record", Items.RECORD_FAR);
    oreDicts.put("record", Items.RECORD_MALL);
    oreDicts.put("record", Items.RECORD_MELLOHI);
    oreDicts.put("record", Items.RECORD_STAL);
    oreDicts.put("record", Items.RECORD_STRAD);
    oreDicts.put("record", Items.RECORD_WARD);
    oreDicts.put("record", Items.RECORD_11);
    oreDicts.put("record", Items.RECORD_WAIT);
    // blocks
    oreDicts.put("dirt", Blocks.DIRT);
    oreDicts.put("grass", Blocks.GRASS);
    oreDicts.put("stone", Blocks.STONE);
    oreDicts.put("cobblestone", Blocks.COBBLESTONE);
    oreDicts.put("gravel", Blocks.GRAVEL);
    oreDicts.put("sand", new ItemStack(Blocks.SAND, 1, WILDCARD_VALUE));
    oreDicts.put("sandstone", new ItemStack(Blocks.SANDSTONE, 1, WILDCARD_VALUE));
    oreDicts.put("sandstone", new ItemStack(Blocks.RED_SANDSTONE, 1, WILDCARD_VALUE));
    oreDicts.put("netherrack", Blocks.NETHERRACK);
    oreDicts.put("obsidian", Blocks.OBSIDIAN);
    oreDicts.put("glowstone", Blocks.GLOWSTONE);
    oreDicts.put("endstone", Blocks.END_STONE);
    oreDicts.put("torch", Blocks.TORCH);
    oreDicts.put("workbench", Blocks.CRAFTING_TABLE);
    oreDicts.put("blockSlime", Blocks.SLIME_BLOCK);
    oreDicts.put("blockPrismarine", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.ROUGH.getMetadata()));
    oreDicts.put("blockPrismarineBrick", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.BRICKS.getMetadata()));
    oreDicts.put("blockPrismarineDark", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.DARK.getMetadata()));
    oreDicts.put("stoneGranite", new ItemStack(Blocks.STONE, 1, 1));
    oreDicts.put("stoneGranitePolished", new ItemStack(Blocks.STONE, 1, 2));
    oreDicts.put("stoneDiorite", new ItemStack(Blocks.STONE, 1, 3));
    oreDicts.put("stoneDioritePolished", new ItemStack(Blocks.STONE, 1, 4));
    oreDicts.put("stoneAndesite", new ItemStack(Blocks.STONE, 1, 5));
    oreDicts.put("stoneAndesitePolished", new ItemStack(Blocks.STONE, 1, 6));
    oreDicts.put("blockGlassColorless", Blocks.GLASS);
    oreDicts.put("blockGlass", Blocks.GLASS);
    oreDicts.put("blockGlass", new ItemStack(Blocks.STAINED_GLASS, 1, WILDCARD_VALUE));
    // blockGlass{Color} is added below with dyes
    oreDicts.put("paneGlassColorless", Blocks.GLASS_PANE);
    oreDicts.put("paneGlass", Blocks.GLASS_PANE);
    oreDicts.put("paneGlass", new ItemStack(Blocks.STAINED_GLASS_PANE, 1, WILDCARD_VALUE));
    // paneGlass{Color} is added below with dyes
    // chests
    oreDicts.put("chest", Blocks.CHEST);
    oreDicts.put("chest", Blocks.ENDER_CHEST);
    oreDicts.put("chest", Blocks.TRAPPED_CHEST);
    oreDicts.put("chestWood", Blocks.CHEST);
    oreDicts.put("chestEnder", Blocks.ENDER_CHEST);
    oreDicts.put("chestTrapped", Blocks.TRAPPED_CHEST);
    // Register dyes
    String[] dyes = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" };
    for (int i = 0; i < 16; i++) {
        ItemStack dye = new ItemStack(Items.DYE, 1, i);
        ItemStack block = new ItemStack(Blocks.STAINED_GLASS, 1, 15 - i);
        ItemStack pane = new ItemStack(Blocks.STAINED_GLASS_PANE, 1, 15 - i);
        oreDicts.put("dye" + dyes[i], dye);
        oreDicts.put("blockGlass" + dyes[i], block);
        oreDicts.put("paneGlass" + dyes[i], pane);
    }
    Multimaps.asMap(oreDicts).forEach((ore, list) -> list.forEach(o -> {
        if (o instanceof ItemStack) {
            OreDictUnifier.onItemRegistration(new OreDictionary.OreRegisterEvent(ore, (ItemStack) o));
        } else if (o instanceof Item) {
            OreDictUnifier.onItemRegistration(new OreDictionary.OreRegisterEvent(ore, new ItemStack((Item) o)));
        } else if (o instanceof Block) {
            OreDictUnifier.onItemRegistration(new OreDictionary.OreRegisterEvent(ore, new ItemStack((Block) o)));
        }
    }));
    OreDictUnifier.registerOre(new ItemStack(Items.BUCKET, 1, 0), OrePrefix.bucket, MarkerMaterials.Empty);
    OreDictUnifier.registerOre(new ItemStack(Items.WATER_BUCKET, 1, 0), OrePrefix.bucket, Materials.Water);
    OreDictUnifier.registerOre(new ItemStack(Items.LAVA_BUCKET, 1, 0), OrePrefix.bucket, Materials.Lava);
    OreDictUnifier.registerOre(new ItemStack(Items.MILK_BUCKET, 1, 0), OrePrefix.bucket, Materials.Milk);
    OreDictUnifier.registerOre(new ItemStack(Items.GLASS_BOTTLE, 1, 0), OrePrefix.bottle, MarkerMaterials.Empty);
    OreDictUnifier.registerOre(new ItemStack(Items.POTIONITEM, 1, 0), OrePrefix.bottle, Materials.Water);
    OreDictUnifier.registerOre(new ItemStack(Blocks.COAL_ORE, 1), OrePrefix.ore, Materials.Coal);
    OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_ORE, 1), OrePrefix.ore, Materials.Iron);
    OreDictUnifier.registerOre(new ItemStack(Blocks.LAPIS_ORE, 1), OrePrefix.ore, Materials.Lapis);
    OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_ORE, 1), OrePrefix.ore, Materials.Redstone);
    OreDictUnifier.registerOre(new ItemStack(Blocks.GOLD_ORE, 1), OrePrefix.ore, Materials.Gold);
    OreDictUnifier.registerOre(new ItemStack(Blocks.DIAMOND_ORE, 1), OrePrefix.ore, Materials.Diamond);
    OreDictUnifier.registerOre(new ItemStack(Blocks.EMERALD_ORE, 1), OrePrefix.ore, Materials.Emerald);
    OreDictUnifier.registerOre(new ItemStack(Blocks.QUARTZ_ORE, 1), OrePrefix.ore, Materials.NetherQuartz);
    OreDictUnifier.registerOre(new ItemStack(Items.DYE, 1, 4), OrePrefix.gem, Materials.Lapis);
    OreDictUnifier.registerOre(new ItemStack(Items.ENDER_EYE, 1), OrePrefix.gem, Materials.EnderEye);
    OreDictUnifier.registerOre(new ItemStack(Items.ENDER_PEARL, 1), OrePrefix.gem, Materials.EnderPearl);
    OreDictUnifier.registerOre(new ItemStack(Items.DIAMOND, 1), OrePrefix.gem, Materials.Diamond);
    OreDictUnifier.registerOre(new ItemStack(Items.EMERALD, 1), OrePrefix.gem, Materials.Emerald);
    OreDictUnifier.registerOre(new ItemStack(Items.COAL, 1, 0), OrePrefix.gem, Materials.Coal);
    OreDictUnifier.registerOre(new ItemStack(Items.COAL, 1, 1), OrePrefix.gem, Materials.Charcoal);
    OreDictUnifier.registerOre(new ItemStack(Items.QUARTZ, 1), OrePrefix.gem, Materials.NetherQuartz);
    OreDictUnifier.registerOre(new ItemStack(Items.NETHER_STAR, 1), OrePrefix.gem, Materials.NetherStar);
    OreDictUnifier.registerOre(new ItemStack(Items.GOLD_NUGGET, 1), OrePrefix.nugget, Materials.Gold);
    OreDictUnifier.registerOre(new ItemStack(Items.GOLD_INGOT, 1), OrePrefix.ingot, Materials.Gold);
    OreDictUnifier.registerOre(new ItemStack(Items.IRON_INGOT, 1), OrePrefix.ingot, Materials.Iron);
    OreDictUnifier.registerOre(new ItemStack(Items.PAPER, 1), OrePrefix.plate, Materials.Paper);
    OreDictUnifier.registerOre(new ItemStack(Items.SUGAR, 1), OrePrefix.dust, Materials.Sugar);
    OreDictUnifier.registerOre(new ItemStack(Items.STICK, 1), OrePrefix.stick, Materials.Wood);
    OreDictUnifier.registerOre(new ItemStack(Items.REDSTONE, 1), OrePrefix.dust, Materials.Redstone);
    OreDictUnifier.registerOre(new ItemStack(Items.GUNPOWDER, 1), OrePrefix.dust, Materials.Gunpowder);
    OreDictUnifier.registerOre(new ItemStack(Items.GLOWSTONE_DUST, 1), OrePrefix.dust, Materials.Glowstone);
    OreDictUnifier.registerOre(new ItemStack(Items.BLAZE_POWDER, 1), OrePrefix.dust, Materials.Blaze);
    OreDictUnifier.registerOre(new ItemStack(Items.BLAZE_ROD, 1), OrePrefix.stick, Materials.Blaze);
    OreDictUnifier.registerOre(new ItemStack(Blocks.IRON_BLOCK, 1, 0), OrePrefix.block, Materials.Iron);
    OreDictUnifier.registerOre(new ItemStack(Blocks.GOLD_BLOCK, 1, 0), OrePrefix.block, Materials.Gold);
    OreDictUnifier.registerOre(new ItemStack(Blocks.DIAMOND_BLOCK, 1, 0), OrePrefix.block, Materials.Diamond);
    OreDictUnifier.registerOre(new ItemStack(Blocks.EMERALD_BLOCK, 1, 0), OrePrefix.block, Materials.Emerald);
    OreDictUnifier.registerOre(new ItemStack(Blocks.LAPIS_BLOCK, 1, 0), OrePrefix.block, Materials.Lapis);
    OreDictUnifier.registerOre(new ItemStack(Blocks.COAL_BLOCK, 1, 0), OrePrefix.block, Materials.Coal);
    OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_BLOCK, 1, 0), OrePrefix.block, Materials.Redstone);
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, 1), OrePrefix.stone, Materials.GraniteBlack);
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, 2), OrePrefix.stone, Materials.GraniteBlack);
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, 5), OrePrefix.stone, Materials.Andesite);
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, 6), OrePrefix.stone, Materials.Andesite);
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, 3), OrePrefix.stone, Materials.Diorite);
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, 4), OrePrefix.stone, Materials.Diorite);
    OreDictUnifier.registerOre(new ItemStack(Blocks.ANVIL, 1), "craftingAnvil");
    OreDictUnifier.registerOre(new ItemStack(Blocks.OBSIDIAN, 1, W), OrePrefix.stone, Materials.Obsidian);
    OreDictUnifier.registerOre(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, W), "stoneMossy");
    OreDictUnifier.registerOre(new ItemStack(Blocks.MOSSY_COBBLESTONE, 1, W), "stoneCobble");
    OreDictUnifier.registerOre(new ItemStack(Blocks.COBBLESTONE, 1, W), "stoneCobble");
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONE, 1, W), "stoneSmooth");
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, W), "stoneBricks");
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, 1), "stoneMossy");
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, 2), "stoneCracked");
    OreDictUnifier.registerOre(new ItemStack(Blocks.STONEBRICK, 1, 3), "stoneChiseled");
    OreDictUnifier.registerOre(new ItemStack(Blocks.NETHERRACK, 1, W), OrePrefix.stone, Materials.Netherrack);
    OreDictUnifier.registerOre(new ItemStack(Blocks.END_STONE, 1, W), OrePrefix.stone, Materials.Endstone);
    OreDictUnifier.registerOre(new ItemStack(Blocks.REDSTONE_TORCH, 1, W), "craftingRedstoneTorch");
    OreDictUnifier.registerOre(new ItemStack(Blocks.PISTON, 1, W), "craftingPiston");
    OreDictUnifier.registerOre(new ItemStack(Blocks.STICKY_PISTON, 1, W), "craftingPiston");
    OreDictUnifier.registerOre(new ItemStack(Blocks.CHEST, 1, W), "craftingChest");
    OreDictUnifier.registerOre(new ItemStack(Blocks.TRAPPED_CHEST, 1, W), "craftingChest");
    OreDictUnifier.registerOre(new ItemStack(Blocks.FURNACE, 1, W), "craftingFurnace");
    OreDictUnifier.registerOre(new ItemStack(Items.FEATHER, 1, W), "craftingFeather");
    OreDictUnifier.registerOre(new ItemStack(Items.WHEAT, 1, W), "itemWheat");
    OreDictUnifier.registerOre(new ItemStack(Items.PAPER, 1, W), "paperEmpty");
    OreDictUnifier.registerOre(new ItemStack(Items.MAP, 1, W), "paperMap");
    OreDictUnifier.registerOre(new ItemStack(Items.FILLED_MAP, 1, W), "paperMap");
    OreDictUnifier.registerOre(new ItemStack(Items.BOOK, 1, W), "bookEmpty");
    OreDictUnifier.registerOre(new ItemStack(Items.WRITABLE_BOOK, 1, W), "bookWritable");
    OreDictUnifier.registerOre(new ItemStack(Items.WRITTEN_BOOK, 1, W), "bookWritten");
    OreDictUnifier.registerOre(new ItemStack(Items.ENCHANTED_BOOK, 1, W), "bookEnchanted");
    OreDictUnifier.registerOre(new ItemStack(Items.BOOK, 1, W), "craftingBook");
    OreDictUnifier.registerOre(new ItemStack(Items.WRITABLE_BOOK, 1, W), "craftingBook");
    OreDictUnifier.registerOre(new ItemStack(Items.WRITTEN_BOOK, 1, W), "craftingBook");
    OreDictUnifier.registerOre(new ItemStack(Items.ENCHANTED_BOOK, 1, W), "craftingBook");
}
Also used : LinkedListMultimap(com.google.common.collect.LinkedListMultimap) ModHandler(gregtech.api.recipes.ModHandler) OreDictUnifier(gregtech.api.unification.OreDictUnifier) GTLog(gregtech.api.util.GTLog) Blocks(net.minecraft.init.Blocks) Items(net.minecraft.init.Items) Item(net.minecraft.item.Item) FluidRegistry(net.minecraftforge.fluids.FluidRegistry) Materials(gregtech.api.unification.material.Materials) Multimap(com.google.common.collect.Multimap) Multimaps(com.google.common.collect.Multimaps) ItemStack(net.minecraft.item.ItemStack) Block(net.minecraft.block.Block) OreDictionary(net.minecraftforge.oredict.OreDictionary) WILDCARD_VALUE(net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE) MarkerMaterials(gregtech.api.unification.material.MarkerMaterials) BlockPrismarine(net.minecraft.block.BlockPrismarine) OrePrefix(gregtech.api.unification.ore.OrePrefix) W(gregtech.api.GTValues.W) Item(net.minecraft.item.Item) OreDictionary(net.minecraftforge.oredict.OreDictionary) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Example 2 with Blocks

use of net.minecraft.init.Blocks in project OreSpawn by MinecraftModDevelopmentMods.

the class ClearChunkCommand method execute.

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (!(sender instanceof EntityPlayer)) {
        throw new CommandException("Only players can use this command");
    }
    EntityPlayer player = (EntityPlayer) sender;
    Chunk chunk = player.getEntityWorld().getChunkFromBlockCoords(player.getPosition());
    ChunkPos chunkPos = chunk.getPos();
    List<IBlockState> blocks;
    boolean flagClassic = args.length > 0 ? args[0].toLowerCase().equalsIgnoreCase("classic") : false;
    List<String> blockNames = new LinkedList<>();
    getBlocks(args, blockNames);
    blocks = blockNames.stream().map(blockName -> ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockName))).map(block -> block.getDefaultState()).collect(Collectors.toList());
    blocks.addAll(OreSpawn.API.getDimensionDefaultReplacements(player.getEntityWorld().provider.getDimension()).stream().collect(Collectors.toList()));
    List<IBlockState> overburden = Arrays.asList("minecraft:dirt", "minecraft:sand", "minecraft:gravel", "minecraft:grass", "minecraft:sandstone", "minecraft:red_sandstone").stream().map(blockName -> ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockName))).map(bl -> bl.getDefaultState()).collect(Collectors.toList());
    clearBlocks(chunkPos, blocks, overburden, flagClassic, player);
    player.sendStatusMessage(new TextComponentString("chunk " + chunkPos.toString() + " cleared"), true);
}
Also used : Arrays(java.util.Arrays) Blocks(net.minecraft.init.Blocks) OreSpawn(com.mcmoddev.orespawn.OreSpawn) ChunkPos(net.minecraft.util.math.ChunkPos) CommandBase(net.minecraft.command.CommandBase) BlockPos(net.minecraft.util.math.BlockPos) Collectors(java.util.stream.Collectors) ICommand(net.minecraft.command.ICommand) TextComponentString(net.minecraft.util.text.TextComponentString) IBlockState(net.minecraft.block.state.IBlockState) ItemStack(net.minecraft.item.ItemStack) List(java.util.List) CommandException(net.minecraft.command.CommandException) MinecraftServer(net.minecraft.server.MinecraftServer) Block(net.minecraft.block.Block) ICommandSender(net.minecraft.command.ICommandSender) OreDictionary(net.minecraftforge.oredict.OreDictionary) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ForgeRegistries(net.minecraftforge.fml.common.registry.ForgeRegistries) ResourceLocation(net.minecraft.util.ResourceLocation) Chunk(net.minecraft.world.chunk.Chunk) LinkedList(java.util.LinkedList) IBlockState(net.minecraft.block.state.IBlockState) CommandException(net.minecraft.command.CommandException) TextComponentString(net.minecraft.util.text.TextComponentString) Chunk(net.minecraft.world.chunk.Chunk) LinkedList(java.util.LinkedList) TextComponentString(net.minecraft.util.text.TextComponentString) ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChunkPos(net.minecraft.util.math.ChunkPos)

Example 3 with Blocks

use of net.minecraft.init.Blocks in project BuildCraft by BuildCraft.

the class BuildCraftTransport method init.

@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
    transportChannelHandler = new ChannelHandler();
    MinecraftForge.EVENT_BUS.register(this);
    transportChannelHandler.registerPacketType(PacketFluidUpdate.class);
    transportChannelHandler.registerPacketType(PacketPipeSyncRequest.class);
    transportChannelHandler.registerPacketType(PacketPipeTransportItemStack.class);
    transportChannelHandler.registerPacketType(PacketPipeTransportItemStackRequest.class);
    transportChannelHandler.registerPacketType(PacketPipeTransportTraveler.class);
    transportChannelHandler.registerPacketType(PacketPowerUpdate.class);
    channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", transportChannelHandler, new PacketHandler());
    TransportProxy.proxy.registerTileEntities();
    BuilderAPI.schematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class);
    BuilderAPI.schematicRegistry.registerSchematicBlock(filteredBufferBlock, SchematicTile.class);
    new BptPipeRotatable(pipeItemsWood);
    new BptPipeRotatable(pipeFluidsWood);
    new BptPipeRotatable(pipeItemsIron);
    new BptPipeRotatable(pipeFluidsIron);
    new BptPipeRotatable(pipeItemsEmerald);
    new BptPipeRotatable(pipeFluidsEmerald);
    new BptPipeRotatable(pipeItemsDaizuli);
    new BptPipeRotatable(pipeItemsEmzuli);
    for (Item itemPipe : BlockGenericPipe.pipes.keySet()) {
        Class<? extends Pipe<?>> klazz = BlockGenericPipe.pipes.get(itemPipe);
        if (IDiamondPipe.class.isAssignableFrom(klazz)) {
            new BptPipeFiltered(itemPipe);
        }
    }
    PipeEventBus.registerGlobalHandler(new LensFilterHandler());
    BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1));
    if (NEPTUNE_TESTING)
        BCCreativeTab.get("neptune").setIcon(new ItemStack(Items.cake));
    if (showAllFacadesCreative) {
        BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block.getDefaultState()));
    }
    if (Loader.isModLoaded("BuildCraft|Silicon")) {
        BCCreativeTab.get("gates").setIcon(ItemGate.makeGateItem(GateMaterial.DIAMOND, GateLogic.AND));
    }
    StatementManager.registerParameterClass(TriggerParameterSignal.class);
    StatementManager.registerParameterClass(ActionParameterSignal.class);
    // Item use stripes handlers
    PipeManager.registerStripesHandler(new StripesHandlerRightClick(), -32768);
    PipeManager.registerStripesHandler(new StripesHandlerDispenser(), -49152);
    PipeManager.registerStripesHandler(new StripesHandlerPlant(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerBucket(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerArrow(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerShears(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerPipes(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerPipeWires(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerEntityInteract(), 0);
    PipeManager.registerStripesHandler(new StripesHandlerPlaceBlock(), -65536);
    PipeManager.registerStripesHandler(new StripesHandlerUse(), -131072);
    PipeManager.registerStripesHandler(new StripesHandlerHoe(), 0);
    StripesHandlerDispenser.items.add(ItemMinecart.class);
    StripesHandlerRightClick.items.add(Items.egg);
    StripesHandlerRightClick.items.add(Items.snowball);
    StripesHandlerRightClick.items.add(Items.experience_bottle);
    StripesHandlerUse.items.add(Items.fireworks);
    // Block breaking stripes handlers
    PipeManager.registerStripesHandler(new StripesHandlerMinecartDestroy(), 0);
    PipeManager.registerPipePluggable(FacadePluggable.class, "facade");
    PipeManager.registerPipePluggable(GatePluggable.class, "gate");
    PipeManager.registerPipePluggable(LensPluggable.class, "lens");
    PipeManager.registerPipePluggable(PlugPluggable.class, "plug");
    PipeManager.registerPipePluggable(PowerAdapterPluggable.class, "powerAdapter");
    GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
    GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
    GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
    GateExpansions.registerExpansion(GateExpansionLightSensor.INSTANCE, new ItemStack(Blocks.daylight_detector));
    if (BuildCraftCore.loadDefaultRecipes) {
        loadRecipes();
    }
    TransportProxy.proxy.registerRenderers();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new TransportGuiHandler());
    /* Make pipes extend to connect to blocks like chests. This means that a connection going UP (the bottom of the
         * block in question) will be the only face that does not extend into the block slightly. */
    ICustomPipeConnection smallerBlockConnection = (world, pos, face, state) -> face == EnumFacing.UP ? 0 : 2 / 16f;
    PipeConnectionAPI.registerConnection(Blocks.chest, smallerBlockConnection);
    PipeConnectionAPI.registerConnection(Blocks.trapped_chest, smallerBlockConnection);
    PipeConnectionAPI.registerConnection(Blocks.hopper, smallerBlockConnection);
    if (NEPTUNE_TESTING)
        TransportPipes_BC8.init();
}
Also used : ModelBakeEvent(net.minecraftforge.client.event.ModelBakeEvent) Loader(net.minecraftforge.fml.common.Loader) net.minecraftforge.fml.common.event(net.minecraftforge.fml.common.event) ConfigChangedEvent(net.minecraftforge.fml.client.event.ConfigChangedEvent) PacketHandler(buildcraft.core.lib.network.base.PacketHandler) GateLogic(buildcraft.transport.gates.GateDefinition.GateLogic) Block(net.minecraft.block.Block) StatementManager(buildcraft.api.statements.StatementManager) RestartRequirement(buildcraft.lib.config.RestartRequirement) Side(net.minecraftforge.fml.relauncher.Side) SchematicPipe(buildcraft.transport.schematics.SchematicPipe) Locale(java.util.Locale) IMCEvent(net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent) PipeConnectionAPI(buildcraft.api.transport.PipeConnectionAPI) buildcraft.transport.client.model(buildcraft.transport.client.model) buildcraft.transport.network(buildcraft.transport.network) PrintWriter(java.io.PrintWriter) ItemBuildCraft(buildcraft.core.lib.items.ItemBuildCraft) ModelHelper(buildcraft.core.lib.utils.ModelHelper) ITriggerInternal(buildcraft.api.statements.ITriggerInternal) net.minecraft.item(net.minecraft.item) BptPipeRotatable(buildcraft.transport.schematics.BptPipeRotatable) buildcraft.transport.statements(buildcraft.transport.statements) GateExpansions(buildcraft.api.gates.GateExpansions) IActionInternal(buildcraft.api.statements.IActionInternal) ColorUtils(buildcraft.core.lib.utils.ColorUtils) TickEvent(net.minecraftforge.fml.common.gameevent.TickEvent) ICustomPipeConnection(buildcraft.api.transport.ICustomPipeConnection) PipeContents(buildcraft.transport.statements.TriggerPipeContents.PipeContents) Blocks(net.minecraft.init.Blocks) buildcraft.transport(buildcraft.transport) IGateExpansion(buildcraft.api.gates.IGateExpansion) BuilderAPI(buildcraft.api.blueprints.BuilderAPI) GameRegistry(net.minecraftforge.fml.common.registry.GameRegistry) BlockPipe(buildcraft.transport.block.BlockPipe) buildcraft.transport.gates(buildcraft.transport.gates) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) PipeWire(buildcraft.api.transport.PipeWire) buildcraft.transport.pipes(buildcraft.transport.pipes) TextureStitchEvent(net.minecraftforge.client.event.TextureStitchEvent) ListRegistry(buildcraft.api.lists.ListRegistry) Mod(net.minecraftforge.fml.common.Mod) LinkedList(java.util.LinkedList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) WorldServer(net.minecraft.world.WorldServer) DimensionManager(net.minecraftforge.common.DimensionManager) RecipeSorter(net.minecraftforge.oredict.RecipeSorter) FacadeAPI(buildcraft.api.facades.FacadeAPI) Time(buildcraft.transport.statements.TriggerClockTimer.Time) BCLog(buildcraft.api.core.BCLog) BptPipeFiltered(buildcraft.transport.schematics.BptPipeFiltered) buildcraft.transport.stripes(buildcraft.transport.stripes) Items(net.minecraft.init.Items) EnumFacing(net.minecraft.util.EnumFacing) buildcraft.transport.pluggable(buildcraft.transport.pluggable) buildcraft.core(buildcraft.core) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) GateMaterial(buildcraft.transport.gates.GateDefinition.GateMaterial) IBlockState(net.minecraft.block.state.IBlockState) EnumColor(buildcraft.api.core.EnumColor) MinecraftForge(net.minecraftforge.common.MinecraftForge) NetworkRegistry(net.minecraftforge.fml.common.network.NetworkRegistry) PipeTransportRendererFluids(buildcraft.transport.client.render.PipeTransportRendererFluids) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SchematicTile(buildcraft.api.blueprints.SchematicTile) PipeManager(buildcraft.api.transport.PipeManager) BptPipeFiltered(buildcraft.transport.schematics.BptPipeFiltered) ChannelHandler(buildcraft.core.lib.network.base.ChannelHandler) PacketHandler(buildcraft.core.lib.network.base.PacketHandler) BptPipeRotatable(buildcraft.transport.schematics.BptPipeRotatable) ICustomPipeConnection(buildcraft.api.transport.ICustomPipeConnection)

Example 4 with Blocks

use of net.minecraft.init.Blocks in project LogisticsPipes by RS485.

the class RenderTickHandler method renderWorldLast.

// private static final ResourceLocation TEXTURE = new ResourceLocation("logisticspipes", "textures/blocks/pipes/White.png");
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderWorldLast(RenderWorldLastEvent worldEvent) {
    // if (LogisticsRenderPipe.config.isUseNewRenderer()) {
    if (displayPipeGhost()) {
        Minecraft mc = Minecraft.getMinecraft();
        EntityPlayer player = mc.player;
        RayTraceResult box = mc.objectMouseOver;
        if (box != null && box.typeOfHit == RayTraceResult.Type.BLOCK) {
            ItemStack stack = FMLClientHandler.instance().getClient().player.inventory.mainInventory.get(FMLClientHandler.instance().getClient().player.inventory.currentItem);
            CoreUnroutedPipe pipe = ((ItemLogisticsPipe) stack.getItem()).getDummyPipe();
            World world = player.getEntityWorld();
            EnumFacing side = box.sideHit;
            BlockPos bPos = box.getBlockPos();
            Block block = world.getBlockState(bPos).getBlock();
            if (block == Blocks.SNOW_LAYER && block.isReplaceable(world, bPos)) {
                side = EnumFacing.UP;
            } else if (!block.isReplaceable(world, bPos)) {
                bPos = bPos.offset(side);
            }
            boolean isFreeSpace = true;
            ITubeOrientation orientation = null;
            if (pipe instanceof CoreMultiBlockPipe) {
                CoreMultiBlockPipe multipipe = (CoreMultiBlockPipe) pipe;
                DoubleCoordinates placeAt = new DoubleCoordinates(bPos);
                LPPositionSet<DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare>> globalPos = new LPPositionSet<>(DoubleCoordinatesType.class);
                globalPos.add(new DoubleCoordinatesType<>(placeAt, CoreMultiBlockPipe.SubBlockTypeForShare.NON_SHARE));
                LPPositionSet<DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare>> positions = multipipe.getSubBlocks();
                orientation = multipipe.getTubeOrientation(player, bPos.getX(), bPos.getZ());
                if (orientation != null) {
                    orientation.rotatePositions(positions);
                    positions.stream().map(pos -> pos.add(placeAt)).forEach(globalPos::add);
                    globalPos.addToAll(orientation.getOffset());
                    for (DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare> pos : globalPos) {
                        if (!player.getEntityWorld().mayPlace(LPBlocks.pipe, pos.getBlockPos(), false, side, player)) {
                            TileEntity tile = player.getEntityWorld().getTileEntity(pos.getBlockPos());
                            boolean canPlace = false;
                            if (tile instanceof LogisticsTileGenericSubMultiBlock) {
                                if (CoreMultiBlockPipe.canShare(((LogisticsTileGenericSubMultiBlock) tile).getSubTypes(), pos.getType())) {
                                    canPlace = true;
                                }
                            }
                            if (!canPlace) {
                                isFreeSpace = false;
                                break;
                            }
                        }
                    }
                } else {
                    return;
                }
            } else {
                if (!player.getEntityWorld().mayPlace(LPBlocks.pipe, bPos, false, side, player)) {
                    isFreeSpace = false;
                }
            }
            if (isFreeSpace) {
                GlStateManager.pushMatrix();
                double x;
                double y;
                double z;
                if (orientation != null) {
                    x = bPos.getX() + orientation.getOffset().getXInt() - player.prevPosX - ((player.posX - player.prevPosX) * worldEvent.getPartialTicks());
                    y = bPos.getY() + orientation.getOffset().getYInt() - player.prevPosY - ((player.posY - player.prevPosY) * worldEvent.getPartialTicks());
                    z = bPos.getZ() + orientation.getOffset().getZInt() - player.prevPosZ - ((player.posZ - player.prevPosZ) * worldEvent.getPartialTicks());
                } else {
                    x = bPos.getX() - player.prevPosX - ((player.posX - player.prevPosX) * worldEvent.getPartialTicks());
                    y = bPos.getY() - player.prevPosY - ((player.posY - player.prevPosY) * worldEvent.getPartialTicks());
                    z = bPos.getZ() - player.prevPosZ - ((player.posZ - player.prevPosZ) * worldEvent.getPartialTicks());
                }
                GL11.glTranslated(x + 0.001, y + 0.001, z + 0.001);
                GlStateManager.enableBlend();
                // GL11.glDepthMask(false);
                GlStateManager.disableTexture2D();
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                mc.renderEngine.bindTexture(new ResourceLocation("logisticspipes", "textures/blocks/pipes/white.png"));
                SimpleServiceLocator.cclProxy.getRenderState().reset();
                SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
                GlStateManager.enableTexture2D();
                SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0x50);
                SimpleServiceLocator.cclProxy.getRenderState().startDrawing(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
                pipe.getHighlightRenderer().renderHighlight(orientation);
                SimpleServiceLocator.cclProxy.getRenderState().draw();
                SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
                GlStateManager.disableBlend();
                GlStateManager.depthMask(true);
                GlStateManager.popMatrix();
            }
        }
    }
// }
}
Also used : ItemLogisticsPipe(logisticspipes.items.ItemLogisticsPipe) RenderTickEvent(net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent) Blocks(net.minecraft.init.Blocks) DoubleCoordinatesType(network.rs485.logisticspipes.world.DoubleCoordinatesType) ActiveRenderInfo(net.minecraft.client.renderer.ActiveRenderInfo) RenderWorldLastEvent(net.minecraftforge.client.event.RenderWorldLastEvent) DefaultVertexFormats(net.minecraft.client.renderer.vertex.DefaultVertexFormats) ItemStack(net.minecraft.item.ItemStack) RayTraceResult(net.minecraft.util.math.RayTraceResult) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) LogisticsHUDRenderer(logisticspipes.renderer.LogisticsHUDRenderer) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) LogisticsGuiOverrenderer(logisticspipes.renderer.LogisticsGuiOverrenderer) ClientViewController(logisticspipes.routing.debug.ClientViewController) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) GL11(org.lwjgl.opengl.GL11) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) CoreMultiBlockPipe(logisticspipes.pipes.basic.CoreMultiBlockPipe) World(net.minecraft.world.World) GlStateManager(net.minecraft.client.renderer.GlStateManager) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) LPPositionSet(logisticspipes.utils.LPPositionSet) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) EventPriority(net.minecraftforge.fml.common.eventhandler.EventPriority) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) LPBlocks(logisticspipes.LPBlocks) FMLClientHandler(net.minecraftforge.fml.client.FMLClientHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Phase(net.minecraftforge.fml.common.gameevent.TickEvent.Phase) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) TileEntity(net.minecraft.tileentity.TileEntity) EnumFacing(net.minecraft.util.EnumFacing) World(net.minecraft.world.World) TileEntity(net.minecraft.tileentity.TileEntity) CoreMultiBlockPipe(logisticspipes.pipes.basic.CoreMultiBlockPipe) ResourceLocation(net.minecraft.util.ResourceLocation) ItemLogisticsPipe(logisticspipes.items.ItemLogisticsPipe) BlockPos(net.minecraft.util.math.BlockPos) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) RayTraceResult(net.minecraft.util.math.RayTraceResult) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) Minecraft(net.minecraft.client.Minecraft) DoubleCoordinatesType(network.rs485.logisticspipes.world.DoubleCoordinatesType) LPPositionSet(logisticspipes.utils.LPPositionSet) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Block(net.minecraft.block.Block) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with Blocks

use of net.minecraft.init.Blocks in project DynamicSurroundings by OreCruncher.

the class FootstepsRegistry method initComplete.

@Override
public void initComplete() {
    AcousticsManager.SWIM = this.acousticsManager.compileAcoustics("_SWIM");
    AcousticsManager.JUMP = this.acousticsManager.compileAcoustics("_JUMP");
    AcousticsManager.SPLASH = new IAcoustic[] { new RainSplashAcoustic(this.acousticsManager.compileAcoustics("waterfine")) };
    final AcousticsManager am = this.acousticsManager;
    this.ARMOR_SOUND.put(ArmorClass.NONE, am.getAcoustic("NOT_EMITTER"));
    this.ARMOR_SOUND.put(ArmorClass.LIGHT, am.getAcoustic("armor_light"));
    this.ARMOR_SOUND.put(ArmorClass.MEDIUM, am.getAcoustic("armor_medium"));
    this.ARMOR_SOUND.put(ArmorClass.CRYSTAL, am.getAcoustic("armor_crystal"));
    this.ARMOR_SOUND.put(ArmorClass.HEAVY, am.getAcoustic("armor_heavy"));
    this.ARMOR_SOUND_FOOT.put(ArmorClass.NONE, am.getAcoustic("NOT_EMITTER"));
    this.ARMOR_SOUND_FOOT.put(ArmorClass.LIGHT, am.getAcoustic("armor_light"));
    this.ARMOR_SOUND_FOOT.put(ArmorClass.MEDIUM, am.getAcoustic("medium_foot"));
    this.ARMOR_SOUND_FOOT.put(ArmorClass.CRYSTAL, am.getAcoustic("crystal_foot"));
    this.ARMOR_SOUND_FOOT.put(ArmorClass.HEAVY, am.getAcoustic("heavy_foot"));
    this.childVariator = getVariator("child");
    this.playerVariator = getVariator(ModOptions.sound.firstPersonFootstepCadence ? "playerSlow" : "player");
    this.playerQuadrupedVariator = getVariator(ModOptions.sound.firstPersonFootstepCadence ? "quadrupedSlow" : "quadruped");
    // Generate a list of IBlockState objects for all blocks registered
    // with Forge.
    final Set<IBlockState> blockStates = StreamSupport.stream(ForgeRegistries.BLOCKS.spliterator(), false).map(block -> block.getBlockState().getValidStates()).flatMap(l -> l.stream()).collect(Collectors.toSet());
    // Scan the block list looking for any block states that do not have sounds
    // definitions supplied by configuration files or by primitives. This scan
    // has the side effect of priming the caches.
    final Set<IBlockState> missingAcoustics = blockStates.stream().filter(bs -> !FootstepsRegistry.this.getBlockMap().hasAcoustics(bs)).collect(Collectors.toSet());
    if (ModOptions.logging.enableDebugLogging) {
        if (missingAcoustics.size() > 0) {
            DSurround.log().info("          >>>> MISSING ACOUSTIC ENTRIES <<<< ");
            DSurround.log().info("Sounds for these states will default to their step sound");
            DSurround.log().info("========================================================");
            missingAcoustics.stream().map(IBlockState::toString).sorted().forEach(DSurround.log()::info);
        }
    }
    // Identify any IBlockStates that could have footprints associated and
    // register them if necessary.
    blockStates.stream().filter(bs -> bs.getMaterial().blocksMovement() && !this.FOOTPRINT_MATERIAL.contains(bs.getMaterial()) && !this.FOOTPRINT_STATES.contains(bs)).filter(bs -> {
        final SoundType sound = MCHelper.getSoundType(bs);
        if (sound != null) {
            final SoundEvent event = sound.getStepSound();
            if (event != null) {
                final ResourceLocation resource = event.getSoundName();
                if (resource != null) {
                    final String soundName = resource.toString();
                    return FOOTPRINT_SOUND_PROFILE.contains(soundName);
                }
            }
        }
        return false;
    }).forEach(bs -> this.FOOTPRINT_STATES.add(bs));
}
Also used : AcousticsManager(org.blockartistry.DynSurround.client.footsteps.implem.AcousticsManager) Arrays(java.util.Arrays) Generator(org.blockartistry.DynSurround.client.footsteps.system.Generator) ModConfigurationFile(org.blockartistry.DynSurround.data.xface.ModConfigurationFile) Item(net.minecraft.item.Item) GeneratorQP(org.blockartistry.DynSurround.client.footsteps.system.GeneratorQP) Scanner(java.util.Scanner) DSurround(org.blockartistry.DynSurround.DSurround) BlockReed(net.minecraft.block.BlockReed) Block(net.minecraft.block.Block) MCHelper(org.blockartistry.lib.MCHelper) Side(net.minecraftforge.fml.relauncher.Side) OreDictionary(net.minecraftforge.oredict.OreDictionary) Locale(java.util.Locale) Map(java.util.Map) ItemStackUtil(org.blockartistry.lib.ItemStackUtil) IdentityHashSet(org.blockartistry.lib.collections.IdentityHashSet) AcousticsManager(org.blockartistry.DynSurround.client.footsteps.implem.AcousticsManager) BlockOre(net.minecraft.block.BlockOre) Pack(org.blockartistry.DynSurround.packs.ResourcePacks.Pack) BlockMushroom(net.minecraft.block.BlockMushroom) EnumMap(java.util.EnumMap) BlockIce(net.minecraft.block.BlockIce) PrimitiveMap(org.blockartistry.DynSurround.client.footsteps.implem.PrimitiveMap) Set(java.util.Set) IAcoustic(org.blockartistry.DynSurround.client.footsteps.interfaces.IAcoustic) Collectors(java.util.stream.Collectors) ConfigProperty(org.blockartistry.DynSurround.client.footsteps.util.ConfigProperty) BlockLeaves(net.minecraft.block.BlockLeaves) List(java.util.List) ModOptions(org.blockartistry.DynSurround.ModOptions) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Entry(java.util.Map.Entry) BlockFence(net.minecraft.block.BlockFence) ItemBlockSpecial(net.minecraft.item.ItemBlockSpecial) BlockCrops(net.minecraft.block.BlockCrops) Blocks(net.minecraft.init.Blocks) BlockFlower(net.minecraft.block.BlockFlower) RainSplashAcoustic(org.blockartistry.DynSurround.client.footsteps.implem.RainSplashAcoustic) HashMap(java.util.HashMap) BlockSapling(net.minecraft.block.BlockSapling) ItemStack(net.minecraft.item.ItemStack) BlockPlanks(net.minecraft.block.BlockPlanks) StreamSupport(java.util.stream.StreamSupport) ClientRegistry(org.blockartistry.DynSurround.client.ClientRegistry) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) SoundType(net.minecraft.block.SoundType) Iterator(java.util.Iterator) ResourcePacks(org.blockartistry.DynSurround.packs.ResourcePacks) IOException(java.io.IOException) VariatorConfig(org.blockartistry.DynSurround.data.xface.VariatorConfig) BlockDoor(net.minecraft.block.BlockDoor) AcousticProfile(org.blockartistry.DynSurround.client.footsteps.implem.AcousticProfile) AcousticsJsonReader(org.blockartistry.DynSurround.client.footsteps.parsers.AcousticsJsonReader) IBlockState(net.minecraft.block.state.IBlockState) Material(net.minecraft.block.material.Material) EntityLivingBase(net.minecraft.entity.EntityLivingBase) ForgeRegistries(net.minecraftforge.fml.common.registry.ForgeRegistries) ResourceLocation(net.minecraft.util.ResourceLocation) ItemBlock(net.minecraft.item.ItemBlock) BlockLog(net.minecraft.block.BlockLog) ForgeEntry(org.blockartistry.DynSurround.data.xface.ModConfigurationFile.ForgeEntry) InputStream(java.io.InputStream) BlockMap(org.blockartistry.DynSurround.client.footsteps.implem.BlockMap) SoundEvent(net.minecraft.util.SoundEvent) SoundType(net.minecraft.block.SoundType) SoundEvent(net.minecraft.util.SoundEvent) IBlockState(net.minecraft.block.state.IBlockState) RainSplashAcoustic(org.blockartistry.DynSurround.client.footsteps.implem.RainSplashAcoustic) ResourceLocation(net.minecraft.util.ResourceLocation)

Aggregations

Blocks (net.minecraft.init.Blocks)7 Block (net.minecraft.block.Block)5 IBlockState (net.minecraft.block.state.IBlockState)4 List (java.util.List)3 ItemStack (net.minecraft.item.ItemStack)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 LinkedList (java.util.LinkedList)2 Set (java.util.Set)2 Material (net.minecraft.block.material.Material)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 Items (net.minecraft.init.Items)2 EnumFacing (net.minecraft.util.EnumFacing)2 BlockPos (net.minecraft.util.math.BlockPos)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 Side (net.minecraftforge.fml.relauncher.Side)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 OreDictionary (net.minecraftforge.oredict.OreDictionary)2 State (arekkuusu.solar.api.state.State)1 ProfilerHelper (arekkuusu.solar.client.util.helper.ProfilerHelper)1 ModBlocks (arekkuusu.solar.common.block.ModBlocks)1