本文整理汇总了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();
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例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();
}
}
示例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;
}