Jump to content

Help with porting BlockPhysics mod from 1.6.2 to 1.12.


st4s1k

Recommended Posts

Hi, my name is Stanislav. I'm new to modding, but I'm familiar with Java (a little bit, to be objective). This is my first encounter with modding to be fair.

I am trying to port a very old mod called BlockPhysics from version 1.6.2 to version 1.12. I know it is tricky and hard, but I want to try anyway, because the creator seems to quit modding.
Here is the mod on github: https://github.com/vidplace7/BlockPhysics

There was about 1000 errors in a class file that I'm trying to repair now, and now there are about 500, so there is some (small) progress x)
There are many fields/methods or even data-types in the old forge/minecraft that are missing int the new versions of this two.

Here are some of them:

EntityTracker#movingblocks    // no such field
World#setBlock()    // no such method
Facing    // no such class
EntityfallingBlock#bpdata    // no such field in this class
EntityfallingBlock#slideDir    // no such field in this class
Block#getOrientation(int)    // no such method
Block#isIndirectlyPowered(World, int, int, int, int)	// no such method
ItemStack#stackSize    // no such field
Item#redstone    // no such field
Explosion#explosionSize    // no such field
EnchantmentProtection#func_92092_a(Entity, double)    // some obfuscated method (from github: https://github.com/vidplace7/BlockPhysics/blob/master/src/blockphysics/BlockPhysics.java)
ExtendedBlockStorage#getExtBlockID()    // no such method
ExtendedBlockStorage#getExtBlockMetadata()    // no such method
World#moveTickList // no such field

Maybe you could help me. I would appreciate it very much.

I figured out some minor issues, like "Block.grass" should be changed to "Blocks.GRASS", or method names have changed, I always check for similar methods, or instead of coordinates a method may ask for BlockPos, those are not a big deal.

Thank you.

Edited by st4s1k
Link to comment
Share on other sites

I’m pretty sure someone already ported it. You can use MCP to find the changed mappings on espernet or on discord.

The Block+Mets system was changed to the BlockState system in 1.8. Also models & everything related to rendering changed

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

28 minutes ago, Cadiboo said:

I’m pretty sure someone already ported it. You can use MCP to find the changed mappings on espernet or on discord.

The Block+Mets system was changed to the BlockState system in 1.8. Also models & everything related to rendering changed

Yes, it seems like there are some similar mods, not sure that they are completely the same, but maybe something that will satisfy me, because I just wanted a block physics mod for my server =D

Thank you!

Link to comment
Share on other sites

14 hours ago, st4s1k said:

Nope... It looks like it's a scam... https://www.minecraftresource.com/block-physics-mod/

 

Hate pages like this :D

If it’s not from CurseForge/minecraft forums it’s probably a scam

Edited by diesieben07
removed link
  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Do you know, how can I replace this deprecated method?
 

if ( par1Block.getRenderType() == 18) {

 

Also, you said that :

Quote

everything related to rendering changed

Where can I get informed more about rendering?

There is a datatype that I cannot find replacement to:

RenderBlocks
Edited by st4s1k
Link to comment
Share on other sites

Currently I'm "porting" in e very primitive way:

class xWorld extends World {

   protected xWorld(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) {
      super(saveHandlerIn, info, providerIn, profilerIn, client);
   }

   public boolean setBlock(int x, int y, int z, Block block, int meta, int flags) {
      BlockPos blockPos = new BlockPos(x, y, z);

      return setBlockState(
            blockPos,
            block.getDefaultState(),
            flags
      );
   }

   public Block getBlock(int x, int y, int z) {
      return getBlockState(new BlockPos(x, y, z)).getBlock();
   }

   public int getBlockMetadata(int x, int y, int z) {
      return getBlock(x, y, z).getMetaFromState(getBlockState(new BlockPos(x, y, z)));
   }

   public TileEntity getTileEntity(int x, int y, int z) {
      return super.getTileEntity(new BlockPos(x, y, z));
   }

   public void removeTileEntity(int x, int y, int z) {
      super.removeTileEntity(new BlockPos(x, y, z));
   }

   @Override
   protected IChunkProvider createChunkProvider() {
      return this.createChunkProvider();
   }

   @Override
   protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) {
      return this.isChunkLoaded(x, z, allowEmpty);
   }
}

 

What do you think?

Edited by st4s1k
Link to comment
Share on other sites

1 minute ago, diesieben07 said:

I am not sure what you are trying to accomplish there. Custom world classes are a pretty bad idea, unless we are talking about fake worlds, which are difficult to make.

It's just a wrapping class which maps old methods to the new ones.

Link to comment
Share on other sites

3 minutes ago, diesieben07 said:

Yeah, but it's not going to do anything, since nobody will use this class.

Actually, I have changed all "World" (case sensitive) occurrences to xWorld (custom), in the *.java file I'm editing now. Using find and replace. Also I took care of imports, because it got changed too, so I changed it back.

 

for example:

public static boolean setBlockBPdata( final xWorld world, final int par1, final int par2, final int par3, final int par4 )
{
   if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000)
   {
      if (par2 < 0)
      {
         return false;
      }
      else if (par2 >= 256)
      {
         return false;
      }
      else
      {
         final Chunk chunk = world.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
         final int j1 = par1 & 15;
         final int k1 = par3 & 15;
         return (Boolean) BlockPhysics.asmHelper.invoke(chunk, "setBlockBPdata", j1, par2, k1, par4);
      }
   }
   else
   {
      return false;
   }
}
Edited by st4s1k
Link to comment
Share on other sites

Just now, diesieben07 said:

It's not necessarily "bad practice", it just doesn't work.

Well this method and class are located in the same class:

public class BlockPhysics

 

Also xWorld extends World and World objects can be assigned to xWorld objects without conflict, if understand you correctly.

Link to comment
Share on other sites

Just now, diesieben07 said:

Items.REDSTONE.

Thanks
 

 

1 minute ago, diesieben07 said:

If xWorld extends World that means any xWorld can be assigned to a World. The opposite (what you said) is not true.

Example:

class Shape

class Rectangle extends Shape

 

Every Rectangle is a Shape, but not every Shape is a Rectangle.

 

You're right. I don't have any conflict because all methods are used inside the same class.

Link to comment
Share on other sites

I noticed that World.playSound method is empty:

public void playSound(double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch, boolean distanceDelay)
{
}

 

Do you know why is that?

I'm trying to replace this method:

xworld.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F, block.stepSound.getBreakSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
Link to comment
Share on other sites

I have some problems with converting TileEntityPiston constructor, can somebody help me?:

 

for (int i = par5; i > 1; i--)
{
   final int xxf =  xx - Facing.offsetsXForSide[par6];
   final int yyf =  yy - Facing.offsetsYForSide[par6];
   final int zzf =  zz - Facing.offsetsZForSide[par6];

   final ResourceLocation var12 = Block.REGISTRY.getNameForObject(par1World.getBlock(xxf, yyf, zzf));
   int var13 = par1World.getBlockMetadata(xxf, yyf, zzf);
   final int bpmeta = BlockPhysics.getBlockBPdata(par1World, xxf, yyf, zzf);

   final Block bb = Block.REGISTRY.getObject(var12);

   if ( bb == Blocks.PISTON || bb == Blocks.STICKY_PISTON ) {
      var13 = var13 & 7;
   }


   final TileEntityPiston tePiston = new TileEntityPiston(bb, var13, par6, true, false);

   final TileEntityPiston tePiston = new TileEntityPiston(
         par1World.getBlockState(new BlockPos(xxf, yyf, zzf)),
         pistonFacingIn,  /* I don't know where to get this value */
         true,
         false
   );

   // ...

}
Edited by st4s1k
Link to comment
Share on other sites

Trying to replace Facing with EnumFacing. Unfortunately it is not a Forge class, so there is no mentioning about it anywhere really.

Do you know which function should be used instead?

image.png.b2496e185054462dff27551bbf3f9242.png

 

Only on some strange site:

https://www.programcreek.com/java-api-examples/index.php@source_dir=flex-blazeds-master/modules/core/src/flex/messaging/cluster/?class=net.minecraft.util.Facing&amp;method=offsetsZForSide

Edited by st4s1k
Link to comment
Share on other sites

31 minutes ago, loordgek said:

you get the facing form the blockstate

 

but something else, BlockPhysics is using a lot of ASM hacks.

do you know how ASM works if not please stop.

No I don't know how ASM works. What should I stop, and why "please" ? I can stop asking for help if this is what you want.

Link to comment
Share on other sites

Ok, I found the answer, ty:

public static boolean canmove(final xWorld world, final int i, final int j, final int k, final BlockPistonBase par1block)
{
   EnumFacing orient = BlockPistonBase.getFacing(world.getBlockMetadata(i, j, k));

   final int i2 = i + Facing.offsetsXForSide[orient];
   final int j2 = j + Facing.offsetsYForSide[orient];
   final int k2 = k + orient.getFrontOffsetZ();
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • This honestly might just work for you @SubscribeEvent public static void onScreenRender(ScreenEvent.Render.Post event) { final var player = Minecraft.getInstance().player; if(!hasMyEffect(player)) return; // TODO: You provide hasMyEffect float f = Mth.lerp(p_109094_, this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity); float f1 = ((Double)this.minecraft.options.screenEffectScale().get()).floatValue(); if(f <= 0F || f1 >= 1F) return; float p_282656_ = ?; final var p_282460_ = event.getGuiGraphics(); int i = p_282460_.guiWidth(); int j = p_282460_.guiHeight(); p_282460_.pose().pushPose(); float f = Mth.lerp(p_282656_, 2.0F, 1.0F); p_282460_.pose().translate((float)i / 2.0F, (float)j / 2.0F, 0.0F); p_282460_.pose().scale(f, f, f); p_282460_.pose().translate((float)(-i) / 2.0F, (float)(-j) / 2.0F, 0.0F); float f1 = 0.2F * p_282656_; float f2 = 0.4F * p_282656_; float f3 = 0.2F * p_282656_; RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(SourceFactor.ONE, DestFactor.ONE, SourceFactor.ONE, DestFactor.ONE); p_282460_.setColor(f1, f2, f3, 1.0F); p_282460_.blit(NAUSEA_LOCATION, 0, 0, -90, 0.0F, 0.0F, i, j, i, j); p_282460_.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); p_282460_.pose().popPose(); }   Note: Most of this is directly copied from GameRenderer as you pointed out you found. The only thing you'll have to likely do is update the `oSpinningEffectIntensity` + `spinningEffectIntensity` variables on the player when your effect is applied. Which values should be there? Not 100% sure, might be a game of guess and check, but `handleNetherPortalClient` in LocalPlayer has some hard coded you might be able to start with.
    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
    • Selamat datang di OLXTOTO, situs slot gacor terpanas yang sedang booming di industri perjudian online. Jika Anda mencari pengalaman bermain yang luar biasa, maka OLXTOTO adalah tempat yang tepat untuk Anda. Dapatkan sensasi tidak biasa dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering. Di sini, Anda akan merasakan keseruan yang luar biasa dalam bermain judi slot. DAFTAR OLXTOTO DISINI LOGIN OLXTOTO DISINI AKUN PRO OLXTOTO DISINI   Jackpot Slot Maxwin Sering Untuk Peluang Besar Di OLXTOTO, kami tidak hanya memberikan hadiah slot biasa, tapi juga memberikan kesempatan kepada pemain untuk memenangkan jackpot slot maxwin yang sering. Dengan demikian, Anda dapat meraih keberuntungan besar dan memenangkan ribuan rupiah sebagai hadiah jackpot slot maxwin kami. Jackpot slot maxwin merupakan peluang besar bagi para pemain judi slot untuk meraih keuntungan yang lebih besar. Dalam permainan kami, Anda tidak harus terpaku pada kemenangan biasa saja. Kami hadir dengan jackpot slot maxwin yang sering, sehingga Anda memiliki peluang yang lebih besar untuk meraih kemenangan besar dengan hadiah yang menggiurkan. Dalam permainan judi slot, pengalaman bermain bukan hanya tentang keseruan dan hiburan semata. Kami memahami bahwa para pemain juga menginginkan kesempatan untuk meraih keberuntungan besar. Oleh karena itu, OLXTOTO hadir dengan jackpot slot maxwin yang sering untuk memberikan peluang besar kepada para pemain kami. Peluang Besar Menang Jackpot Slot Maxwin Peluang menang jackpot slot maxwin di OLXTOTO sangatlah besar. Anda tidak perlu khawatir tentang batasan atau pembatasan dalam meraih jackpot tersebut. Kami ingin memberikan kesempatan kepada semua pemain kami untuk merasakan sensasi menang dalam jumlah yang luar biasa. Jackpot slot maxwin kami dibuka untuk semua pemain judi slot di OLXTOTO. Anda memiliki peluang yang sama dengan pemain lainnya untuk memenangkan hadiah jackpot yang besar. Kami percaya bahwa semua orang memiliki kesempatan untuk meraih keberuntungan besar, dan itulah mengapa kami menyediakan jackpot slot maxwin yang sering untuk memenuhi harapan dan keinginan Anda.   Kesimpulan OLXTOTO adalah situs slot gacor terbaik yang memberikan pengalaman bermain judi slot online yang tak terlupakan. Dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering, OLXTOTO menjadi pilihan terbaik bagi para pemain yang mencari kesenangan dan kemenangan besar dalam perjudian online. Di samping itu, OLXTOTO juga menawarkan layanan pelanggan yang ramah dan responsif, siap membantu setiap pemain dalam mengatasi masalah teknis atau pertanyaan seputar perjudian online. Kami menjaga integritas game dan memberikan lingkungan bermain yang adil serta menjalankan kebijakan perlindungan pelanggan yang cermat. Bergabunglah dengan OLXTOTO sekarang dan nikmati pengalaman bermain slot online yang luar biasa. Jadilah bagian dari komunitas perjudian yang mengagumkan ini dan raih kesempatan untuk meraih kemenangan besar. Dapatkan akses mudah dan praktis ke situs OLXTOTO dan rasakan sensasi bermain judi slot yang tak terlupakan.  
    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa Di dunia perjudian online yang begitu kompetitif, mencari platform yang dapat memberikan kemenangan maksimal (Maxwin) dan hasil terbaik (Gacor) adalah prioritas bagi para penjudi yang cerdas. Dalam upaya ini, OLXTOTO telah muncul sebagai pemain kunci yang mengubah lanskap perjudian online dengan menawarkan pengalaman tanpa tandingan.     Sejak diluncurkan, OLXTOTO telah menjadi sorotan industri perjudian online. Dikenal sebagai "Platform Maxwin dan Gacor Terbesar Sepanjang Masa", OLXTOTO telah menarik perhatian pemain dari seluruh dunia dengan reputasinya yang solid dan kinerja yang luar biasa. Salah satu fitur utama yang membedakan OLXTOTO dari pesaingnya adalah komitmen mereka untuk memberikan pengalaman berjudi yang unik dan memuaskan. Dengan koleksi game yang luas dan beragam, termasuk togel, slot online, live casino, dan banyak lagi, OLXTOTO menawarkan sesuatu untuk semua orang. Dibangun dengan teknologi terkini dan didukung oleh tim ahli yang berdedikasi, platform ini memastikan bahwa setiap pengalaman berjudi di OLXTOTO tidak hanya menghibur, tetapi juga menguntungkan. Namun, keunggulan OLXTOTO tidak hanya terletak pada permainan yang mereka tawarkan. Mereka juga terkenal karena keamanan dan keadilan yang mereka berikan kepada para pemain mereka. Dengan sistem keamanan tingkat tinggi dan audit rutin yang dilakukan oleh otoritas regulasi independen, para pemain dapat yakin bahwa setiap putaran permainan di OLXTOTO adalah adil dan transparan. Tidak hanya itu, OLXTOTO juga dikenal karena layanan pelanggan yang luar biasa. Dengan tim dukungan yang ramah dan responsif, para pemain dapat yakin bahwa setiap pertanyaan atau masalah mereka akan ditangani dengan cepat dan efisien. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi platform pilihan bagi para penjudi online yang mencari kemenangan maksimal dan hasil terbaik. Jadi, jika Anda ingin bergabung dengan jutaan pemain yang telah merasakan keajaiban OLXTOTO, jangan ragu untuk mendaftar dan mulai bermain hari ini!  
    • OLXTOTO adalah bandar slot yang terkenal dan terpercaya di Indonesia. Mereka menawarkan berbagai jenis permainan slot yang menarik dan menghibur. Dengan tampilan yang menarik dan grafis yang berkualitas tinggi, pemain akan merasa seperti berada di kasino sungguhan. OLXTOTO juga menyediakan layanan pelanggan yang ramah dan responsif, siap membantu pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Daftar =  https://surkale.me/Olxtotodotcom1
  • Topics

×
×
  • Create New...

Important Information

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