![]() Before calling "ItemStack.tryPlaceItemInWorld", a recording flag is turned on for setBlock to capture a blocksnapshot for each block that attempts to be placed. If 1 block is captured, a "BlockEvent.PlaceEvent" is fired to notify mods. If 2 or more blocks are captured, a "BlockEvent.PlaceEvent" is fired first with the first block captured followed by a "BlockEvent.MultiPlaceEvent" with all captured blocks. This extra event is required for items that have the ability to place 2 or more blocks such as a BlockBed. If either event is cancelled, the recorded block snapshot(s), item stacksize, and item meta will revert back to the captured snapshot(s). If the events are not cancelled, a notification will be sent to clients and block physics will be updated. What this means for mods is Forge will be able to capture all player block placement automatically and fire a PlaceEvent and/or MultiPlaceEvent. If for whatever reason your mod does not use the standard placement methods then you will need to fire the appropriate placement events in order to notify mods/servers. 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. |
||
---|---|---|
fml@5365f5ea3e | ||
patches/minecraft/net/minecraft | ||
src | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
MinecraftForge-Credits.txt | ||
MinecraftForge-License.txt | ||
Paulscode IBXM Library License.txt | ||
Paulscode SoundSystem CodecIBXM License.txt | ||
README.txt | ||
build.gradle | ||
eclipse-workspace-dev.zip | ||
gradlew | ||
gradlew.bat | ||
settings.gradle |
README.txt
*** HOW TO INSTALL *** For Mod Users: Download the latest installer from http://files.minecraftforge.net and follow instructions given by the installer. For Mod Devs: Download the latest Forge source distribution from http://files.minecraftforge.net and unzip it to a folder. Open a command prompt, navigate to the directory where you unzipped the Forge sources, and run: If you have Gradle: gradle setupDevWorkspace If you DO NOT have Gradle installed: Windows: ./gradlew.bat setupDevWorkspace MacOS/Linux: ./gradlew setupDevWorkspace If you wish to use the Eclipse IDE, run gradle eclipse instead of gradle setupDevWorkspace, or install the Gradle plugin for Eclipse and import the Forge source folder as a Gradle project. To get the decompiled classes: If you have Gradle: gradle setupDecompWorkspace If you DO NOT have Gradle installed: Windows: ./gradlew.bat setupDecompWorkspace MacOS/Linux: ./gradlew setupDecompWorkspace For Contributors: (Note: This assumes you have Gradle installed. If you don't, use ./gradlew(.bat) instead of gradle. Clone this repository to a folder. Open a command prompt and navigate to the folder where you cloned this repo. Run gradle setupForge to setup your development environment. To use Eclipse, point your Eclipse workspace at the eclipse folder inside the repo. Requirements (for both mod devs and contributors): You must have a JDK installed and accessible. If you do not wish to use the gradle wrapper, you can install Gradle from http://www.gradle.org/ .