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


Java BlockEvent.PlaceEvent方法代码示例

本文整理汇总了Java中net.minecraftforge.event.world.BlockEvent.PlaceEvent方法的典型用法代码示例。如果您正苦于以下问题:Java BlockEvent.PlaceEvent方法的具体用法?Java BlockEvent.PlaceEvent怎么用?Java BlockEvent.PlaceEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.world.BlockEvent的用法示例。


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

示例1: placed

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void placed(BlockEvent.PlaceEvent event)
{
	if(event.getWorld() !=null && !event.getWorld().isRemote && event.getWorld().provider.getDimension() == ModDimensions.CUBE_ID){
		PlayerCube cube = CubeManager.getInstance().getPlayerCubeFromPos(event.getWorld(), event.getPos());
		if(cube !=null){
			for(TileEntityPlayerCubePortal portal : cube.watchers){
				IBlockState eState = event.getPlacedBlock();
				@SuppressWarnings("deprecation")
				IBlockState state = eState.getBlock().getActualState(eState, event.getWorld(), event.getPos());
	            TileEntity tileentity = event.getWorld().getTileEntity(event.getPos());
	            if (tileentity != null || state.getBlock().hasTileEntity(state) && (tileentity = event.getWorld().getTileEntity(event.getPos())) != null) {
	                //tileentity.validate();
	            }
	            if (portal.mobileChunk.addBlockWithState(event.getPos(), state)) {
	                TileEntity tileClone = tileentity;
	                portal.mobileChunk.setTileEntity(event.getPos(), tileClone);
	            }
	            portal.mobileChunk.setChunkModified();
	            portal.mobileChunk.onChunkLoad();
			}
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:25,代码来源:EventHandler.java

示例2: onBlockPlace

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onBlockPlace(BlockEvent.PlaceEvent e) {
    if (!e.getWorld().isRemote) {
        for (EnumFacing facing : EnumFacing.VALUES) {
            TileEntity tile = e.getWorld().getTileEntity(e.getBlockSnapshot().getPos().offset(facing));

            if (tile != null && TileEntityPipeEStorage.isNetworkTile(tile)) {
                EStorageNetwork network = TileEntityPipeEStorage.getTileNetwork(tile);
                if (network != null && !network.hasAbility(e.getPlayer(), NetworkAbility.BUILD)) {
                    ChatUtil.sendNoSpam(e.getPlayer(), Lang.localize("gui.networkability."+NetworkAbility.BUILD.getId()));

                    e.setCanceled(true);

                    return;
                }
            }
        }
    }
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:20,代码来源:EventHandler.java

示例3: placeBlock

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void placeBlock(BlockEvent.PlaceEvent event) {
	for (Arena arena : arenas) {
		if (!arena.getPlayers().contains(event.getPlayer().getUniqueID()) || arena.getWorld() != event.getWorld())
			continue;

		if (!event.getWorld().isRemote && arena.getBoss() instanceof EntityZachriel)
			((EntityZachriel) arena.getBoss()).nemezDrive.trackBlock(event.getPos(), event.getWorld().getBlockState(event.getPos()));

		//if (!event.getWorld().isRemote)
		//	for (ZachTimeManager timeManager : zachHourGlasses) {
		//		if (timeManager.getEntityZachriel().getEntityId() == arena.getBossID()) {
		//			timeManager.trackBlock(Blocks.AIR.getDefaultState(), event.getPos());
		//		}
		//	}
	}
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:18,代码来源:ArenaManager.java

示例4: recordBlock

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST) // Act after any cancellations
public void recordBlock(BlockEvent.PlaceEvent event) {
    IBlockState bs = event.placedBlock;
    Block block = bs.getBlock();
    if (event.player == null) return;
    if (event.world.isRemote) return;
    if (event.player instanceof FakePlayer) return;
    if (block.getBlockHardness(event.world, event.pos) <= 0F) return;
    if (PlayerUtil.isPlayerCreative(event.player)) return;

    int idmd = hash(bs);
    final ItemStack theItem = toItem(block, event.world, event.pos, bs);
    final PlacedBlock at = new PlacedBlock(FzUtil.getWorldDimension(event.world), event.pos, idmd, theItem);
    markPlacement(event.player, at);
    if (event.player instanceof EntityPlayerMP) {
        send(event.player, at);
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:19,代码来源:BlockUndo.java

示例5: EntityEvents

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
 public void EntityEvents(BlockEvent.PlaceEvent evt) {
if(Main.debug==1)System.out.println(evt.getPlayer().getName() + " called PlaceEvent");

if(!Main.logged.contains(evt.getPlayer().getName())){
	evt.setCanceled(true);
	}
		}
 
开发者ID:Fungie2134,项目名称:AuthMod,代码行数:9,代码来源:EntityEvents.java

示例6: onPlaceBlock

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlaceBlock(BlockEvent.PlaceEvent event)
{
    if (event.itemInHand != null && event.player instanceof EntityPlayerMP )
    {
        // This event is received on the server side, so we need to pass it to the client.
        sendItemStackToClient((EntityPlayerMP)event.player, MalmoMessageType.SERVER_DISCARDITEM, event.itemInHand);
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:10,代码来源:RewardForDiscardingItemImplementation.java

示例7: placeMobSpawner

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void placeMobSpawner(BlockEvent.PlaceEvent event) {
	
	if (event.getState().getBlock() != Blocks.MOB_SPAWNER) return;
	
	ItemStack spawner = event.getItemInHand();
	if (spawner.hasTagCompound() && spawner.getTagCompound().hasKey("Spawner") && Block.getBlockFromItem(spawner.getItem()) == Blocks.MOB_SPAWNER) {
		TileEntity tile = TileEntity.func_190200_a(event.getWorld(), spawner.getTagCompound().getCompoundTag("Spawner"));
		event.getWorld().setTileEntity(event.getPos(), tile);
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:12,代码来源:UCEventHandlerServer.java

示例8: placeBanner

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void placeBanner(BlockEvent.PlaceEvent event) {
	TileEntity banner = event.getWorld().getTileEntity(event.getBlockSnapshot().getPos());
	if(banner != null && banner instanceof TileEntityBanner){
		List<BannerPattern> patterns = getPatterns((TileEntityBanner) banner);
		if(patterns.contains(TF2weapons.redPattern) || patterns.contains(TF2weapons.bluPattern)){
			//System.out.println("Banner is");
			event.getWorld().getCapability(TF2weapons.WORLD_CAP, null).banners.add(event.getPos());
		}
	}
	
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:13,代码来源:TF2EventsCommon.java

示例9: onBlockPlace

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockEvent.PlaceEvent event)
{
    if ( isInsideBorder(event.getWorld(), event.getPos().getX(), event.getPos().getZ()) )
        return;

    event.setResult(BlockEvent.Result.DENY);
    event.setCanceled(true);
}
 
开发者ID:abused,项目名称:World-Border,代码行数:10,代码来源:BlockPlaceListener.java

示例10: redstonePlace

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void redstonePlace(BlockEvent.PlaceEvent event)
{
    if(event.isCanceled())
        return;

    World world = event.getWorld();
    BlockPos pos = event.getPos();
    IBlockState state = event.getPlacedBlock();

    if(state.getBlock() == Blocks.REDSTONE_WIRE)
    {
        scheduleRedstone(world,pos,100);
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:16,代码来源:RedstoneBoilHandler.java

示例11: blockPlaced

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void blockPlaced(BlockEvent.PlaceEvent event){
	if(event.block instanceof BlockNote){
		TileEntityNote entity = (TileEntityNote) Minecraft.getMinecraft().theWorld.getTileEntity(event.x, event.y, event.z);
		Minecraft.getMinecraft().displayGuiScreen(new GuiSet(entity, Minecraft.getMinecraft().currentScreen));
	}
}
 
开发者ID:cqjjjzr,项目名称:NoteblockTweak,代码行数:8,代码来源:NoteblockPlaceHandler.java

示例12: onBlockPlace

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onBlockPlace(BlockEvent.PlaceEvent event) {
	if(event.getWorld().isRemote) {
		return;
	}

	BlockPos pos = event.getPos();

	if(!isPartOfTank(event.getWorld(), pos)) {
		return;
	}

	addBlockForCheck(event.getWorld(), pos);
}
 
开发者ID:Lordmau5,项目名称:FFS,代码行数:15,代码来源:TankManager.java

示例13: onPlaceBlock

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlaceBlock(BlockEvent.PlaceEvent event)
{
    if (event.getPlayer().getHeldItem(event.getHand()) != null && event.getPlayer() instanceof EntityPlayerMP )
    {
        // This event is received on the server side, so we need to pass it to the client.
        sendItemStackToClient((EntityPlayerMP)event.getPlayer(), MalmoMessageType.SERVER_DISCARDITEM, event.getPlayer().getHeldItem(event.getHand()));
    }
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:10,代码来源:RewardForDiscardingItemImplementation.java

示例14: CheckBuildSpaceForAllowedBlockReplacement

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
/**
 * This method is used to determine if the player can build the structure.
 * 
 * @param configuration The structure configuration.
 * @param world The world to build the structure in.
 * @param startBlockPos The start location to start checking blocks.
 * @param endBlockPos The end location for checking blocks. Combined with the startBlockPos, this should be a cube.
 * @param player The player running this build request.
 * @return True if all blocks can be replaced. Otherwise false and send a
 *         message to the player.
 */
public static boolean CheckBuildSpaceForAllowedBlockReplacement(StructureConfiguration configuration, World world, BlockPos startBlockPos, BlockPos endBlockPos, EntityPlayer player)
{
	// Check each block in the space to be cleared if it's protected from
	// breaking or placing, if it is return false.
	for (BlockPos currentPos : BlockPos.getAllInBox(startBlockPos, endBlockPos))
	{
		IBlockState blockState = world.getBlockState(currentPos);
		
		if (!blockState.getBlock().isAir(blockState, world, currentPos))
		{
			BlockEvent.BreakEvent breakEvent = new BlockEvent.BreakEvent(world, currentPos, world.getBlockState(currentPos), player);
		
			if (MinecraftForge.EVENT_BUS.post(breakEvent))
			{
				return false;
			}
		}
		 
		BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(new BlockSnapshot(world, currentPos, blockState), Blocks.AIR.getDefaultState(), player, EnumHand.MAIN_HAND);

		if (MinecraftForge.EVENT_BUS.post(placeEvent))
		{
			return false;
		}
		
		// A hardness of less than 0 is unbreakable.
		if (blockState.getBlockHardness(world, currentPos) < 0.0f)
		{
			// This is bedrock or some other type of unbreakable block. Don't allow this block to be broken by a structure.
			return false;
		}
	}

	return true;
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:47,代码来源:BuildingMethods.java

示例15: place

import net.minecraftforge.event.world.BlockEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void place(BlockEvent.PlaceEvent event) {
	for (Speaker speaker : speakers)
		if (speaker.block == event.getPlacedBlock().getBlock()) {
			addSpeakerNode(speaker, event.getWorld(), event.getPos());
			return;
		}
}
 
开发者ID:TeamWizardry,项目名称:TMT-Refraction,代码行数:9,代码来源:SoundManager.java


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