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");
}
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);
}
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();
}
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();
}
}
}
// }
}
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));
}
Aggregations