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


Java Stateful类代码示例

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


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

示例1: entityInit

import nova.core.block.Stateful; //导入依赖的package包/类
/**
 * All methods below here are exactly the same between FWEntity and FWEntityFX.
 * *****************************************************************************
 */
@Override
protected void entityInit() {
	//MC calls entityInit() before we finish wrapping, so this variable is required to check if wrapped exists.
	if (wrapped != null) {
		wrapped.events.publish(new Stateful.LoadEvent());
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		prevRotationYaw = rotationYaw;
		prevRotationPitch = rotationPitch;
		setPosition(posX, posY, posZ);
		WrapperEvent.FWEntityFXCreate event = new WrapperEvent.FWEntityFXCreate(wrapped, this);
		Game.events().publish(event);
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:20,代码来源:FWEntityFX.java

示例2: putNew

import nova.core.block.Stateful; //导入依赖的package包/类
/**
 * Puts a new microblock into this container.
 */
public boolean putNew(Vector3D localPos, Microblock microblock) {
	if (put(localPos, microblock)) {
		//Invoke load event
		microblock.block.events.publish(new Stateful.LoadEvent());

		//Invoke neighbor change event
		microblocks().stream()
			.filter(m -> m != microblock)
			.forEach(m -> m.block.events.publish(new Microblock.MicroblockChangeEvent(Optional.of(localPos))));

		block.world().markChange(block.position());

		return true;
	}

	return false;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Microblock,代码行数:21,代码来源:MicroblockContainer.java

示例3: remove

import nova.core.block.Stateful; //导入依赖的package包/类
public boolean remove(Vector3D localPos) {
	if (has(localPos)) {
		get(localPos).get().block.events.publish(new Stateful.UnloadEvent());
		blockMap.remove(localPos);

		if (microblocks().size() > 0 && NovaMicroblock.instance.network.isServer()) {
			NovaMicroblock.instance.network.sync(block);
		}

		//Invoke neighbor change event
		microblocks().stream()
			.forEach(m -> m.block.events.publish(new Microblock.MicroblockChangeEvent(Optional.of(localPos))));

		block.world().markChange(block.position());
		return true;
	}

	return false;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Microblock,代码行数:20,代码来源:MicroblockContainer.java

示例4: entityInit

import nova.core.block.Stateful; //导入依赖的package包/类
/**
 * All methods below here are exactly the same between FWEntity and FWEntityFX.
 * *****************************************************************************
 */
@Override
protected void entityInit() {
	//MC calls entityInit() before we finish wrapping, so this variable is required to check if wrapped exists.
	if (wrapped != null) {
		wrapped.events.publish(new Stateful.LoadEvent());
		updateCollider();
		WrapperEvent.FWEntityCreate event = new WrapperEvent.FWEntityCreate(wrapped, this);
		Game.events().publish(event);
	}
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:15,代码来源:FWEntity.java

示例5: hasTileEntity

import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public boolean hasTileEntity(IBlockState state) {
	// A block requires a TileEntity if it stores data or if it ticks.
	return Storable.class.isAssignableFrom(blockClass)
		|| Stateful.class.isAssignableFrom(blockClass)
		|| Updater.class.isAssignableFrom(blockClass);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:8,代码来源:FWBlock.java

示例6: validate

import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public void validate() {
	super.validate();
	if (block.components.has(TEBlockTransform.class))
		block.components.remove(TEBlockTransform.class);
	block.components.getOrAdd(new TEBlockTransform(this));

	if (cacheData != null && block instanceof Storable) {
		((Storable) block).load(cacheData);
		cacheData = null;
	}

	block.events.publish(new Stateful.LoadEvent());
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:15,代码来源:FWTile.java

示例7: hasTileEntity

import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public boolean hasTileEntity(int metadata) {
	// A block requires a TileEntity if it stores data or if it ticks.
	return Storable.class.isAssignableFrom(blockClass)
		|| Stateful.class.isAssignableFrom(blockClass)
		|| Updater.class.isAssignableFrom(blockClass);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:8,代码来源:FWBlock.java

示例8: load

import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public void load(Data data) {
	blockMap.clear();
	((Data) data.get(saveID)).forEach((k, v) -> {
		Block savedBlock = (Block) Data.unserialize((Data) v);
		Microblock microblock = savedBlock.components.get(Microblock.class);
		put(idToPos(Integer.parseInt(k)), microblock);
		microblock.block.events.publish(new Stateful.LoadEvent());
	});
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Microblock,代码行数:11,代码来源:MicroblockContainer.java

示例9: setDead

import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public void setDead() {
	wrapped.events.publish(new Stateful.UnloadEvent());
	super.setDead();
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:6,代码来源:FWEntity.java

示例10: invalidate

import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public void invalidate() {
	block.events.publish(new Stateful.UnloadEvent());
	super.invalidate();
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:6,代码来源:FWTile.java


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