當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。