本文整理了Java中net.minecraft.world.World.addBlockEvent()
方法的一些代码示例,展示了World.addBlockEvent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.addBlockEvent()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:addBlockEvent
暂无
代码示例来源:origin: Vazkii/Botania
public void handRotate() {
if(!world.isRemote)
world.addBlockEvent(getPos(), ModBlocks.animatedTorch, 0, (side + 1) % 4);
}
代码示例来源:origin: Vazkii/Botania
public void toggle() {
if(!world.isRemote) {
world.addBlockEvent(getPos(), ModBlocks.animatedTorch, 0, torchMode.modeSwitcher.rotate(this, side));
nextRandomRotation = world.rand.nextInt(4);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
}
代码示例来源:origin: Vazkii/Botania
private void craftingFanciness() {
if(soundTicks == 0) {
world.playSound(null, pos, ModSounds.manaPoolCraft, SoundCategory.BLOCKS, 0.4F, 4F);
soundTicks = 6;
}
world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
}
代码示例来源:origin: Vazkii/Botania
public void saveLastRecipe() {
lastRecipe = new ArrayList<>();
for(int i = 0; i < getSizeInventory(); i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack.isEmpty())
break;
lastRecipe.add(stack.copy());
}
recipeKeepTicks = 400;
world.addBlockEvent(getPos(), ModBlocks.altar, SET_KEEP_TICKS_EVENT, 400);
}
代码示例来源:origin: Vazkii/Botania
public void saveLastRecipe() {
lastRecipe = new ArrayList<>();
for(int i = 0; i < getSizeInventory(); i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
if(stack.isEmpty())
break;
lastRecipe.add(stack.copy());
}
recipeKeepTicks = 400;
world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_KEEP_TICKS_EVENT, 400);
}
代码示例来源:origin: Vazkii/Botania
private void updateActivePositions() {
int newActivePositions = 0;
for (int i = 0; i < ticksRemaining.length; i++) {
if (ticksRemaining[i] > -1) {
newActivePositions |= 1 << i;
}
}
if (newActivePositions != activePositions) {
getWorld().addBlockEvent(getPos(), supertile.getBlockType(), UPDATE_ACTIVE_EVENT, newActivePositions);
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
if(getWorld().isRemote) {
if(state != NONE && Math.random() > 0.6)
Botania.proxy.wispFX(supertile.getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5, state == INCREASING ? 0.05F : 1F, 0.05F, state == INCREASING ? 1F : 0.05F, (float) Math.random() / 7, (float) -Math.random() / 50);
} else {
int mana = 0;
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
BlockPos pos = supertile.getPos().offset(dir);
if(getWorld().isBlockLoaded(pos)) {
TileEntity tile = supertile.getWorld().getTileEntity(pos);
if(tile instanceof IManaPool)
mana += ((IManaPool) tile).getCurrentMana();
}
}
int newState = mana > lastMana ? INCREASING : mana < lastMana ? DECREASING : NONE;
if(newState != state)
getWorld().addBlockEvent(getPos(), supertile.getBlockType(), SET_STATE_EVENT, newState);
if(ticksExisted % 60 == 0)
lastMana = mana;
}
}
代码示例来源:origin: Vazkii/Botania
EntityItem outputItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
world.addBlockEvent(getPos(), ModBlocks.brewery, CRAFT_EFFECT_EVENT, recipe.getBrew().getColor(output));
代码示例来源:origin: Vazkii/Botania
world.addBlockEvent(getPos(), getBlockType(), CHARGE_EFFECT_EVENT, outputting ? 1 : 0);
代码示例来源:origin: Vazkii/Botania
world.addBlockEvent(getPos(), supertile.getBlockType(), RECIPE_COMPLETE_EVENT, positionAt);
if(ConfigHandler.blockBreakParticles)
supertile.getWorld().playEvent(2001, coords, Block.getStateId(recipe.getOutputState()));
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public void openInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() + 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
if( this.getPlayerOpen() == 1 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onUpdate() {
super.onUpdate();
if(!supertile.getWorld().isRemote && mana == 0) {
List<EntityTNTPrimed> tnts = supertile.getWorld().getEntitiesWithinAABB(EntityTNTPrimed.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(EntityTNTPrimed tnt : tnts) {
if(tnt.getFuse() == 1 && !tnt.isDead && !supertile.getWorld().getBlockState(new BlockPos(tnt)).getMaterial().isLiquid()) {
tnt.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 0.2F, (1F + (supertile.getWorld().rand.nextFloat() - supertile.getWorld().rand.nextFloat()) * 0.2F) * 0.7F);
tnt.setDead();
mana += getMaxMana();
sync();
getWorld().addBlockEvent(getPos(), supertile.getBlockType(), EXPLODE_EFFECT_EVENT, tnt.getEntityId());
break;
}
}
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public void closeInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() - 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
if( this.getPlayerOpen() < 0 )
{
this.setPlayerOpen( 0 );
}
if( this.getPlayerOpen() == 0 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
protected void execute(EntityPlayer player) {
player.world.addBlockEvent(pos, Block.getBlockById(id), a, b);
//TODO multi threading - scheduled tasks
}
代码示例来源:origin: Vazkii/Botania
mana = 0;
world.addBlockEvent(getPos(), ModBlocks.enchanter, CRAFT_EFFECT_EVENT, 0);
advanceStage();
代码示例来源:origin: Vazkii/Botania
getWorld().addBlockEvent(getPos(), getWorld().getBlockState(getPos()).getBlock(), START_BURN_EVENT, item.getEntityId());
sync();
代码示例来源:origin: Vazkii/Botania
world.spawnEntity(outputItem);
currentRecipe = null;
world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_COOLDOWN_EVENT, 60);
world.addBlockEvent(getPos(), ModBlocks.runeAltar, CRAFT_EFFECT_EVENT, 0);
代码示例来源:origin: blay09/CookingForBlockheads
public void setForcedOpen(boolean isForcedOpen) {
this.isForcedOpen = isForcedOpen;
tileEntity.getWorld().addBlockEvent(tileEntity.getPos(), tileEntity.getBlockType(), 2, isForcedOpen ? 1 : 0);
}
代码示例来源:origin: Vazkii/Botania
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
代码示例来源:origin: PenguinSquad/Harvest-Festival
@Override
public void closeInventory(EntityPlayer player) {
players--;
if (players < 0) {
players = 0;
}
player.world.addBlockEvent(tile.getPos(), tile.getBlockType(), 1, players);
tile.getWorld().playSound(null, tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(), HFSounds.FRIDGE, SoundCategory.BLOCKS, 2F, tile.getWorld().rand.nextFloat() * 0.1F + 0.9F);
tile.saveAndRefresh(); //Update the client about this
}
内容来源于网络,如有侵权,请联系作者删除!