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

    • rftoolsbuilder:shielding_cutout (from lostcities-1.19-6.0.24.jar),rftoolsstorage:crafting_manager (from lostcities-1.19-6.0.24.jar),deepresonance:dense_glass (from lostcities-1.19-6.0.24.jar),restrictions:oneway (from lostcities-1.19-6.0.24.jar),restrictions:oneway_wall (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_complete (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_complete (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_broken (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_broken (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_broken_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_broken_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_vines (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_vines (from lostcities-1.19-6.0.24.jar)[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/blackboard_clear as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/flag_dye as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/flag_clear as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Loaded 36 recipes[13:50:17] [main/INFO] [Spartan Weaponry/]: Adding Diamond Weapons to the End City Treasure Loot Table![13:50:17] [main/INFO] [Spartan Weaponry/]: Adding Longbow and Heavy Crossbow related loot to the Village Fletcher Loot Table![13:50:18] [main/INFO] [Spartan Weaponry/]: Adding Iron Weapons to the Village Weaponsmith Loot Table![13:50:18] [main/ERROR] [minecraft/ServerFunctionLibrary]: Failed to load function watching:checkjava.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Unknown or incomplete command, see below for error at position 0: <--[HERE]at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?] {re:mixin}at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?] {re:mixin}at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?] {}at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] {}at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {re:computing_frames}at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {re:computing_frames}at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Unknown or incomplete command, see below for error at position 0: <--[HERE]at net.minecraft.commands.CommandFunction.m_77984_(CommandFunction.java:63) ~[server-1.19.2-20220805.130853-srg.jar%23299!/:?] {re:classloading}at net.minecraft.server.ServerFunctionLibrary.m_214320_(ServerFunctionLibrary.java:85) ~[server-1.19.2-20220805.130853-srg.jar%23299!/:?] {re:classloading}at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] {}... 6 more[13:50:18] [main/INFO] [quark/]: [Automatic Recipe Unlock] Removed 3712 recipe advancements[13:50:18] [main/INFO] [minecraft/AdvancementList]: Loaded 684 advancements[13:50:18] [main/INFO] [at.dy.se.ItemLightLevels/]: Clearing item tag to light level mapping cache[13:50:18] [main/INFO] [sl.ma.fl.tr.FluidContainerTransferManager/]: Loaded 0 dynamic modifiers in 0.246528 ms[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/wax_on with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/kill_a_mob with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/bred_all_animals with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/kill_all_mobs with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/make_a_sign_glow with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/balanced_diet with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/plant_seed with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:nether/all_effects with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/wax_off with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/adventuring_time with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:nether/all_potions with 1 patches[13:50:18] [main/INFO] [supplementaries/]: Loaded 8 flute songs[13:50:20] [main/INFO] [Spartan Weaponry/]: Finished initialising Weapon Traits & Attributes! Took 11.202781ms[13:50:20] [main/INFO] [supplementaries/]: Finished additional setup in 103 ms[13:50:20] [main/WARN] [minecraft/DedicatedServerProperties]: Failed to parse level-type biomesoplenty, defaulting to minecraft:normal[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Starting minecraft server version 1.19.2[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Loading properties[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Default game type: SURVIVAL[13:50:20] [Server thread/INFO] [minecraft/MinecraftServer]: Generating keypair[13:50:21] [Server thread/INFO] [minecraft/DedicatedServer]: Starting Minecraft server on :::25983[13:50:21] [Server thread/INFO] [minecraft/ServerConnectionListener]: Using epoll channel type[13:50:21] [Thread-0/INFO] [de.ca.ca.CaveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.ca.CaveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.st.SteveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.st.SteveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.Skinstalker/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.SkinwalkerOverhaul/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.SkinwalkerOverhaul/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.go.Goatman/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.go.Goatman/]: Server configuration has been reloaded[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 glowstone[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser finished, item count: 2[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser finished, item count: 1[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 glowstone[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser finished, item count: 2[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser finished, item count: 1[13:50:21] [Server thread/INFO] [Framework/]: Loading server configs...[13:50:22] [Server thread/INFO] [terrablender/]: Initialized TerraBlender biomes for level stem minecraft:overworld[13:50:22] [Server thread/INFO] [terrablender/]: Initialized TerraBlender biomes for level stem minecraft:the_nether[13:50:22] [Server thread/INFO] [minecraft/DedicatedServer]: Preparing level "world"[13:50:35] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for dimension minecraft:overworld[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:41] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:41] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:42] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 17%[13:50:42] [Server thread/INFO] [minecraft/LoggerChunkProgressListener]: Time elapsed: 7618 ms[13:50:42] [Server thread/INFO] [minecraft/DedicatedServer]: Done (21.501s)! For help, type "help"[13:50:42] [Server thread/INFO] [minecraft/DedicatedServer]: Starting GS4 status listener[13:50:42] [Server thread/INFO] [minecraft/GenericThread]: Thread Query Listener started[13:50:42] [Query Listener #1/INFO] [minecraft/QueryThreadGs4]: Query running on :::25983[13:50:42] [Server thread/INFO] [ne.mi.se.pe.PermissionAPI/]: Successfully initialized permission handler forge:default_handler
    • Visit WEB:  https://www.strongspellcaster.us.com New York City, NY's love spells +27732318372 *To Get Back Ex Lover* Black magic cleansing.  
    • +27732318372 MOST GIFTED VOODOO MAGIC LOST LOVE SPELLS TO BRING BACK AN EX LOVER << USA CANADA USA .. >> visit website (https://www.strongspellcaster.us.com) s.
    • The conflict arises from discrepancies between different versions of GSON. My suggestion would be to remove your dependency on GSON 2.8.6 and opt for a different approach. Instead of using the static method JsonParser.parseString, you can create a JsonParser object and then use the parse method.   JsonParser jsonParser = new JsonParser(); jsonParser.parse(jsonString)  
  • Topics

×
×
  • Create New...

Important Information

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