当前位置: 首页>>代码示例>>Java>>正文


Java BlockFactory.build方法代码示例

本文整理汇总了Java中nova.core.block.BlockFactory.build方法的典型用法代码示例。如果您正苦于以下问题:Java BlockFactory.build方法的具体用法?Java BlockFactory.build怎么用?Java BlockFactory.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nova.core.block.BlockFactory的用法示例。


在下文中一共展示了BlockFactory.build方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FWBlock

import nova.core.block.BlockFactory; //导入方法依赖的package包/类
public FWBlock(BlockFactory factory) {
	//TODO: Hack build() method
	super(getMcMaterial(factory));
	this.factory = factory;
	this.dummy = factory.build();
	if (dummy.components.has(BlockProperty.BlockSound.class)) {
		this.stepSound = new FWBlockSound(dummy.components.get(BlockProperty.BlockSound.class));
	} else {
		BlockProperty.BlockSound properties = dummy.components.add(new BlockProperty.BlockSound());
		properties.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.BREAK, new Sound("", soundTypeStone.getBreakSound()));
		properties.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE, new Sound("", soundTypeStone.getPlaceSound()));
		properties.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.WALK, new Sound("", soundTypeStone.getStepSound()));
		this.stepSound = soundTypeStone;
	}
	this.blockClass = dummy.getClass();

	// Recalculate super constructor things after loading the block properly
	this.fullBlock = isOpaqueCube();
	this.lightOpacity = isOpaqueCube() ? 255 : 0;
	this.translucent = !isOpaqueCube();
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:22,代码来源:FWBlock.java

示例2: FWBlock

import nova.core.block.BlockFactory; //导入方法依赖的package包/类
public FWBlock(BlockFactory factory) {
	//TODO: Hack build() method
	super(getMcMaterial(factory));
	this.factory = factory;
	this.dummy = factory.build();
	if (dummy.components.has(BlockProperty.BlockSound.class)) {
		this.stepSound = new FWBlockSound(dummy.components.get(BlockProperty.BlockSound.class));
	} else {
		BlockProperty.BlockSound properties = dummy.components.add(new BlockProperty.BlockSound());
		properties.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.BREAK, new Sound("", soundTypeStone.getBreakSound()));
		properties.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.PLACE, new Sound("", soundTypeStone.func_150496_b()));
		properties.setBlockSound(BlockProperty.BlockSound.BlockSoundTrigger.WALK, new Sound("", soundTypeStone.getStepResourcePath()));
		this.stepSound = soundTypeStone;
	}
	this.blockClass = dummy.getClass();

	// Recalculate super constructor things after loading the block properly
	this.opaque = isOpaqueCube();
	this.lightOpacity = isOpaqueCube() ? 255 : 0;

	if (FMLCommonHandler.instance().getSide().isClient()) {
		blockRenderingID = RenderingRegistry.getNextAvailableRenderId();
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:25,代码来源:FWBlock.java

示例3: setBlock

import nova.core.block.BlockFactory; //导入方法依赖的package包/类
@Override
public boolean setBlock(Vector3D position, BlockFactory factory) {
	Block newBlock = factory.build();
	BlockTransform component = new BlockTransform();
	component.setPosition(position);
	component.setWorld(this);
	newBlock.components.add(component);
	blockMap.put(position, newBlock);
	return true;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:11,代码来源:FakeWorld.java

示例4: getMcMaterial

import nova.core.block.BlockFactory; //导入方法依赖的package包/类
private static Material getMcMaterial(BlockFactory factory) {
	Block dummy = factory.build();
	if (dummy.components.has(BlockProperty.Opacity.class) || dummy.components.has(BlockProperty.Replaceable.class)) {
		// TODO allow color selection
		return new ProxyMaterial(MapColor.grayColor,
			dummy.components.getOp(BlockProperty.Opacity.class),
			dummy.components.getOp(BlockProperty.Replaceable.class));
	} else {
		return Material.piston;
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:12,代码来源:FWBlock.java

示例5: blockRegisterEvent

import nova.core.block.BlockFactory; //导入方法依赖的package包/类
private void blockRegisterEvent(BlockEvent.Register evt) {
	BlockFactory blockFactory = evt.blockFactory;

	Block dummy = blockFactory.build();
	if (dummy.components.has(Microblock.class) || dummy.components.has(Multiblock.class)) {
		//Sneaky block factory replacement
		MicroblockInjectFactory microblockInjectFactory = new MicroblockInjectFactory(evt.blockFactory);
		containedIDToFactory.put(evt.blockFactory.getID(), microblockInjectFactory);
		containedFactoryToFactory.put(evt.blockFactory, microblockInjectFactory);
		evt.blockFactory = microblockInjectFactory;
		evt.cancel();
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Microblock,代码行数:14,代码来源:NovaMicroblock.java

示例6: placeContainer

import nova.core.block.BlockFactory; //导入方法依赖的package包/类
public boolean placeContainer(Entity entity, World world, Vector3D position, Direction side, Vector3D hit) {
	if (NetworkTarget.Side.get().isServer()) {
		Vector3D placePos = position.add(side.toVector());

		Optional<Block> checkBlock = world.getBlock(placePos);
		if (checkBlock.isPresent()) {

			NovaMicroblock.MicroblockInjectFactory injectFactory = (NovaMicroblock.MicroblockInjectFactory) this.blockFactory;
			BlockFactory containedFactory = injectFactory.containedFactory;
			//TODO: Dummies are bad
			Block dummy = containedFactory.build();

			if (dummy.components.has(Microblock.class)) {
				//Ask the microblock about how it would like to be placed.
				Block.PlaceEvent evt = new Block.PlaceEvent(entity, side, hit, this);
				boolean b = new ContainerPlace(world, injectFactory, placePos, evt).operate();
				System.out.println("Attempt to place microblock: " + b);
				return b;
			} else if (dummy.components.has(Multiblock.class)) {
				return new ContainerPlace(world, injectFactory, placePos).operate();
			} else {
				throw new InventoryException("Invalid blockFactory contained in ItemBlockContainer: " + containedFactory);
			}
		}
	}
	return false;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Microblock,代码行数:28,代码来源:ItemBlockContainer.java


注:本文中的nova.core.block.BlockFactory.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。