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