Jump to content

world.isRemote problem


laifsjo

Recommended Posts

Hey, i am trying to place a block when interacting with a mob. But when i just spawn it using this code:

world.setBlockWithNotify((int)this.posX, (int)this.posY + 5, (int)this.posZ, MyBlock.block.blockID);

it places it, and when i reload the world, it's gone.

when i try this:

if(!world.isRemote) world.setBlockWithNotify((int)this.posX, (int)this.posY + 5, (int)this.posZ, MethyrBlocks.methyrFarmSide.blockID);

nothing happens (it wont even place the block) and when i try when the world IS remote, the same happens as doing nothing.

when i type:

System.out.println(world.isRemote);

i get two true messages.

Can somebody please help me with this, it's really annoying :/

Link to comment
Share on other sites

Make sure that you're doing it in code that will be run by the server, not the client

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Link to comment
Share on other sites

In one of my blocks I have

 

@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) {
par1World.setBlock(par2, par3 + 1, par4, 3004);
par1World.setBlock(par2, par3 + 2, par4, 3005);
}

 

to place two other blocks directly above this block.

Link to comment
Share on other sites

  • 3 months later...

Well you are only saying the lines of code and with the !world.isRemote it seems fine..

So where are you calling these lines from as mentioned above you need to call them inn a method the server reads at all.

 

It would probably help you get help faster and better if you provided more of your code for the action you are trying to do :)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

 

I know, I imagine once one knows how to get them into a method the server reads it will be really simple and it will all make sense.  But how, as laifsjo asked back in december, do we do that?

 

World world = Minecraft.getMinecraft().theWorld; returns a world object, but the method scheduleBlockUpdate() of this world object does nothing, so calling world.setBlock() of this would to place for example a block of sand does not schedule an update, so  the sand never starts to fall.

 

So, how do we get the server world. how do we call methods from our mod on the server, either a real server on another machine, or the local one started by the  minecraft client?

 

How do we write code that is called by the server? 

 

 

 

 

Link to comment
Share on other sites

 

I know, I imagine once one knows how to get them into a method the server reads it will be really simple and it will all make sense.

 

And it is, but it seems to be not said anywhere  ;D

 

Please correct me if I am wrong, but the code runs on both the server and the client, but not at  the same time,  see here (http://www.minecraftforge.net/forum/index.php/topic,7929.msg40041.html#msg40041) for my original post and imagine a lot of head banging on a desk and me saying "why why why"

Link to comment
Share on other sites

 

Hi

 

What does @SideOnly(Side.CLIENT) actually do?

 

I had thought it meant the code only ran or applied to the client or server side of the mod. 

 

But in my block I have this:

 

	
    @Override
    @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
	String tex;
	LogHelper.detail("Loading " + this.getUnlocalizedName2() + " rotting textures...");
	iconBuffer = new Icon[16];
	tex = Reference.MOD_ID + ":" + this.getUnlocalizedName2() + "_00";
	iconBuffer[0] =  iconRegister.registerIcon(tex); 
	LogHelper.verbose("Loaded " + tex);
	tex = Reference.MOD_ID + ":" + this.getUnlocalizedName2() + "_01";
	iconBuffer[1] =  iconRegister.registerIcon(tex);

 

Yet the log messages are being logged twice, so what is happening?  I am trying to understand what it does?

 

Thanks,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • DAFTAR & LOGIN BIGO4D Bigo4D adalah situs togel online yang menjadi pilihan banyak pemain di Indonesia. Dengan berbagai keunggulan yang dimilikinya, Bigo4D mampu menjadi situs togel terbesar di pasaran saat ini. Dalam artikel ini, kami akan membahas secara lengkap tentang Bigo4d dan alasan-alasannya menjadi situs togel favorit banyak pemain.
    • Slot Gacor >> Mudah Maxwin Bersama Djarum4D   Slot gacor adalah salah satu jenis permainan judi online yang sangat populer di Indonesia. Bermain slot gacor berarti bermain permainan slot dengan kemungkinan keluaran yang lebih tinggi daripada slot tradisional. Dalam artikel ini, kami akan membahas secara lengkap tentang slot gacor, mulai dari pengertian dasar, cara bermain, strategi pemain, serta aspek keamanan dan etika dalam bermain.
    • DAFTAR & LOGIN TAYO4D   Slot gacor online adalah permainan yang menarik dan menghasilkan keuntungan untuk banyak pemain di seluruh dunia. Dalam artikel ini, kita akan membahas tentang cara memilih dan memainkan slot gacor online terbaik.
    • Tayo4D : Bandar Online Togel Dan Slot Terbesar Di Indonesia     Pemain taruhan Tayo4D yang berkualitas memerlukan platform yang aman, terpercaya, dan mudah digunakan. Dalam era teknologi ini, banyak situs online yang menawarkan layanan taruhan togel 4D, tetapi memilih yang tepat menjadi tuntas. Berikut adalah cara untuk membuat artikel yang membahas tentang situs online terpercaya untuk permainan taruhan togel 4D.  
    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa OLXTOTO telah menetapkan standar baru dalam dunia perjudian dengan menjadi platform terbesar untuk pengalaman gaming yang penuh kemenangan dan kegacoran, sepanjang masa. Dengan fokus yang kuat pada menyediakan permainan yang menghadirkan kesenangan tanpa batas dan peluang kemenangan besar, OLXTOTO telah menjadi pilihan utama bagi para pencinta judi berani di Indonesia. Maxwin: Mengejar Kemenangan Terbesar Maxwin bukan sekadar kata-kata kosong di OLXTOTO. Ini adalah konsep yang ditanamkan dalam setiap aspek permainan yang mereka tawarkan. Dari permainan slot yang menghadirkan jackpot besar hingga berbagai opsi permainan togel dengan hadiah fantastis, para pemain dapat memperoleh peluang nyata untuk mencapai kemenangan terbesar dalam setiap taruhan yang mereka lakukan. OLXTOTO tidak hanya menawarkan kesempatan untuk menang, tetapi juga menjadi wadah bagi para pemain untuk meraih impian mereka dalam perjudian yang berani. Gacor: Keberuntungan yang Tak Tertandingi Keberuntungan seringkali menjadi faktor penting dalam perjudian, dan OLXTOTO memahami betul akan hal ini. Dengan berbagai strategi dan analisis yang disediakan, pemain dapat menemukan peluang gacor yang tidak tertandingi dalam setiap taruhan. Dari hasil togel yang tepat hingga putaran slot yang menguntungkan, OLXTOTO memastikan bahwa setiap taruhan memiliki potensi untuk menjadi momen yang mengubah hidup. Inovasi dan Kualitas Tanpa Batas Tidak puas dengan prestasi masa lalu, OLXTOTO terus berinovasi untuk memberikan pengalaman gaming terbaik kepada para pengguna. Dengan menggabungkan teknologi terbaru dengan desain yang ramah pengguna, platform ini menyajikan antarmuka yang mudah digunakan tanpa mengorbankan kualitas. Setiap pembaruan dan peningkatan dilakukan dengan tujuan tunggal: memberikan pengalaman gaming yang tanpa kompromi kepada setiap pengguna. Komitmen Terhadap Kepuasan Pelanggan Di balik kesuksesan OLXTOTO adalah komitmen mereka terhadap kepuasan pelanggan. Tim dukungan pelanggan yang profesional siap membantu para pemain dalam setiap langkah perjalanan gaming mereka. Dari pertanyaan teknis hingga bantuan dengan transaksi keuangan, OLXTOTO selalu siap memberikan pelayanan terbaik kepada para pengguna mereka. Penutup: Mengukir Sejarah dalam Dunia Perjudian Daring OLXTOTO bukan sekadar platform perjudian berani biasa. Ini adalah ikon dalam dunia perjudian daring Indonesia, sebuah destinasi yang menyatukan kemenangan dan keberuntungan dalam satu tempat yang mengasyikkan. Dengan komitmen mereka terhadap kualitas, inovasi, dan kepuasan pelanggan, OLXTOTO terus mengukir sejarah dalam perjudian dunia berani, menjadi nama yang tak terpisahkan dari pengalaman gaming terbaik. Bersiaplah untuk mengalami sensasi kemenangan terbesar dan keberuntungan tak terduga di OLXTOTO - platform maxwin dan gacor terbesar sepanjang masa.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.