Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

In Forge Build

1.7.10-10.13.1.1219:


Was introdused BlockSnapshot

Quote

This commit also includes a new utility class called BlockSnapshot which is serializable. This new class is used in conjunction with both PlaceEvent and MultiPlaceEvent in order to record a snapshot of block space before it is altered. This allows us to restore the block(s) if an event is cancelled. The class also provides the ability to restore a snapshot to any location using the restoreToLocation method. This should be helpful to many mods that are looking to be able to capture block data then restore it to back to any location required.

(BlockSnapshot contained blockID, Meta, BlockPosition(int: x, y, z), etc.
But later at Forge Build
Build 1.8-11.14.0.1296:

Quote

Some notes: Almost all int x, int y, int z parameters have been changed to BlockPos class


all of the x,y,z values was replaced by BlockPos
(Now BlockSnapshot contains BlockID(string),Meta, BlockPosition(BlockPos), etc.
This change (int: x, y, z, -> BlockPos) renders Serialization not posible, due to BlockPos not a serializable class.

BlockSnapshot still implements io.Serializable interface, but it cant be serialized
 

Quote

[Server thread/INFO]: [STDERR]: java.io.NotSerializableException: net.minecraft.util.math.BlockPos

 

Idk this is a bug or feature, but still cost me a hour to realise a problem source.

 

code example:

BlockSnapshot BA1 = new BlockSnapshot(plr.world,cap1.getBlockPos(0),plr.world.getBlockState(cap1.getBlockPos(0)));
                      try {
                          File directory = new File(System.getProperty("user.dir")+"/"+arg2+"/"+arg3+"/");
                            if (! directory.exists()){
                                directory.mkdirs();
                            }
                          FileOutputStream fileOut =
                          new FileOutputStream(System.getProperty("user.dir")+"/"+arg2+"/"+arg3+"/"+arg4+".zba");
                          ObjectOutputStream out = new ObjectOutputStream(fileOut);
                          out.writeObject(BA1);
                          out.close();
                          fileOut.close();
                          System.out.printf("Serialized data is saved in :"+System.getProperty("user.dir")+"/"+arg2+"/"+arg3+"/"+arg4+".zba");
                       }catch(IOException i) {
                          i.printStackTrace();
                       }


https://takahikokawasaki.github.io/minecraft-resources/javadoc/forge/1.8-11.14.1.1320/serialized-form.html#net.minecraftforge.common.util.BlockSnapshot

http://takahikokawasaki.github.io/minecraft-resources/javadoc/forge/1.7.10-10.13.2.1291//index.html?net/minecraftforge/common/util/BlockSnapshot.html

http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282-changelog.txt

Edited by Zergod

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.