本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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());
}
示例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);
}
示例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());
});
}
示例9: setDead
import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public void setDead() {
wrapped.events.publish(new Stateful.UnloadEvent());
super.setDead();
}
示例10: invalidate
import nova.core.block.Stateful; //导入依赖的package包/类
@Override
public void invalidate() {
block.events.publish(new Stateful.UnloadEvent());
super.invalidate();
}