-
Run task asynchronously
Can you write example or post link?
-
Run task asynchronously
Is there a way to execute code asynchronously? For example I need to make a request in MySQL. Something like this: public static void execute(final String query) { Bukkit.getScheduler().runTaskAsynchronously(Main.plugin, new Runnable() { @Override public void run() { if (!hasConnected()) { connect(); } Logger.debug("Sended Query: " + query.replace("\\", "\\\\")); try { connection.createStatement().execute(query); } catch (Exception e) { Logger.debug("Возникла ошибка. Запрос не может быть выполнен или база недоступна."); } } }); }
-
[1.7.2] mouseClicked not worked
I have class, which extend GuiScreen, i'm trying override mouseClicked, but nothing happens @Override protected void mouseClicked(int i, int j, int k) { System.out.println("Clicked!"); if ((k != 0) || (this.hover < 0)) return; if (this.multipleSelection) { if (this.selectedList.contains(this.list.get(this.hover))) this.selectedList.remove(this.list.get(this.hover)); else this.selectedList.add(this.list.get(this.hover)); } else { if (this.hover >= 0) this.selected = this.hover; this.hover = -1; } }
-
[1.7.2] How send string via netty
I want to send a string (eg player name) through the netty, however, the method writeString() and readString() do not exist. How i can do this? And how i get EntityPlayer which send the packet? package ru.DoctorBooooom.LastWorld.network.packet; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; public class Packet extends APacket { @Override public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { buffer.writeString("PlayerName"); } @Override public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { String name = buffer.readString(); } @Override public void handleClientSide(EntityPlayer player) { } @Override public void handleServerSide(EntityPlayer player) { } }
-
[1.7.2] How do I make cacti do more damage?
@SubscribeEvent public void onEntityGetDamage(LivingHurtEvent event) { String type = event.source.damageType; if (type.equals("cactus")) { event.entityLiving.setHealth(event.entityLiving.getHealth() - 100500); } } Also, you can check the entityLiving is a player
-
[1.7.2] Block, for specified player
thx
-
[1.7.2] Block, for specified player
okay, it works fine, but there are ideas how to remove the mesh around the block?
-
[1.7.2] Block, for specified player
Something like this http://pastebin.com/hKyAgBwP ? And further check on the server when you try to break the block?
-
[1.7.2] Block, for specified player
But how do I get a block simultaneously exist and not exist? And if two players stand next to it and one can see it, the second should not see it. It's like magic points in taumсraft
-
[1.7.2] Block, for specified player
I put a block. if I'm creative mode (or put on a helmet for example), then I see him and I can break / change. If not, the block is not displayed and I can't see him / break / step
-
[1.7.2] Block, for specified player
How create block, that visible only for players in creative mod?
-
[1.7.2] How to use player.addChatMessage
entityPlayer.addChatMessage(new ChatComponentTranslation("msg.message_name.txt")); You need to create a language file (make sure its UTF-8 encoded) assets/<modID>/lang/<langID>.lang Example File: en_US.lang msg.message_name.txt=Displayed Message
-
[1.7.2] Entity living animation
I created a wild boar (https://www.dropbox.com/s/ly87tofi7m0zo9u/2014-02-16_17.31.16.png), but he has no animation: he does not look at the players around, when attacking crashed with a run. I would like that he would sometimes dug the ground head and react to players. How to do it? EntityBoar class: http://pastebin.com/r7LTdGkT EntityBoar renderer: http://pastebin.com/eQqNbCS5 EntityBoar model: http://pastebin.com/BwHDisXT
-
[1.7.2] NBT data are not saved
As it turned out, writes NBT date correctly. However reads not correctly. Probably a mistake in NBTTagList nbtListStats = nbtPlayer.getTagList("Stats", 9); , because there was no 1.6.4 2nd parameter, and now I have taken it at random.
-
Blocks displayed as tile.null.name
myblock= new BlockClass().setStepSound(Block.soundTypeWood).setHardness(1.0F).setBlockTextureName("mymod:myblock").setBlockName("myblock"); GameRegistry.registerBlock(myblock,"MyBlock");
IPS spam blocked by CleanTalk.