Mcpc+ Server unsolved
Hideman85 opened this issue ยท 4 comments
As you can observe at https://github.com/AtomicStryker/atomicstrykers-minecraft-mods/blob/1.8/MultiMine/src/main/java/atomicstryker/multimine/common/MultiMineServer.java#L132, Multi Mine calls the Forge BlockBreak event. A cauldron/spigot/mcpc/whateveritscalled server should allow observation of and interaction with Forge Events.
Yes I view =) it but I am in version 1.5.2 and the method does not exist in ForgeHook so how I can solved it ?
-> ForgeHook : https://github.com/MinecraftForge/MinecraftForge/blob/snapshot15/common/net/minecraftforge/common/ForgeHooks.java
other event has here :
-> ForgeEventFactory : https://github.com/MinecraftForge/MinecraftForge/blob/snapshot15/common/net/minecraftforge/event/ForgeEventFactory.java
Can I use this:
/*
* on net.minecraftforge.common.ForgeHooks
*
* onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos)
*/
// Tell client the block is gone immediately then process events
if (world.getTileEntity(pos) == null)
{
S23PacketBlockChange packet = new S23PacketBlockChange(world, pos);
packet.field_148883_d = Blocks.air.getDefaultState();
entityPlayer.playerNetServerHandler.sendPacket(packet);
}
// Post the block break event
IBlockState state = world.getBlockState(pos);
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer);
event.setCanceled(preCancelEvent);
MinecraftForge.EVENT_BUS.post(event);
// Handle if the event is canceled
if (event.isCanceled())
{
// Let the client know the block still exists
entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos));
. . .
}
Please help me, i think it's possible to correct this on 1.5.2, and I really want to correct this.
Thanks for your answer and your time, so
You are trying to port MultiMine to 1.5.2?
I use your source in 1.5.2, but I want a bukkit plugin can cancel mining because You can break block in protect area ( it's nice for cheater =) but I prefer to correct it )
You should be able to use "if (ForgeEventFactory.getBreakSpeed(player, block, metadata, defaultBlockBreakSpeed) > 0)" if your bukkit plugins listens to that event.
Ok I try it and I send you result, thanks again.
Have you got an project at the moment ?
Because I view on different forum it's able to interact between forge mods and bukkit plugin.
I think it would be great that you develop this.
http://forum.ironcraft.fr/topic/4719-172-dialoguer-entre-forge-et-plugins/
http://forum.ironcraft.fr/topic/672-125-bukkit-afficher-son-argent-dans-linventaire/?page=1
http://www.minecraftforge.net/forum/index.php/topic,28953.0.html
This project require develop a mod API and plugin API for developer and modder.
EDIT : Does not work again :(
I think I try what I explain before
You are trying to port MultiMine to 1.5.2? You should be able to use "if (ForgeEventFactory.getBreakSpeed(player, block, metadata, defaultBlockBreakSpeed) > 0)" if your bukkit plugins listens to that event.