Compare commits

..
130 Commits
Author SHA1 Message Date
LexManos 3effde4f1f Enable promotion from actions 2025-12-03 18:39:02 -08:00
LexManos 4d0705370f Fix MDK run configs, and add fix for IntelliJ issues. 2025-12-03 11:48:54 -08:00
Mysticpasta1 25c661a7f0 Fix infinite recursion in Biome Dict error message (#10725) 2025-12-03 09:55:25 -08:00
LexManos dbd6c296f2 Migrate to Github Actions 2025-11-30 14:49:30 -08:00
Daniel Naylor d3f01843f7 Don't download log4j-slf4j18-impl (#8293) 2021-12-12 20:36:20 -08:00
SizableShrimp 8cc1e13a28 Update Installer to 2.1.+ and fix logging on server (#8286)
Update references of files.mcf.net/maven to maven.mcf.net

Signed-off-by: SizableShrimp <[email protected]>
2021-12-12 01:13:00 +10:30
Marc Hermans adb7f0d836 [#8281] Fix the output on Linux in the terminal. (#8282) 2021-12-11 05:26:29 +10:30
Marc Hermans d9986ac035 Fix an issue with the version number generation as well as the logging pattern output. (#8279) 2021-12-11 01:30:55 +10:30
Marc Hermans 2169e9d0d7 [CVE-2021-44228]: Update Log4J to fix the security issue inside it. (#8275) 2021-12-11 00:02:17 +10:30
Ned Loynd a8b9abcb17 Only apply the MC-68754 fix on Windows, closes #7546 (#7549)
MC-68754 only affects Minecraft on Windows, as per the comments on Mojang's bug tracker, and the LWJGL bug report (https://github.com/LWJGL/lwjgl/issues/142). This change simply checks if the OS running Minecraft is Windows before applying the fix. This was tested on Windows 10, MacOS Mojave, and Lubuntu (5.8.0-31), and all platforms allowed the window to be resized as expected after exiting fullscreen. As the MC-68754 fix was the cause of #7546, this issue is fixed by applying this patch.
2020-12-18 17:47:09 -08:00
DaemonUmbra 87a63bc5e0 Fixed the universal jar not having a main class or classpath, for server installations. 2020-04-12 10:53:11 -07:00
DaemonUmbra 0683971741 Updated License headers
(cherry picked from commit 7b852e5cab)
2020-04-12 10:01:07 -07:00
LexManos 49bdd556b5 Fix installer json data entry format. 2020-04-04 17:56:09 -07:00
LexManos 24c659dfa1 Skip userdev remap as we don't have any yet. 2020-04-04 14:38:42 -07:00
LexManos 54f9ca540e Fix J13 ambiguous reference and JenkinsFile skipping a step. 2020-04-04 14:24:44 -07:00
LexManos db6ab2a19e Migrate to FG3 2020-03-14 18:18:45 -07:00
ichttt 863ab2ca18 Fix CME when removing ticket managers (#5861) 2019-09-03 14:22:38 -07:00
Ben Staddon 45da4f6910 Add checks for tile entities in now-unloaded chunks (#5724) 2019-08-28 19:25:57 -07:00
Bartosz Skrzypczak c2630d2a79 Fix client sometimes generating biomes, causing incorrect biome generation on integrated server (#5720) 2019-08-28 19:25:11 -07:00
Ben Staddon 05f4f5ec77 Fix invalid placeholder entity attributes (MC-150405) (#5718) 2019-08-28 19:22:56 -07:00
Ben Staddon a5d0a86760 Allow conditional loading of advancements (#5255) 2019-08-28 19:02:29 -07:00
Derik 7b4a01703b Fix lightning not triggering EntityJoinWorldEvent (#5290) 2019-08-28 18:58:43 -07:00
Ben Staddon 3b99c80636 Improve performance of persistent chunk checks (#5706) 2019-08-28 18:21:38 -07:00
LexManos 20efd7150a Fix copy paste derp 2019-08-28 18:19:45 -07:00
LexManos c56377e4ee Remove test publish group. 2019-08-28 17:44:19 -07:00
LexManos 3e98e16f39 Fix windows installer directory. 2019-08-28 17:24:52 -07:00
LexManos d41cb552a1 Use official launch4j plugin to potentially fix build. 2019-08-28 17:08:36 -07:00
LexManos ae2cb06d2c Move to Jenkinsfile and new Jenkins server. 2019-08-28 16:06:54 -07:00
Gabriel Harris-Rouquette 9de9193062 Fix error prone state lookup during rail neighbor updates. (#6028) 2019-08-15 10:42:21 -07:00
Unnoen f8d32a8525 Don't cache OBJ and B3D models. Throw model loading errors immediately. (#5758) 2019-08-02 14:16:20 -07:00
Ben Staddon dac053415b Improve performance of smooth vertex lighting (#5763) 2019-08-02 14:14:41 -07:00
Joseph C. Sible 7a52116665 Fix SidedInvWrapper hashCode when side is null (#5787) 2019-08-02 14:12:52 -07:00
Ben Staddon 9ba67cedf1 Fix concurrent modification when loading chunk tickets (#5876) 2019-08-02 13:43:12 -07:00
Cloudhunter 5aac0beba9 Fix link applying to whole component in chat if component starts with link (#5910) 2019-08-02 13:41:18 -07:00
Ben Staddon 7849aebab0 Protect against concurrent modification in World#setTileEntity (#5752) 2019-08-02 13:39:05 -07:00
Ben Staddon ea26df0174 Fix more potentially unclosed resources (#5760) 2019-08-02 13:33:43 -07:00
Ben Staddon 3a62514e60 Fix various unclosed I/O resources (#5766) 2019-08-02 13:32:08 -07:00
Ben Staddon 9a636e3c76 Fix vanilla handling of options file (MC-117449, MC-151173) (#5725) 2019-05-13 10:01:08 -07:00
clienthax fa35f30e86 Update EnumHelper to be compatible with Eclipse's OpenJ9 JVM. (#5712) 2019-05-08 17:46:04 -07:00
tterrag 633fd9bd2e Revert "Invalidate tile entities that are queued for removal (#5512)"
This reverts commit 75788f63ee.

This solution is invalid as TEs are free to modify the world tileEntities
list, usually indirectly via chunkloading, from inside invalidate().

This happens in vanilla, in TileEntityChest#invalidate, where it calls
checkForAdjacentChests(), which has the potential to load neighboring
chunks and cause a CME.

A more sophisticated solution is needed.
2019-04-13 09:54:03 -04:00
Ben Staddon 3c426a2e66 Fix some vertex format changes not being handled correctly (#5368) 2019-04-11 16:05:19 -04:00
Ben Staddon 25375f63cc Transform vertex normals as well as positions when generating quads (#5242) 2019-04-11 12:59:16 -04:00
Robert WC Seifert 45cadab7c5 Fix for SidedInvWrapper isItemValid using wrong slot (#5642) 2019-04-11 11:29:14 -04:00
Ben Staddon 75788f63ee Invalidate tile entities that are queued for removal (#5512) 2019-04-11 11:03:36 -04:00
lclc98 3e7b8809b6 Added Wool to OreDictionary (#5414) 2019-04-11 11:01:40 -04:00
CreativeMD 6162f438f1 Fixed boat not taking care of block-liquid hooks (#5086) 2019-04-11 10:18:26 -04:00
Ben Staddon 1752e57ea0 Add Forge dimension-changing hooks to spectator handling code (#5212) 2019-04-11 10:05:19 -04:00
ichttt e91ef7f56b Minor performace improvement when building chunks and rendering blocks (#5286) 2019-04-11 10:03:01 -04:00
Ben Staddon 24f7be2f37 Catch json parsing errors from constants/factories files (#5258) 2019-04-11 08:52:23 -04:00
Ben Staddon 208ed997d4 Allow custom DataSerializers to be registered safely (#5245) 2019-04-11 08:33:12 -04:00
cpw 1f12642a05 Try and make 1.13 mods more obviously wrong in 1.12..
Signed-off-by: cpw <[email protected]>
2019-04-06 13:54:54 -04:00
tterrag e7beed4875 Fix #5651 Re-add canPlaceBlockOnSide check in World#mayPlace 2019-03-28 00:33:59 -04:00
Pokechu22 69a44e6414 Fail fast when null is used with setTag instead of crashing in writeEntry (#5257) 2019-03-22 12:53:07 -04:00
tterrag 3870951a37 Fix block placement not checking for player collision 2019-03-20 23:18:26 -04:00
Wyn Price af4fcd73a4 Added more Constants (#5323) 2019-03-15 15:38:52 -04:00
Thanh-Phuong 04a6b6c2d0 [1.12.2] Add a few events pertaining to villages (#5302) 2019-03-12 01:01:35 -04:00
Tyler Hancock 1b15c127a6 [1.12] Fix special spawn event not firing in many cases. (#5389) 2019-03-12 00:44:08 -04:00
Ben Staddon 8670abca57 Only prompt for missing registries on local worlds (#5348) 2019-03-12 00:34:29 -04:00
Christopher Krier f3d364397d Add EntityPlaceEvent (#5057) 2019-03-12 00:22:47 -04:00
Ben Staddon cc95c40b5b Generalise EnumRarity to an interface (#5182) 2019-03-12 00:02:57 -04:00
Ben Staddon e6fbf39591 Apply access-level changes to inner class attributes (#5468) 2019-02-14 22:46:35 -08:00
Ben Staddon 8cbac6af97 Fix small logic error in ItemTextureQuadConverter (#5463) 2019-02-13 17:03:37 -05:00
Ben Staddon 87cbf735a2 Better support for custom bows (#5209) 2019-02-13 15:58:43 -05:00
Ben Staddon bcbf184915 Improve tracking of used dimension IDs (#5249)
Closes #5378 Large dimension IDs bloat level.data
2019-02-13 15:28:58 -05:00
Phylogeny 965d872856 Fixed incorrect string representation of string list config property default values in their comments. 2019-02-13 15:26:53 -05:00
CovertJaguar 41a098e2f7 Remove FluidStack amount from hashcode calculation (#5272) 2019-02-06 15:35:18 -08:00
Ben Staddon 41d07e7aae Fix up torch placement logic to handle more vanilla special-casing (#5426) 2019-02-04 11:48:08 -08:00
LexManos d1adf00158 Written size does not include int bytes. 2019-02-01 00:46:29 -08:00
LexManos ed67b6fd31 Extend Region files to support >1MB per chunk.
If the 'sector count' is 255, ask the compressed data header for the proper length.
2019-02-01 00:34:45 -08:00
tterrag1098 d5ff207fab Add default impl to IConfigElement#getValidValuesDisplay 2019-01-19 16:40:49 -05:00
tterrag da7c299f7e Simplify custom item rendering by removing GL emissivity hacks 2019-01-10 06:09:06 -05:00
tterrag 204ebdc6dd Support diffuse lighting flag in item rendering 2019-01-04 13:48:36 -05:00
Ben Staddon be565d2ddc Add a hook to allow continuously using items through stack changes (#4834)
* Add a hook to allow continuously using items through stack changes

* Update licences
2019-01-03 23:22:24 -05:00
oOMitchOo 21f7c31f62 Added an additional constructor to every implementation of IFluidBlock. It is now possible to create a fluid block with a Fluid, Material and MapColor, so that the Material's MapColor isn't used for the blocks MapColor. (#5293) 2019-01-03 23:10:56 -05:00
Ben Staddon 4e11c95d0e Add redirects to PotionEffect to respect registry replacement (#5213) 2019-01-03 23:02:11 -05:00
AlexiyOrlov d1478ca529 Add an annotation for @Config elements which will automatically create a slider control (#5026) 2019-01-03 22:07:24 -05:00
Ben Staddon 359d4fe2d5 Fix small logic error in emissive item rendering code (#5320) 2019-01-03 21:11:34 -05:00
Phylogeny d3f27cf6fb Allow config GUI cycling button elements generated from enums to display toString return values, rather than actual values. (#5125) 2019-01-03 21:08:05 -05:00
Ben Staddon 3dd8c8ae6f Fix incorrect indexing in mipmap generation code (#5201) 2019-01-03 21:00:39 -05:00
Ben Staddon 54882f2564 Ensure slave maps are cleaned up when handling registry overrides (#5250) 2019-01-03 20:36:32 -05:00
Daniel Scalzi c5402d50fa Fix issue with --modListFile. (#5316) 2019-01-02 17:28:04 -08:00
LexManos a5f29570a3 Fix potential issues with the Minecraft FakePlayer lingering around after world unloads. 2018-12-07 22:03:32 -08:00
tterrag dd27209565 Fix potion remove event not always firing, add expiry event 2018-12-02 13:20:02 -05:00
tterrag f1d1e8853b Clean up CraftingHelper constants loading API 2018-12-02 03:05:53 -05:00
tterrag 5ef199f6d7 Fix crash from CraftingHelper due to FileSystem being closed early 2018-12-01 23:33:22 -05:00
mcenderdragon 2a5268c699 added PotionHooks, closes #3867, #4375 (#4614)
* solved merge confilct

* improved var names & removed tabs

* Added spaces around !=

* fixed typo
2018-12-01 20:13:13 -05:00
ichttt 32c24be6b4 Add a hook for farmland watering (#4891)
* Add a FarmlandWaterCheckEvent to allow mods to override when Farmland is watered or not

* revert 1.12.2 json

* Move the farmland patch to a ticket based instead of a event based system

* Minor changes

* Faster isValid checks, faster validation/invalidation if the state did not change, expand test mod to include a test for the validation system

* remove isValid boolean flag, we can express it with the tick counter

* Fix test mod resource warnings

* Remove tick timeout, add a javadoc note to invalidate on chunk unload, cleaned up test mod

* Allow mods to provide custom handling to determine if a pos is valid or not

* Make SimpleTicket more simple, make register public so custom tickets can be registered

* Fixes for review

* Add missing license headers

* Use a weak hash set

* Split up the map into smaller chunk based maps

* Add missing license headers

* Make MultiTicketManager more universal for custom implementations, cleanup imports
2018-12-01 20:08:04 -05:00
temp1011 5f56b7cd09 Add methods to allow loading json constants outside of _constants (#4975)
* add interface methods for loading json constants from an arbitary file

* use try-with-resources

* don't make modders create jsoncontext, clean up resource use

* very minor cleanup
2018-12-01 19:46:19 -05:00
ichttt 7f337cf230 Compute ASMDataTable submaps parallel, speeds up contructing mods (#5246)
* Compute submaps parallel, speeds up contructing mods by a lot

* Use stream API better
2018-12-01 19:38:46 -05:00
ichttt 7731e1cd75 Add logging for data manager key registration errors (#5129) 2018-12-01 16:28:02 -08:00
Ben Staddon f8879b1316 Improve support for custom block path types (#5203) 2018-12-01 16:27:20 -08:00
Luke Gilfoyle 3dfe47944d Fix missing comments in configs created with annotations (#5189) 2018-12-01 16:14:48 -08:00
Ben Staddon c11a712e2f Allow items to control the rate of repair from mending (#5102) 2018-12-01 16:08:15 -08:00
Ben Staddon 5771c8ffea Improve exception handling from server starting events (#5226) 2018-11-23 18:08:24 -08:00
Ben Staddon 9587f08ece Improve context provided by potion icon rendering hooks (#5111) 2018-11-23 16:36:29 -08:00
MrRiegel 73b6d10e5a Fix an ObjectHolderRef internal error message (#5214) 2018-11-23 16:03:44 -08:00
tterrag 90c244acb4 Implement rendering for item models with emissive quads (#5047) 2018-11-23 15:57:00 -08:00
Ben Staddon 3cf97f43fe Fix minor issue in getFilledPercentage for Fluid rendering (#5206) 2018-11-23 15:44:35 -08:00
Ben Staddon 0b47ccc015 Clean up logged mod states (#5227) 2018-11-23 15:42:11 -08:00
Paul Fulham 8d372f95f2 Fix inaccurate main thread name shown in client log (#5078) 2018-11-23 15:40:46 -08:00
Ben Staddon d16472d0ba Improve reflection helper methods (#4853) 2018-11-23 15:37:53 -08:00
Ben Staddon 896db6398f Fix Baked Item models with transformations (#5241) 2018-11-23 15:28:30 -08:00
Ben Staddon e406137b19 Prevent RecipeBook from crashing on empty modded ingredients (#5234) 2018-11-23 15:24:18 -08:00
Vincent Lee 16f4903285 Stop firing LivingSetAttackTargetEvent for setRevengeTarget (#5217) 2018-11-23 15:22:08 -08:00
Ben Staddon 84d322da34 Fix missing string parameters in some log messages (#5210) 2018-11-23 15:20:30 -08:00
Ben Staddon 3a64cb8985 Re-add some missing villager profession patches (#5200)
* Fix zombie villagers only spawning with vanilla professions
* Fix spawning modded villagers that do not have their own building
2018-11-23 15:19:44 -08:00
TheIllusiveC4 2fef75c1de Fix the bed position given to the SleepingTimeCheck event (#5107) 2018-11-23 15:15:33 -08:00
Ben Staddon c040a8865f Fix some null returns from defaulted registries (#5235) 2018-11-15 13:52:45 -08:00
Yanbing Zhao 4931fc1907 Only remove synthetic lambda methods referenced in body of SideOnly methods (#5127) 2018-11-14 21:39:30 -08:00
LexManos 607da1bd9b Use HTTPS for files website. 2018-11-13 16:16:33 -08:00
Ben Staddon ebc4eaddac Fix patches from #5160 setting rotation as well as position (#5233) 2018-11-12 12:50:00 -08:00
LexManos 10dbbf9c19 A different approach to my changes in https://github.com/MinecraftForge/MinecraftForge/commit/8ace535995522bec0557d4217e0d98b3dc76cf1e to fix #5207 2018-11-12 12:47:27 -08:00
Ben Staddon f9c2f715fd Allow IModel to express itself as a vanilla parent (#5195)
* Fix errors caused by fancy missing model being non-vanilla parent

* Switch instanceof checks to a default IModel method

* Small code tweaks
2018-10-18 19:22:32 -04:00
gaudus 4e1f7138ee fixed visual bug with guislider 2018-10-18 19:21:42 -04:00
Ben Staddon 5ae5d81609 Make Forge blockstate variants correctly inherit AO setting from vanilla models (#5190)
* Make Forge blockstate variants correctly inherit AO setting

* Move variant format checks into variant, check for added properties

* Small code cleanup
2018-10-18 19:21:26 -04:00
Ben Staddon 947a004138 Make Forge-provided default transforms accessible to custom models 2018-10-18 19:21:02 -04:00
InsomniaKitten e4ca526d5b Add CreativeTabs#getLabelColor 2018-10-18 19:20:40 -04:00
XCompWiz 1ba084f131 Allow providing a BufferedImage for banner render generation (#5041)
* Adds an Event to allow providing a BufferedImage for the banner render generation (cached)
This allows mods to provide generated banner textures, since banners don't use an atlas.
Includes reference/test implementation.

* Missed some copyright; might as well absolut text match, I guess

* Remove unneeded patch change

* Fix event variable access convention

* Formatting fix

* Improve event handling registration

* Import cleanup

* Replace event approach with Supplier approach

* Better name for test mod (now that it's no longer an event); adds ENABLE flag

* Moves MC code into net.minecraftforge.client.MinecraftForgeClient.getImageLayer to simplify patch

* Generalize naming
2018-10-11 19:25:25 -04:00
Tim 857573f10f Fix Mesa biome entry tags in the BiomeDictionary (#5177) 2018-10-07 12:37:23 -07:00
LexManos 76c138c400 Bump version number for RB. 2018-10-04 00:34:49 -07:00
Ben Staddon 55a7c6d64b Add a notification event for handling game rule changes (#5152) 2018-10-04 00:27:17 -07:00
Ben Staddon 0fb8844623 Patch PotionHelper to use registry delegates (#5142) 2018-10-04 00:25:58 -07:00
Ben Staddon 6337466735 Prevent some texture loading errors from crashing the game (#5121) 2018-10-04 00:24:51 -07:00
Ben Staddon 214275baba Change biome spawn list entries to use factory method where possible (#5075) 2018-10-04 00:24:01 -07:00
Ben Staddon 82262e462e Change universal bucket support to use fluid names instead of instances (#5031) 2018-10-04 00:20:44 -07:00
tterrag ee0d43bbde Fix NPE on clientside entities constructed with null world (#5170) 2018-09-28 12:32:19 -07:00
tterrag 93b704b459 Fix patches from #5160 running on the client and causing stutter 2018-09-27 21:42:06 -04:00
gegy1000 10036aa764 Class transformer optimizations (#5159)
* Filter packages for deobf transformation
* Only serialize transformed class with TerminalTransformer if bytecode changed
2018-09-27 14:27:21 -07:00
mezz fcd00bd4af Update github stale so issues can be Assigned 2018-09-26 21:22:54 -07:00
Gabriel Harris-Rouquette c20a5e8805 Fix MC-136995 - Chunk loading and unloading issue with entities placed in exact positions. (#5160)
Scatter gun patches to improve entity tracking and position tracking. 
Provided by Aikar through the Paper project, this commit of patches combines the following patches:

https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0306-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0315-Always-process-chunk-registration-after-moving.patch
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0335-Ensure-chunks-are-always-loaded-on-hard-position-set.patch
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch
2018-09-26 11:08:30 -07:00
2137 changed files with 100160 additions and 56592 deletions

No files matched your search

-1
View File
@@ -13,4 +13,3 @@
*.pyd binary
*.cfg text eol=lf
*.py text eol=lf
*.jks binary
+30
View File
@@ -0,0 +1,30 @@
name: Publish
on:
push:
branches: [ '1.12.x' ]
permissions:
contents: read
jobs:
build:
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
with:
java: 8
gradle_tasks: 'ciWriteBuildNumber setup build publish'
legacy_prefix: 14
legacy_build_number: 2848
artifact_name: 'forge'
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
# Unused for now until we upgrade gradle
# SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
# SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
# SIGN_KEYSTORE_PASSWORD: ${{ secrets.SIGN_KEYSTORE_PASSWORD }}
# SIGN_KEYSTORE_DATA: ${{ secrets.SIGN_KEYSTORE_DATA }}
+17 -17
View File
@@ -1,8 +1,7 @@
#eclipse
**/bin
**/.settings
**/.classpath
*.project
/bin
/.settings
/.classpath
#In case people make their workspace in the repo
/eclipse/
@@ -15,17 +14,9 @@
#gradle
/build
/.gradle
/mdk/.gradle
/mdk/build
#occupational hazards
/projects/mcp/
/projects/clean/
/projects/forge/
/projects/**/build/
/projects/**/out/
/projects/**/run/
/projects/**/*.launch
/projects/
/repo/
/buildSrc
@@ -35,9 +26,18 @@
# FML changelog
changelog.txt
/patches_old/
/patches_old_bak/
*.py
*.7z
/logs/
gradle.properties
!/mdk/gradle.properties
.project
/mdk/.gradle/
/mdk/.settings/
/mdk/bin/
/mdk/build/
/mdk/crash-reports/
/mdk/logs/
/mdk/resourcepacks/
/mdk/run/
*.launch
*.classpath
-38
View File
@@ -1,38 +0,0 @@
sudo: required
dist: trusty
language: java
jdk: oraclejdk8
env:
- BUILD_NUMBER=9999
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $TRAVIS_BUILD_DIR/build/localCache/Forge/
before_install: chmod +x gradlew
install:
- ./gradlew --refresh-dependencies
- ./gradlew ciWriteBuildNumber
script:
- travis_wait ./gradlew build -x createExe -S
- ./gradlew -p projects/Forge test -S -i
notifications:
email: false
# skip building travis on 1.13+ - it doesn't work there
branches:
except:
- 1.13-pre
- 1.13.x
- 1.14.x
- /^noci-.*$/
+1 -1
View File
@@ -10,7 +10,7 @@ alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptian
of me taking over the project, who knows what Minecraft modding would be today.
Secondly, someone who has worked with me, and developed some of the core features
that allow modding to be as functional, and as simple as it is, cpw. For developing
that allow modding to he as functional, and as simple as it is, cpw. For developing
FML, which stabelized the client and server modding ecosystem. As well as the base
loading system that allows us to modify Minecraft's code as elegently as possible.
Vendored
-110
View File
@@ -1,110 +0,0 @@
@Library('forge-shared-library')_
pipeline {
options {
disableConcurrentBuilds()
}
agent {
docker {
image 'gradlewrapper:latest'
args '-v gradlecache:/gradlecache'
}
}
environment {
GRADLE_ARGS = '--no-daemon --console=plain' // No daemon for now as FG3 kinda derps. //'-Dorg.gradle.daemon.idletimeout=5000'
DISCORD_WEBHOOK = credentials('forge-discord-jenkins-webhook')
DISCORD_PREFIX = "Job: Forge Branch: ${BRANCH_NAME} Build: #${BUILD_NUMBER}"
JENKINS_HEAD = 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png'
}
stages {
stage('fetch') {
steps {
checkout scm
}
}
stage('notify_start') {
when {
not {
changeRequest()
}
}
steps {
discordSend(
title: "${DISCORD_PREFIX} Started",
successful: true,
result: 'ABORTED', //White border
thumbnail: JENKINS_HEAD,
webhookURL: DISCORD_WEBHOOK
)
}
}
stage('setup') {
steps {
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
script {
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "version:" | awk \'{print $2}\'').trim()
}
}
}
stage('changelog') {
when {
not {
changeRequest()
}
}
steps {
writeChangelog(currentBuild, 'build/changelog.txt')
}
}
stage('publish') {
when {
not {
changeRequest()
}
}
environment {
FORGE_MAVEN = credentials('forge-maven-forge-user')
CROWDIN = credentials('forge-crowdin')
KEYSTORE = credentials('forge-jenkins-keystore-old')
KEYSTORE_KEYPASS = credentials('forge-jenkins-keystore-old-keypass')
KEYSTORE_STOREPASS = credentials('forge-jenkins-keystore-old-keypass')
}
steps {
sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.forge/${MYVERSION}'
}
}
stage('test_publish_pr') { //Publish to local repo to test full process, but don't include credentials so it can't sign/publish to maven
when {
changeRequest()
}
environment {
CROWDIN = credentials('forge-crowdin')
}
steps {
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
}
}
}
post {
always {
script {
archiveArtifacts artifacts: 'projects/forge/build/libs/**/*.*', fingerprint: true, onlyIfSuccessful: true, allowEmptyArchive: true
//junit 'build/test-results/*/*.xml'
//jacoco sourcePattern: '**/src/*/java'
if (env.CHANGE_ID == null) { // This is unset for non-PRs
discordSend(
title: "${DISCORD_PREFIX} Finished ${currentBuild.currentResult}",
description: '```\n' + getChanges(currentBuild) + '\n```',
successful: currentBuild.resultIsBetterOrEqualTo("SUCCESS"),
result: currentBuild.currentResult,
thumbnail: JENKINS_HEAD,
webhookURL: DISCORD_WEBHOOK
)
}
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
IBXM is copyright (c) 2007, Martin Cameron, and is licensed under the BSD License.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of mumart nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,40 @@
SoundSystem CodecIBXM Class License:
You are free to use this class for any purpose, commercial or otherwise.
You may modify this class or source code, and distribute it any way you
like, provided the following conditions are met:
1) You may not falsely claim to be the author of this class or any
unmodified portion of it.
2) You may not copyright this class or a modified version of it and then
sue me for copyright infringement.
3) If you modify the source code, you must clearly document the changes
made before redistributing the modified source code, so other users know
it is not the original code.
4) You are not required to give me credit for this class in any derived
work, but if you do, you must also mention my website:
http://www.paulscode.com
5) I the author will not be responsible for any damages (physical,
financial, or otherwise) caused by the use if this class or any
portion of it.
6) I the author do not guarantee, warrant, or make any representations,
either expressed or implied, regarding the use of this class or any
portion of it.
Author: Paul Lamb
http://www.paulscode.com
This software is based on or using the IBXM library available from
http://www.geocities.com/sunet2000/
IBXM is copyright (c) 2007, Martin Cameron, and is licensed under the BSD License.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of mumart nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+2 -2
View File
@@ -1,5 +1,5 @@
Minecraft Forge
Copyright (c) 2016-2019.
Copyright (c) 2016-2020.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -13,4 +13,4 @@ Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+8 -2
View File
@@ -3,8 +3,8 @@ parts herein are licensed under the terms of the LGPL 2.1 found
here http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt and
copied below.
Homepage: http://minecraftforge.net/
https://github.com/MinecraftForge/MinecraftForge
Homepage: http://MinecraftForge.net/
http://github.com/MinecraftForge/MinecraftForge
A note on authorship:
@@ -57,6 +57,12 @@ This software contains a partial repackaging of javaxdelta, a BSD licensed progr
binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/
authored by genman, heikok, pivot.
The only changes are to replace some Trove collection types with standard Java collections, and repackaged.
This software contains potions of Paulscodee IBXM library, a BSD liceensed library for
loading and playing IBXM formated auto. No modifications havee beeen made. The associated
licenses can be found along side this one, or at
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/LICENSE-Paulscode%20IBXM%20Library.txt
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/LICENSE-Paulscode%20SoundSystem%20CodecIBXM.txt
=========================================================================
-127
View File
@@ -1,127 +0,0 @@
# FML
Entrypoint : ```FMLServiceProvider.onLoad```
- Verify environment
-- Check all libraries are present: ```accesstransformer```, ```coremod```, ```deobfuscator```
-- Check versions are suitable: ```modlauncher```, ```accesstransformer```, ```coremod```, ```deobfuscator```
- Find deobfuscated and patched MC
-- If not found, trigger job to generate that (loaded later at FMLLaunchProvider.launch)
Injected arguments:
- ```mods``` : CSV list of mod files to load
- ```modlist``` : JSON formatted list of mod files in a maven-like repository format
Entrypoint : ```FMLServiceProvider.initializer```
- Setup paths
-- ```mods``` folder
-- ```config``` folder
- FML config file read (JSON?)
- Trigger initial loading
Entrypoint : ```FMLLaunchProvider.launch```
- Launches the patched and deobfuscated game
- - If that wasn't found it'll be generated from the vanilla jar and patch/deobf files (see above)
- Possible we'll use an alternative launch for the development environment
(A goal is that we pre-generate this JAR during forge installation or modpack installation)
## Loading
- First we discover all mods
- - IModLocator instances present in system are found and queried to compile a master list of all mod artifacts of the three types
- LANGPROVIDERs are added to the supported language system : IModLanguageProvider
- The MODS from the list have their META-INF/mods.json file queried for mod instances to load
- - MODS are cross-referenced for their language being available
- - MODS are cross-referenced for their libraries being available
- - MODS are cross-referenced for their MOD dependencies being available
- - MODS with META-INF/coremods.json specification are loaded into the COREMOD system
- - MODS with META-INF/accesstransformer.json are loaded into the ACCESSTRANSFORMER system
- - MODS are enqueued to the background loading system
- FMLLaunchProvider will be triggered from the ModLauncher to start the game
## Game loading
- Events triggered from loadGame will launch various phases of modloading as before
-- Deprecation of old "FML" events in favour of Forge events
-- If a mod hasn't completed scanning there might be a pause waiting for it to complete before loading (testing indicates this should be a very rare occurrence and isn't worse than existing status quo where all scanning and loading is on-thread)
### ```IModLocator```
Finds mods from various sources of various types
manifest is queried for type: FMLModType
- MOD : this file will be scanned as a mod. This is default if nothing is present
- LIBRARY : this file will be added to the classpath and no further processing is done
- LANGPROVIDER : this file will be loaded as a language provider
#### ```ModsFolderLocator```
- scans for jar files from mods folder
-- able to load all types
-- loads in all environments
-- maybe able to do runtime name transformation for dev time?
Standard mechanism to find and load mods
#### ```ExplodedDirectoryLocator```
- loads a directory as a mod
-- only able to load mods
-- should only load in dev env
Intended as a mechanism to allow development of mods easily by pointing at a compiled output directory
#### ```ArgumentModsLocator``` : NYI
- loads mods from the arguments on the command line
-- able to load all types
-- loads in all environments
### ```IModLanguageProvider```
Provides mod and language provider services
- Provides a means to transform a Mod File (from the IModLocator) into a list of modcontainer objects based on mods.json
- Scanning work will be done in background threads
- Language providers can be provided as JARs via the modlocator for ease of distribution
#### ```FMLModLanguageProvider```
This is the standard Java @Mod implementation provider
- provided by default (always supported)
- All scanning for @Mod will be done in the background thread
#### ```ScalaModLanguageProvider```
This is the scala language provider. It'll be provided separately as a JAR mod download.
- API contract will need definition
Other languages? Kotlin? Alternative Scala versions? Javascript?
## Coremods
Coremods are now forcefully separated into _injection_ and _runtime_ phases.
### Injection
Injection is the act of intercepting the loading of a class and modifying the inbound class with alterations such as additions, replacements and deletions
Injections will be written using Javascript. Two functions are required: a function providing the list of injection sites, and the function to transform the injection site.
All injection sites will need to be pre-specified by the coremod in their metadata. Lookup services should be provided in the Javascript API.
Javascript API for common coremod injection tasks needs to be developed, to allow common best-practice tooling for these complex tasks.
Runtime coremod code (code that has been injected) is Java as usual.
## Background loading thread
Early in loading, a background thread is triggered which will perform scanning tasks for common resources, such as @Mod instances and other annotations. This thread will also be responsible for loading any cached resources, either those defined at build time or pre-computed from previous runs. It may also be tasked with writing those precomputed resources.
There will be a IPreLoaderJobProvider that will allow extension of the scope of these tasks
+395 -445
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
+430
View File
@@ -0,0 +1,430 @@
Build 2838:
bs2609: Fix vanilla handling of options file (MC-117449, MC-151173) (#5725)
Build 2837:
clienthax: Update EnumHelper to be compatible with Eclipse's OpenJ9 JVM. (#5712)
Build 2836:
tterrag:
Revert "Invalidate tile entities that are queued for removal (#5512)"
This reverts commit 75788f63eea6c33ccef7e5cbcab27ad9ad2c2a04.
This solution is invalid as TEs are free to modify the world
tileEntities list, usually indirectly via chunkloading, from inside
invalidate().
This happens in vanilla, in TileEntityChest#invalidate, where it calls
checkForAdjacentChests(), which has the potential to load neighboring
chunks and cause a CME.
A more sophisticated solution is needed.
Build 2835:
bs2609: Fix some vertex format changes not being handled correctly (#5368)
Build 2834:
bs2609:
Transform vertex normals as well as positions when generating quads
(#5242)
Build 2833:
rseifert.phone: Fix for SidedInvWrapper isItemValid using wrong slot (#5642)
Build 2832:
bs2609: Invalidate tile entities that are queued for removal (#5512)
Build 2831:
lclc98: Added Wool to OreDictionary (#5414)
Build 2830:
CreativeMD: Fixed boat not taking care of block-liquid hooks (#5086)
Build 2829:
bs2609: Add Forge dimension-changing hooks to spectator handling code (#5212)
Build 2828:
ichttt:
Minor performace improvement when building chunks and rendering blocks
(#5286)
Build 2827:
bs2609: Catch json parsing errors from constants/factories files (#5258)
Build 2826:
bs2609: Allow custom DataSerializers to be registered safely (#5245)
Build 2825:
cpw:
Try and make 1.13 mods more obviously wrong in 1.12..
Signed-off-by: cpw <[email protected]>
Build 2824:
tterrag: Fix #5651 Re-add canPlaceBlockOnSide check in World#mayPlace
Build 2823:
Pokechu022:
Fail fast when null is used with setTag instead of crashing in
writeEntry (#5257)
Build 2822:
tterrag: Fix block placement not checking for player collision
Build 2821:
wynprice999: Added more Constants (#5323)
Build 2820:
python0429: [1.12.2] Add a few events pertaining to villages (#5302)
Build 2819:
Tyler Hancock: [1.12] Fix special spawn event not firing in many cases. (#5389)
Build 2818:
bs2609: Only prompt for missing registries on local worlds (#5348)
Build 2817:
ckrier.3000: Add EntityPlaceEvent (#5057)
Build 2816:
bs2609: Generalise EnumRarity to an interface (#5182)
Build 2815:
bs2609: Apply access-level changes to inner class attributes (#5468)
Build 2814:
bs2609: Fix small logic error in ItemTextureQuadConverter (#5463)
Build 2813:
bs2609: Better support for custom bows (#5209)
Build 2812:
CovertJaguar: Remove FluidStack amount from hashcode calculation (#5272)
molecularphylo:
Fixed incorrect string representation of string list config property
default values in their comments.
bs2609:
Improve tracking of used dimension IDs (#5249)
Closes #5378 Large dimension IDs bloat level.data
Build 2811:
bs2609:
Fix up torch placement logic to handle more vanilla special-casing
(#5426)
Build 2810:
LexManos: Written size does not include int bytes.
Build 2809:
LexManos:
Extend Region files to support >1MB per chunk. If the 'sector count' is
255, ask the compressed data header for the proper length.
Build 2808:
tterrag1098: Add default impl to IConfigElement#getValidValuesDisplay
Build 2807:
tterrag: Simplify custom item rendering by removing GL emissivity hacks
Build 2806:
tterrag: Support diffuse lighting flag in item rendering
Build 2805:
bs2609:
Add a hook to allow continuously using items through stack changes
(#4834)
* Add a hook to allow continuously using items through stack changes
* Update licences
Build 2804:
oOMitchOo:
Added an additional constructor to every implementation of IFluidBlock.
It is now possible to create a fluid block with a Fluid, Material and
MapColor, so that the Material's MapColor isn't used for the blocks
MapColor. (#5293)
Build 2803:
bs2609: Add redirects to PotionEffect to respect registry replacement (#5213)
Build 2802:
alexiy.ov:
Add an annotation for @Config elements which will automatically create a
slider control (#5026)
Build 2801:
bs2609: Fix small logic error in emissive item rendering code (#5320)
Build 2800:
molecularphylo:
Allow config GUI cycling button elements generated from enums to display
toString return values, rather than actual values. (#5125)
Build 2799:
bs2609: Fix incorrect indexing in mipmap generation code (#5201)
Build 2798:
bs2609:
Ensure slave maps are cleaned up when handling registry overrides
(#5250)
Build 2797:
d_scalzi: Fix issue with --modListFile. (#5316)
Build 2796:
LexManos:
Fix potential issues with the Minecraft FakePlayer lingering around
after world unloads.
Build 2795:
tterrag: Fix potion remove event not always firing, add expiry event
Build 2794:
tterrag: Clean up CraftingHelper constants loading API
Build 2793:
tterrag: Fix crash from CraftingHelper due to FileSystem being closed early
Build 2792:
tterrag:
added PotionHooks, closes #3867, #4375 (#4614)
* solved merge confilct
* improved var names & removed tabs
* Added spaces around !=
* fixed typo
Build 2791:
tterrag:
Add a hook for farmland watering (#4891)
* Add a FarmlandWaterCheckEvent to allow mods to override when Farmland
is watered or not
* revert 1.12.2 json
* Move the farmland patch to a ticket based instead of a event based
system
* Minor changes
* Faster isValid checks, faster validation/invalidation if the state did
not change, expand test mod to include a test for the validation system
* remove isValid boolean flag, we can express it with the tick counter
* Fix test mod resource warnings
* Remove tick timeout, add a javadoc note to invalidate on chunk unload,
cleaned up test mod
* Allow mods to provide custom handling to determine if a pos is valid
or not
* Make SimpleTicket more simple, make register public so custom tickets
can be registered
* Fixes for review
* Add missing license headers
* Use a weak hash set
* Split up the map into smaller chunk based maps
* Add missing license headers
* Make MultiTicketManager more universal for custom implementations,
cleanup imports
Build 2790:
tterrag:
Add methods to allow loading json constants outside of _constants
(#4975)
* add interface methods for loading json constants from an arbitary file
* use try-with-resources
* don't make modders create jsoncontext, clean up resource use
* very minor cleanup
Build 2789:
tterrag:
Compute ASMDataTable submaps parallel, speeds up contructing mods
(#5246)
* Compute submaps parallel, speeds up contructing mods by a lot
* Use stream API better
Build 2788:
mezz: Add logging for data manager key registration errors (#5129)
Build 2787:
mezz: Improve support for custom block path types (#5203)
Build 2786:
mezz: Fix missing comments in configs created with annotations (#5189)
Build 2785:
mezz: Allow items to control the rate of repair from mending (#5102)
Build 2784:
mezz: Improve exception handling from server starting events (#5226)
Build 2783:
mezz: Improve context provided by potion icon rendering hooks (#5111)
Build 2782:
mezz: Fix an ObjectHolderRef internal error message (#5214)
Build 2781:
mezz: Implement rendering for item models with emissive quads (#5047)
Build 2780:
mezz: Clean up logged mod states (#5227)
mezz: Fix minor issue in getFilledPercentage for Fluid rendering (#5206)
Build 2779:
mezz: Improve reflection helper methods (#4853)
mezz: Fix inaccurate main thread name shown in client log (#5078)
Build 2778:
mezz: Fix Baked Item models with transformations (#5241)
Build 2777:
mezz:
Re-add some missing villager profession patches (#5200)
* Fix zombie villagers only spawning with vanilla professions
* Fix spawning modded villagers that do not have their own building
mezz: Fix missing string parameters in some log messages (#5210)
mezz: Stop firing LivingSetAttackTargetEvent for setRevengeTarget (#5217)
mezz: Prevent RecipeBook from crashing on empty modded ingredients (#5234)
Build 2776:
mezz: Fix the bed position given to the SleepingTimeCheck event (#5107)
Build 2775:
LexManos: Fix some null returns from defaulted registries (#5235)
Build 2774:
LexManos:
Only remove synthetic lambda methods referenced in body of SideOnly
methods (#5127)
Build 2773:
LexManos:
A different approach to my changes in
https://github.com/MinecraftForge/MinecraftForge/commit/8ace535995522bec0557d4217e0d98b3dc76cf1e
to fix #5207
LexManos: Fix patches from #5160 setting rotation as well as position (#5233)
LexManos: Use HTTPS for files website.
Build 2772:
tterrag: Make Forge-provided default transforms accessible to custom models
tterrag:
Make Forge blockstate variants correctly inherit AO setting from vanilla
models (#5190)
* Make Forge blockstate variants correctly inherit AO setting
* Move variant format checks into variant, check for added properties
* Small code cleanup
tterrag: fixed visual bug with guislider
tterrag:
Allow IModel to express itself as a vanilla parent (#5195)
* Fix errors caused by fancy missing model being non-vanilla parent
* Switch instanceof checks to a default IModel method
* Small code tweaks
Build 2771:
tterrag: Add CreativeTabs#getLabelColor
Build 2770:
tterrag:
Allow providing a BufferedImage for banner render generation (#5041)
* Adds an Event to allow providing a BufferedImage for the banner render
generation (cached)
textures, since banners don't use an atlas.
implementation.
* Missed some copyright; might as well absolut text match, I guess
* Remove unneeded patch change
* Fix event variable access convention
* Formatting fix
* Improve event handling registration
* Import cleanup
* Replace event approach with Supplier approach
* Better name for test mod (now that it's no longer an event); adds
ENABLE flag
* Moves MC code into
net.minecraftforge.client.MinecraftForgeClient.getImageLayer to simplify
patch
* Generalize naming
Build 2769:
mezz: Fix Mesa biome entry tags in the BiomeDictionary (#5177)
Build 2768:
LexManos: Bump version number for RB.
Build 2767:
LexManos:
Change biome spawn list entries to use factory method where possible
(#5075)
LexManos: Prevent some texture loading errors from crashing the game (#5121)
LexManos: Patch PotionHelper to use registry delegates (#5142)
LexManos: Add a notification event for handling game rule changes (#5152)
Build 2766:
LexManos:
Change universal bucket support to use fluid names instead of instances
(#5031)
Build 2765:
LexManos: Fix NPE on clientside entities constructed with null world (#5170)
Build 2764:
tterrag: Fix patches from #5160 running on the client and causing stutter
Build 2763:
LexManos:
Class transformer optimizations (#5159)
* Filter packages for deobf transformation
* Only serialize transformed class with TerminalTransformer if bytecode
changed
Build 2762:
github: Update github stale so issues can be Assigned
Build 2761:
LexManos:
Fix MC-136995 - Chunk loading and unloading issue with entities placed
in exact positions. (#5160)
Scatter gun patches to improve entity tracking and position tracking.
Provided by Aikar through the Paper project, this commit of patches
combines the following patches:
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0306-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0315-Always-process-chunk-registration-after-moving.patch
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0335-Ensure-chunks-are-always-loaded-on-hard-position-set.patch
https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch
Build 2760:
LexManos: Fix --mods and --modListFile arguments not making it past LaunchWrapper.
Build 2759:
LexManos: Remove BlamingTransformer (#5115)
+22 -27
View File
@@ -1,13 +1,13 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
@@ -25,10 +25,11 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
//mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
mappings channel: 'snapshot', version: '20171003-1.12'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg')
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
@@ -41,28 +42,15 @@ minecraft {
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
source sourceSets.main
}
}
}
}
}
@@ -109,18 +97,15 @@ jar {
}
// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
artifact jar
}
}
repositories {
@@ -128,4 +113,14 @@ publishing {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
// FML does not support loading exploded directories as mods.
// Eclipse works fine because it merges classes and resources when debugging
// IntelliJ used to work because FG2 forced the files to be jared during debugging.
// Since FG3+ doesn't do that, we need to merge the sourcesets from gradle's side.
sourceSets.each {
def dir = layout.buildDirectory.file("sourcesSets/$it.name").get().asFile
it.output.resourcesDir = dir
it.java.outputDir = dir
}
@@ -1,84 +1,31 @@
package com.example.examplemod;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Logger;
import java.util.stream.Collectors;
// The value here should match an entry in the META-INF/mods.toml file
@Mod("examplemod")
@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION)
public class ExampleMod
{
// Directly reference a log4j logger.
private static final Logger LOGGER = LogManager.getLogger();
public static final String MODID = "examplemod";
public static final String NAME = "Example Mod";
public static final String VERSION = "1.0";
public ExampleMod() {
// Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
// Register the enqueueIMC method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
// Register the processIMC method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
// Register the doClientStuff method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
private static Logger logger;
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}
private void setup(final FMLCommonSetupEvent event)
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
// some preinit code
LOGGER.info("HELLO FROM PREINIT");
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
logger = event.getModLog();
}
private void doClientStuff(final FMLClientSetupEvent event) {
// do something that can only be done on the client
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
}
private void enqueueIMC(final InterModEnqueueEvent event)
@EventHandler
public void init(FMLInitializationEvent event)
{
// some example code to dispatch IMC to another mod
InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});
}
private void processIMC(final InterModProcessEvent event)
{
// some example code to receive and process InterModComms from other mods
LOGGER.info("Got IMC {}", event.getIMCStream().
map(m->m.getMessageSupplier().get()).
collect(Collectors.toList()));
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(FMLServerStartingEvent event) {
// do something when the server starts
LOGGER.info("HELLO from server starting");
}
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
// Event bus for receiving Registry Events)
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents {
@SubscribeEvent
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
// register a new block here
LOGGER.info("HELLO from Register Block");
}
// some example code
logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
}
-56
View File
@@ -1,56 +0,0 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[25,)" #mandatory (24 is current forge version)
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="examplemod" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${file.jarVersion}" #mandatory
# A display name for the mod
displayName="Example Mod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
updateJSONURL="http://myurl.me/" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://example.com/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors="Love, Cheese and small house plants" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
This is a long form description of the mod. You can write whatever you want here
Have some lorem ipsum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.examplemod]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[25,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.examplemod]]
modId="minecraft"
mandatory=true
versionRange="[1.13.2]"
ordering="NONE"
side="BOTH"
+16
View File
@@ -0,0 +1,16 @@
[
{
"modid": "examplemod",
"name": "Example Mod",
"description": "Example placeholder mod.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authorList": ["ExampleDude"],
"credits": "The Forge and FML guys, for making this example",
"logoFile": "",
"screenshots": [],
"dependencies": []
}
]
+2 -2
View File
@@ -1,7 +1,7 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 4,
"_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods."
"pack_format": 3,
"_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)."
}
}
-66
View File
@@ -1,66 +0,0 @@
# The name of the mod loader type to load
modLoader="javafml"
# A version range to match for said mod loader
loaderVersion="[2.0,)"
# A URL to query for updates
updateJSONURL="http://myurl.me/"
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/"
# Extra mod loader property
randomScalaProperty="fishy"
# Arbitrary key-value property pairs available to mods
[properties]
key="value"
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]]
# The modid of the mod
modId="inventorysorter"
# The version number of the mod
version="1.1"
# A display name for the mod
displayName="Inventory Sorter"
# The description text for the mod (multi line!)
description='''
This is my mod, there may be
others, but this one is mine
'''
# Override the default resourcelocation namespace with this instead
# Currently not implemented
namespace="invsorter"
# A random extra property for a mod loader
randomExtraProperty="somevalue"
# Arbitrary key-value pairs
[modproperties.inventorysorter]
key="value"
# A list of dependencies
[[dependencies.inventorysorter]]
# the modid of the dependency
modid="forge"
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true
# The version range of the dependency
versionRange="[14.23.2.0,)"
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.inventorysorter]]
modid="minecraft"
mandatory=true
versionRange="[1.12.2]"
ordering="NONE"
side="BOTH"
# Here's another mod in this jar
[[mods]]
# Note that other mod types may want to add additional key-value pairs in here
modId="inventorysortertoo"
# ${file.jarVersion} will read the Implementation-Version of the jar file
version="${file.jarVersion}"
displayName="Inventory Sorter as well"
description='''
This is also my mod, there may be
others, but this one is mine
'''
@@ -1,24 +0,0 @@
--- a/com/mojang/blaze3d/platform/GLX.java
+++ b/com/mojang/blaze3d/platform/GLX.java
@@ -115,6 +115,10 @@
p_212906_0_.put(1286, "Operation on incomplete framebuffer");
});
+ /* Stores the last values sent into glMultiTexCoord2f */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
+
public static void populateSnooperWithOpenGL(IDataHolder p_populateSnooperWithOpenGL_0_) {
p_populateSnooperWithOpenGL_0_.setFixedData("opengl_version", GlStateManager.getString(7938));
p_populateSnooperWithOpenGL_0_.setFixedData("opengl_vendor", GlStateManager.getString(7936));
@@ -909,6 +913,10 @@
GL13.glMultiTexCoord2f(p_glMultiTexCoord2f_0_, p_glMultiTexCoord2f_1_, p_glMultiTexCoord2f_2_);
}
+ if (p_glMultiTexCoord2f_0_ == GL_TEXTURE1) {
+ lastBrightnessX = p_glMultiTexCoord2f_1_;
+ lastBrightnessY = p_glMultiTexCoord2f_2_;
+ }
}
public static void glBlendFuncSeparate(int p_glBlendFuncSeparate_0_, int p_glBlendFuncSeparate_1_, int p_glBlendFuncSeparate_2_, int p_glBlendFuncSeparate_3_) {
@@ -1,14 +0,0 @@
--- a/com/mojang/blaze3d/platform/TextureUtil.java
+++ b/com/mojang/blaze3d/platform/TextureUtil.java
@@ -44,7 +44,10 @@
}
public static void prepareImage(NativeImage.PixelFormatGLCode p_prepareImage_0_, int p_prepareImage_1_, int p_prepareImage_2_, int p_prepareImage_3_, int p_prepareImage_4_) {
- bind(p_prepareImage_1_);
+ synchronized (net.minecraftforge.fml.client.SplashProgress.class)
+ {
+ bind(p_prepareImage_1_);
+ }
if (p_prepareImage_2_ >= 0) {
GlStateManager.texParameter(3553, 33085, p_prepareImage_2_);
GlStateManager.texParameter(3553, 33082, 0);
@@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/advancements/AdvancementManager.java
+++ ../src-work/minecraft/net/minecraft/advancements/AdvancementManager.java
@@ -66,6 +66,7 @@
field_192784_c.func_192087_a();
Map<ResourceLocation, Advancement.Builder> map = this.func_192781_c();
this.func_192777_a(map);
+ this.field_193768_e |= net.minecraftforge.common.ForgeHooks.loadAdvancements(map);
field_192784_c.func_192083_a(map);
for (Advancement advancement : field_192784_c.func_192088_b())
@@ -1,11 +1,11 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -43,7 +43,7 @@
--- ../src-base/minecraft/net/minecraft/advancements/AdvancementRewards.java
+++ ../src-work/minecraft/net/minecraft/advancements/AdvancementRewards.java
@@ -49,7 +49,7 @@
public void func_192113_a(final EntityPlayerMP p_192113_1_)
{
p_192113_1_.func_71023_q(this.field_192115_b);
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_186472_a(p_192113_1_).func_186471_a();
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_186472_a(p_192113_1_).func_186470_a(p_192113_1_).func_186469_a(p_192113_1_.func_184817_da()).func_186471_a(); // Forge: add player & luck to LootContext
boolean flag = false;
public void func_192113_a(ServerPlayerEntity p_192113_1_) {
p_192113_1_.func_195068_e(this.field_192115_b);
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f);
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext
boolean flag = false;
for(ResourceLocation resourcelocation : this.field_192116_c) {
for (ResourceLocation resourcelocation : this.field_192116_c)
@@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/advancements/DisplayInfo.java
+++ ../src-work/minecraft/net/minecraft/advancements/DisplayInfo.java
@@ -132,7 +132,9 @@
{
Item item = JsonUtils.func_188180_i(p_193221_0_, "item");
int i = JsonUtils.func_151208_a(p_193221_0_, "data", 0);
- return new ItemStack(item, 1, i);
+ ItemStack ret = new ItemStack(item, 1, i);
+ ret.func_77982_d(net.minecraftforge.common.util.JsonUtils.readNBT(p_193221_0_, "nbt"));
+ return ret;
}
}
@@ -1,19 +1,21 @@
--- a/net/minecraft/advancements/PlayerAdvancements.java
+++ b/net/minecraft/advancements/PlayerAdvancements.java
@@ -186,6 +186,8 @@
}
--- ../src-base/minecraft/net/minecraft/advancements/PlayerAdvancements.java
+++ ../src-work/minecraft/net/minecraft/advancements/PlayerAdvancements.java
@@ -196,6 +196,9 @@
public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) {
+ // Forge: don't grant advancements for fake players
+ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false;
boolean flag = false;
AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_);
boolean flag1 = advancementprogress.func_192105_a();
@@ -198,6 +200,7 @@
if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_82766_b("announceAdvancements")) {
this.field_192756_d.func_184103_al().func_148539_a(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()));
public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_)
{
+ // Forge: don't grant advancements for fake players
+ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false;
+
boolean flag = false;
AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_);
boolean flag1 = advancementprogress.func_192105_a();
@@ -214,6 +217,8 @@
{
this.field_192756_d.func_184103_al().func_148539_a(new TextComponentTranslation("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), new Object[] {this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()}));
}
+
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
}
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
}
}
}
@@ -0,0 +1,16 @@
--- ../src-base/minecraft/net/minecraft/advancements/critereon/ItemPredicate.java
+++ ../src-work/minecraft/net/minecraft/advancements/critereon/ItemPredicate.java
@@ -104,6 +104,13 @@
if (p_192492_0_ != null && !p_192492_0_.isJsonNull())
{
JsonObject jsonobject = JsonUtils.func_151210_l(p_192492_0_, "item");
+ if (jsonobject.has("type"))
+ {
+ final ResourceLocation rl = new ResourceLocation(JsonUtils.func_151200_h(jsonobject, "type"));
+ final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> map = net.minecraftforge.advancements.critereon.ItemPredicates.getPredicates();
+ if (map.containsKey(rl)) return map.get(rl).apply(jsonobject);
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
+ }
MinMaxBounds minmaxbounds = MinMaxBounds.func_192515_a(jsonobject.get("count"));
MinMaxBounds minmaxbounds1 = MinMaxBounds.func_192515_a(jsonobject.get("durability"));
Integer integer = jsonobject.has("data") ? JsonUtils.func_151203_m(jsonobject, "data") : null;
@@ -1,38 +0,0 @@
--- a/net/minecraft/advancements/criterion/ItemPredicate.java
+++ b/net/minecraft/advancements/criterion/ItemPredicate.java
@@ -25,6 +25,8 @@
import net.minecraft.util.registry.Registry;
public class ItemPredicate {
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
public static final ItemPredicate field_192495_a = new ItemPredicate();
@Nullable
private final Tag<Item> field_200018_b;
@@ -93,6 +95,11 @@
public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) {
if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) {
JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item");
+ if (jsonobject.has("type")) {
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type"));
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
+ }
MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count"));
MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability"));
if (jsonobject.has("data")) {
@@ -181,6 +188,14 @@
}
}
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
+ custom_predicates.put(name, deserializer);
+ }
+
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
+ return unmod_predicates;
+ }
+
public static class Builder {
private final List<EnchantmentPredicate> field_200312_a = Lists.newArrayList();
@Nullable
@@ -1,96 +0,0 @@
--- a/net/minecraft/block/AbstractRailBlock.java
+++ b/net/minecraft/block/AbstractRailBlock.java
@@ -35,7 +35,7 @@
}
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
- RailShape railshape = p_220053_1_.func_177230_c() == this ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
+ RailShape railshape = p_220053_1_.func_177230_c() == this ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
}
@@ -57,7 +57,7 @@
public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
if (!p_220069_2_.field_72995_K) {
- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l());
+ RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null);
boolean flag = false;
BlockPos blockpos = p_220069_3_.func_177977_b();
if (!func_220064_c(p_220069_2_, blockpos)) {
@@ -115,7 +115,7 @@
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_5_) {
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) {
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) {
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
}
@@ -127,5 +127,66 @@
}
}
+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract IProperty<RailShape> func_176560_l();
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
+ {
+ return !this.field_196277_c;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos) {
+ return true;
+ }
+
+ /**
+ * Return the rail's direction.
+ * Can be used to make the cart think the rail is a different shape,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * @param world The world.
+ * @param pos Block's position in world
+ * @param state The BlockState
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @return The direction.
+ */
+ public RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) {
+ return state.func_177229_b(func_176560_l());
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param pos Block's position in world
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param pos Block's position in world
+ */
+ public void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) { }
}
@@ -1,13 +0,0 @@
--- a/net/minecraft/block/BedBlock.java
+++ b/net/minecraft/block/BedBlock.java
@@ -85,7 +85,9 @@
}
}
- if (p_220051_2_.field_73011_w.func_76567_e() && p_220051_2_.func_180494_b(p_220051_3_) != Biomes.field_76778_j) {
+ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_220051_2_.field_73011_w.canSleepAt(p_220051_4_, p_220051_3_);
+ if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) {
+ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return true;
if (p_220051_1_.func_177229_b(field_176471_b)) {
p_220051_4_.func_146105_b(new TranslationTextComponent("block.minecraft.bed.occupied"), true);
return true;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,43 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBanner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java
@@ -90,16 +90,9 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- ItemStack itemstack = this.func_185549_e(p_180653_1_, p_180653_2_);
-
- if (itemstack.func_190926_b())
{
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
}
- else
- {
- func_180635_a(p_180653_1_, p_180653_2_, itemstack);
- }
}
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
@@ -126,6 +119,23 @@
return BlockFaceShape.UNDEFINED;
}
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntity te = world.func_175625_s(pos);
+
+ if (te instanceof TileEntityBanner)
+ {
+ TileEntityBanner tileentitybanner = (TileEntityBanner)te;
+ ItemStack itemstack = tileentitybanner.func_190615_l();
+ drops.add(itemstack);
+ }
+ else
+ {
+ drops.add(new ItemStack(Items.field_179564_cE, 1, 0));
+ }
+ }
+
public static class BlockBannerHanging extends BlockBanner
{
protected static final AxisAlignedBB field_185551_d = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 0.78125D, 1.0D);
@@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBed.java
@@ -84,8 +84,10 @@
}
}
- if (p_180639_1_.field_73011_w.func_76567_e() && p_180639_1_.func_180494_b(p_180639_2_) != Biomes.field_76778_j)
+ net.minecraft.world.WorldProvider.WorldSleepResult sleepResult = p_180639_1_.field_73011_w.canSleepAt(p_180639_4_, p_180639_2_);
+ if (sleepResult != net.minecraft.world.WorldProvider.WorldSleepResult.BED_EXPLODES)
{
+ if (sleepResult == net.minecraft.world.WorldProvider.WorldSleepResult.DENY) return true;
if (((Boolean)p_180639_3_.func_177229_b(field_176471_b)).booleanValue())
{
EntityPlayer entityplayer = this.func_176470_e(p_180639_1_, p_180639_2_);
@@ -0,0 +1,70 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -17,7 +17,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockBush extends Block
+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable
{
protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D);
@@ -40,7 +40,8 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_185514_i(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()));
+ IBlockState soil = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ return super.func_176196_c(p_176196_1_, p_176196_2_) && soil.func_177230_c().canSustainPlant(soil, p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
}
protected boolean func_185514_i(IBlockState p_185514_1_)
@@ -70,6 +71,11 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
+ if (p_180671_3_.func_177230_c() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ {
+ IBlockState soil = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b());
+ return soil.func_177230_c().canSustainPlant(soil, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
+ }
return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()));
}
@@ -94,6 +100,36 @@
return false;
}
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ if (this == Blocks.field_150464_aj) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150459_bM) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150469_bN) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_185773_cZ) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150394_bc) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150393_bb) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150330_I) return net.minecraftforge.common.EnumPlantType.Desert;
+ if (this == Blocks.field_150392_bi) return net.minecraftforge.common.EnumPlantType.Water;
+ if (this == Blocks.field_150337_Q) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.field_150338_P) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.field_150388_bm) return net.minecraftforge.common.EnumPlantType.Nether;
+ if (this == Blocks.field_150345_g) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150329_H) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150398_cm) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150328_O) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150327_N) return net.minecraftforge.common.EnumPlantType.Plains;
+ return net.minecraftforge.common.EnumPlantType.Plains;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() != this) return func_176223_P();
+ return state;
+ }
+
@SideOnly(Side.CLIENT)
public BlockRenderLayer func_180664_k()
{
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
@@ -98,7 +98,7 @@
if (p_181088_2_ == EnumFacing.UP)
{
- return block == Blocks.field_150438_bZ || !func_193384_b(block) && flag;
+ return iblockstate.func_185896_q() || !func_193384_b(block) && flag;
}
else
{
@@ -0,0 +1,67 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -20,7 +20,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockCactus extends Block
+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15);
protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D);
@@ -36,6 +36,7 @@
public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_)
{
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
BlockPos blockpos = p_180650_2_.func_177984_a();
if (p_180650_1_.func_175623_d(blockpos))
@@ -51,6 +52,8 @@
{
int j = ((Integer)p_180650_3_.func_177229_b(field_176587_a)).intValue();
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, blockpos, p_180650_3_, true))
+ {
if (j == 15)
{
p_180650_1_.func_175656_a(blockpos, this.func_176223_P());
@@ -62,6 +65,8 @@
{
p_180650_1_.func_180501_a(p_180650_2_, p_180650_3_.func_177226_a(field_176587_a, Integer.valueOf(j + 1)), 4);
}
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
+ }
}
}
}
@@ -112,8 +117,8 @@
}
}
- Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c();
- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m && !p_176586_1_.func_180495_p(p_176586_2_.func_177984_a()).func_185904_a().func_76224_d();
+ IBlockState state = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b());
+ return state.func_177230_c().canSustainPlant(state, p_176586_1_, p_176586_2_.func_177977_b(), EnumFacing.UP, this) && !p_176586_1_.func_180495_p(p_176586_2_.func_177984_a()).func_185904_a().func_76224_d();
}
public void func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_)
@@ -137,6 +142,18 @@
return ((Integer)p_176201_1_.func_177229_b(field_176587_a)).intValue();
}
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return net.minecraftforge.common.EnumPlantType.Desert;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return func_176223_P();
+ }
+
protected BlockStateContainer func_180661_e()
{
return new BlockStateContainer(this, new IProperty[] {field_176587_a});
@@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
@@ -470,7 +470,7 @@
if (block == this)
{
- if (this.func_176457_m(p_189418_1_, blockpos))
+ if (!p_189418_3_ && this.func_176457_m(p_189418_1_, blockpos)) // Forge: fix MC-99321
{
return null;
}
@@ -538,7 +538,7 @@
private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_)
{
- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_185915_l();
+ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).doesSideBlockChestOpening(p_176456_1_, p_176456_2_.func_177984_a(), EnumFacing.DOWN);
}
private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_)
@@ -608,4 +608,10 @@
BASIC,
TRAP;
}
+
+ /* ======================================== FORGE START =====================================*/
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ return !func_176454_e(world, pos) && super.rotateBlock(world, pos, axis);
+ }
}
@@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockChorusFlower.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChorusFlower.java
@@ -55,7 +55,7 @@
{
int i = ((Integer)p_180650_3_.func_177229_b(field_185607_a)).intValue();
- if (i < 5 && p_180650_4_.nextInt(1) == 0)
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, blockpos, p_180650_3_, p_180650_4_.nextInt(1) == 0))
{
boolean flag = false;
boolean flag1 = false;
@@ -144,6 +144,7 @@
{
this.func_185605_c(p_180650_1_, p_180650_2_);
}
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
}
}
}
@@ -0,0 +1,44 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -44,13 +44,14 @@
{
this.func_176500_f(p_180650_1_, p_180650_2_, p_180650_3_);
}
- else if (p_180650_1_.field_73012_v.nextInt(5) == 0)
+ else
{
int i = ((Integer)p_180650_3_.func_177229_b(field_176501_a)).intValue();
- if (i < 2)
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_.nextInt(5) == 0))
{
p_180650_1_.func_180501_a(p_180650_2_, p_180650_3_.func_177226_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
}
}
}
@@ -132,7 +133,14 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- int i = ((Integer)p_180653_3_.func_177229_b(field_176501_a)).intValue();
+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
+ }
+
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ super.getDrops(drops, world, pos, state, fortune);
+ int i = ((Integer)state.func_177229_b(field_176501_a)).intValue();
int j = 1;
if (i >= 2)
@@ -142,7 +150,7 @@
for (int k = 0; k < j; ++k)
{
- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b()));
+ drops.add(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b()));
}
}
@@ -0,0 +1,81 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -70,6 +70,7 @@
{
super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_);
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) >= 9)
{
int i = this.func_185527_x(p_180650_3_);
@@ -78,9 +79,10 @@
{
float f = func_180672_a(this, p_180650_1_, p_180650_2_);
- if (p_180650_4_.nextInt((int)(25.0F / f) + 1) == 0)
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_.nextInt((int)(25.0F / f) + 1) == 0))
{
p_180650_1_.func_180501_a(p_180650_2_, this.func_185528_e(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
}
}
}
@@ -116,11 +118,11 @@
float f1 = 0.0F;
IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
- if (iblockstate.func_177230_c() == Blocks.field_150458_ak)
+ if (iblockstate.func_177230_c().canSustainPlant(iblockstate, p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_))
{
f1 = 1.0F;
- if (((Integer)iblockstate.func_177229_b(BlockFarmland.field_176531_a)).intValue() > 0)
+ if (iblockstate.func_177230_c().isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j)))
{
f1 = 3.0F;
}
@@ -161,7 +163,8 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()));
+ IBlockState soil = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b());
+ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && soil.func_177230_c().canSustainPlant(soil, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
}
protected Item func_149866_i()
@@ -174,11 +177,32 @@
return Items.field_151015_O;
}
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ super.getDrops(drops, world, pos, state, 0);
+ int age = func_185527_x(state);
+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random();
+
+ if (age >= func_185526_g())
+ {
+ int k = 3 + fortune;
+
+ for (int i = 0; i < 3 + fortune; ++i)
+ {
+ if (rand.nextInt(2 * func_185526_g()) <= age)
+ {
+ drops.add(new ItemStack(this.func_149866_i(), 1, 0));
+ }
+ }
+ }
+ }
+
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0);
+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
- if (!p_180653_1_.field_72995_K)
+ if (false && !p_180653_1_.field_72995_K) // Forge: NOP all this.
{
int i = this.func_185527_x(p_180653_3_);
@@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java
@@ -17,7 +17,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockDeadBush extends BlockBush
+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable
{
protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -68,4 +68,11 @@
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
}
}
+
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(Blocks.field_150330_I));
+ }
}
@@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
@@ -203,7 +203,7 @@
flag1 = true;
}
- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q())
+ if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).isSideSolid(p_189540_2_, p_189540_3_.func_177977_b(), EnumFacing.UP))
{
p_189540_2_.func_175698_g(p_189540_3_);
flag1 = true;
@@ -247,13 +247,14 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- if (p_176196_2_.func_177956_o() >= 255)
+ if (p_176196_2_.func_177956_o() >= p_176196_1_.func_72800_K() - 1)
{
return false;
}
else
{
- return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q() && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a());
+ IBlockState state = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ return (state.func_185896_q() || state.func_193401_d(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a());
}
}
@@ -0,0 +1,81 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
@@ -24,7 +24,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockDoublePlant extends BlockBush implements IGrowable
+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
{
public static final PropertyEnum<BlockDoublePlant.EnumPlantType> field_176493_a = PropertyEnum.<BlockDoublePlant.EnumPlantType>func_177709_a("variant", BlockDoublePlant.EnumPlantType.class);
public static final PropertyEnum<BlockDoublePlant.EnumBlockHalf> field_176492_b = PropertyEnum.<BlockDoublePlant.EnumBlockHalf>func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class);
@@ -87,6 +87,8 @@
Block block = (Block)(flag ? this : p_176475_1_.func_180495_p(blockpos).func_177230_c());
Block block1 = (Block)(flag ? p_176475_1_.func_180495_p(blockpos1).func_177230_c() : this);
+ if (!flag) this.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air.
+
if (block == this)
{
p_176475_1_.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 2);
@@ -95,17 +97,13 @@
if (block1 == this)
{
p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3);
-
- if (!flag)
- {
- this.func_176226_b(p_176475_1_, blockpos1, p_176475_3_, 0);
- }
}
}
}
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
+ if (p_180671_3_.func_177230_c() != this) return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this;
@@ -160,7 +158,6 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_)
{
- if (p_180657_1_.field_72995_K || p_180657_6_.func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_))
{
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
}
@@ -220,8 +217,6 @@
else
{
p_176489_4_.func_71029_a(StatList.func_188055_a(this));
- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).func_177044_a();
- func_180635_a(p_176489_1_, p_176489_2_, new ItemStack(Blocks.field_150329_H, 2, i));
return true;
}
}
@@ -290,6 +285,24 @@
return Block.EnumOffsetType.XZ;
}
+ @Override
+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a);
+ return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ EnumPlantType type = (EnumPlantType)world.func_180495_p(pos).func_177229_b(field_176493_a);
+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.FERN.func_177044_a()));
+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a()));
+ return ret;
+ }
+
public static enum EnumBlockHalf implements IStringSerializable
{
UPPER,
@@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java
@@ -48,7 +48,7 @@
private void func_180683_d(World p_180683_1_, BlockPos p_180683_2_)
{
- if (BlockFalling.func_185759_i(p_180683_1_.func_180495_p(p_180683_2_.func_177977_b())) && p_180683_2_.func_177956_o() >= 0)
+ if (p_180683_1_.func_175623_d(p_180683_2_.func_177977_b()) && BlockFalling.func_185759_i(p_180683_1_.func_180495_p(p_180683_2_.func_177977_b())) && p_180683_2_.func_177956_o() >= 0)
{
int i = 32;
@@ -61,7 +61,7 @@
p_180683_1_.func_175698_g(p_180683_2_);
BlockPos blockpos;
- for (blockpos = p_180683_2_; BlockFalling.func_185759_i(p_180683_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b())
+ for (blockpos = p_180683_2_; p_180683_1_.func_175623_d(blockpos) && BlockFalling.func_185759_i(p_180683_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b())
{
;
}
@@ -95,7 +95,7 @@
{
BlockPos blockpos = p_180684_2_.func_177982_a(p_180684_1_.field_73012_v.nextInt(16) - p_180684_1_.field_73012_v.nextInt(16), p_180684_1_.field_73012_v.nextInt(8) - p_180684_1_.field_73012_v.nextInt(8), p_180684_1_.field_73012_v.nextInt(16) - p_180684_1_.field_73012_v.nextInt(16));
- if (p_180684_1_.func_180495_p(blockpos).func_177230_c().field_149764_J == Material.field_151579_a)
+ if (p_180684_1_.func_175623_d(blockpos))
{
if (p_180684_1_.field_72995_K)
{
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java
@@ -43,7 +43,7 @@
{
ItemStack itemstack = tileentitydispenser.func_70301_a(i);
- if (!itemstack.func_190926_b())
+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, tileentitydispenser, i, itemstack))
{
EnumFacing enumfacing = (EnumFacing)p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
BlockPos blockpos = p_176439_2_.func_177972_a(enumfacing);
@@ -0,0 +1,60 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDynamicLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDynamicLiquid.java
@@ -26,6 +26,7 @@
public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_)
{
+ if (!p_180650_1_.func_175697_a(p_180650_2_, this.func_185698_b(p_180650_1_))) return; // Forge: avoid loading unloaded chunks
int i = ((Integer)p_180650_3_.func_177229_b(field_176367_b)).intValue();
int j = 1;
@@ -67,7 +68,7 @@
}
}
- if (this.field_149815_a >= 2 && this.field_149764_J == Material.field_151586_h)
+ if (this.field_149815_a >= 2 && net.minecraftforge.event.ForgeEventFactory.canCreateFluidSource(p_180650_1_, p_180650_2_, p_180650_3_, this.field_149764_J == Material.field_151586_h))
{
IBlockState iblockstate = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b());
@@ -118,7 +119,7 @@
{
if (this.field_149764_J == Material.field_151587_i && p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_185904_a() == Material.field_151586_h)
{
- p_180650_1_.func_175656_a(p_180650_2_.func_177977_b(), Blocks.field_150348_b.func_176223_P());
+ p_180650_1_.func_175656_a(p_180650_2_.func_177977_b(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_180650_1_, p_180650_2_.func_177977_b(), p_180650_2_, Blocks.field_150348_b.func_176223_P()));
this.func_180688_d(p_180650_1_, p_180650_2_.func_177977_b());
return;
}
@@ -166,6 +167,7 @@
}
else
{
+ if (p_176375_3_.func_177230_c() != Blocks.field_150431_aC) //Forge: Vanilla has a 'bug' where snowballs don't drop like every other block. So special case because ewww...
p_176375_3_.func_177230_c().func_176226_b(p_176375_1_, p_176375_2_, p_176375_3_, 0);
}
}
@@ -187,7 +189,7 @@
if (!this.func_176372_g(p_176374_1_, blockpos, iblockstate) && (iblockstate.func_185904_a() != this.field_149764_J || ((Integer)iblockstate.func_177229_b(field_176367_b)).intValue() > 0))
{
- if (!this.func_176372_g(p_176374_1_, blockpos.func_177977_b(), iblockstate))
+ if (!this.func_176372_g(p_176374_1_, blockpos.func_177977_b(), p_176374_1_.func_180495_p(blockpos.func_177977_b())))
{
return p_176374_3_;
}
@@ -254,11 +256,12 @@
private boolean func_176372_g(World p_176372_1_, BlockPos p_176372_2_, IBlockState p_176372_3_)
{
- Block block = p_176372_1_.func_180495_p(p_176372_2_).func_177230_c();
+ Block block = p_176372_3_.func_177230_c(); //Forge: state must be valid for position
+ Material mat = p_176372_3_.func_185904_a();
if (!(block instanceof BlockDoor) && block != Blocks.field_150472_an && block != Blocks.field_150468_ap && block != Blocks.field_150436_aH)
{
- return block.field_149764_J != Material.field_151567_E && block.field_149764_J != Material.field_189963_J ? block.field_149764_J.func_76230_c() : true;
+ return mat != Material.field_151567_E && mat != Material.field_189963_J ? mat.func_76230_c() : true;
}
else
{
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockEnchantmentTable.java
+++ ../src-work/minecraft/net/minecraft/block/BlockEnchantmentTable.java
@@ -64,7 +64,7 @@
{
BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j);
- if (p_180655_2_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150342_X)
+ if (net.minecraftforge.common.ForgeHooks.getEnchantPower(p_180655_2_, blockpos) > 0)
{
if (!p_180655_2_.func_175623_d(p_180655_3_.func_177982_a(i / 2, 0, j / 2)))
{
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockEnderChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockEnderChest.java
@@ -100,7 +100,7 @@
if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest)
{
- if (p_180639_1_.func_180495_p(p_180639_2_.func_177984_a()).func_185915_l())
+ if (p_180639_1_.func_180495_p(p_180639_2_.func_177984_a()).doesSideBlockChestOpening(p_180639_1_, p_180639_2_.func_177984_a(), EnumFacing.DOWN))
{
return true;
}
@@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -47,7 +47,7 @@
private void func_176503_e(World p_176503_1_, BlockPos p_176503_2_)
{
- if (func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0)
+ if ((p_176503_1_.func_175623_d(p_176503_2_.func_177977_b()) || func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b()))) && p_176503_2_.func_177956_o() >= 0)
{
int i = 32;
@@ -62,17 +62,18 @@
}
else
{
+ IBlockState state = p_176503_1_.func_180495_p(p_176503_2_);
p_176503_1_.func_175698_g(p_176503_2_);
BlockPos blockpos;
- for (blockpos = p_176503_2_.func_177977_b(); func_185759_i(p_176503_1_.func_180495_p(blockpos)) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b())
+ for (blockpos = p_176503_2_.func_177977_b(); (p_176503_1_.func_175623_d(blockpos) || func_185759_i(p_176503_1_.func_180495_p(blockpos))) && blockpos.func_177956_o() > 0; blockpos = blockpos.func_177977_b())
{
;
}
if (blockpos.func_177956_o() > 0)
{
- p_176503_1_.func_175656_a(blockpos.func_177984_a(), this.func_176223_P());
+ p_176503_1_.func_175656_a(blockpos.func_177984_a(), state); //Forge: Fix loss of state information during world gen.
}
}
}
@@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -72,7 +72,7 @@
public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_)
{
- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof EntityLivingBase && (p_180658_3_ instanceof EntityPlayer || p_180658_1_.func_82736_K().func_82766_b("mobGriefing")) && p_180658_3_.field_70130_N * p_180658_3_.field_70130_N * p_180658_3_.field_70131_O > 0.512F)
+ if (net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) // Forge: Move logic to Entity#canTrample
{
func_190970_b(p_180658_1_, p_180658_2_);
}
@@ -95,7 +95,7 @@
private boolean func_176529_d(World p_176529_1_, BlockPos p_176529_2_)
{
Block block = p_176529_1_.func_180495_p(p_176529_2_.func_177984_a()).func_177230_c();
- return block instanceof BlockCrops || block instanceof BlockStem;
+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(p_176529_1_.func_180495_p(p_176529_2_), p_176529_1_, p_176529_2_, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block);
}
private boolean func_176530_e(World p_176530_1_, BlockPos p_176530_2_)
@@ -108,7 +108,7 @@
}
}
- return false;
+ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_1_, p_176530_2_);
}
public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_)
@@ -0,0 +1,38 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFence.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFence.java
@@ -165,7 +165,10 @@
public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_)
{
- return p_176221_1_.func_177226_a(field_176526_a, Boolean.valueOf(this.func_176524_e(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))).func_177226_a(field_176525_b, Boolean.valueOf(this.func_176524_e(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.WEST))).func_177226_a(field_176527_M, Boolean.valueOf(this.func_176524_e(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))).func_177226_a(field_176528_N, Boolean.valueOf(this.func_176524_e(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST)));
+ return p_176221_1_.func_177226_a(field_176526_a, canFenceConnectTo(p_176221_2_, p_176221_3_, EnumFacing.NORTH))
+ .func_177226_a(field_176525_b, canFenceConnectTo(p_176221_2_, p_176221_3_, EnumFacing.EAST))
+ .func_177226_a(field_176527_M, canFenceConnectTo(p_176221_2_, p_176221_3_, EnumFacing.SOUTH))
+ .func_177226_a(field_176528_N, canFenceConnectTo(p_176221_2_, p_176221_3_, EnumFacing.WEST));
}
public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_)
@@ -201,6 +204,23 @@
return new BlockStateContainer(this, new IProperty[] {field_176526_a, field_176525_b, field_176528_N, field_176527_M});
}
+ /* ======================================== FORGE START ======================================== */
+
+ @Override
+ public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
+ {
+ return func_176524_e(world, pos.func_177972_a(facing), facing.func_176734_d());
+ }
+
+ private boolean canFenceConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
+ {
+ BlockPos other = pos.func_177972_a(facing);
+ Block block = world.func_180495_p(other).func_177230_c();
+ return block.canBeConnectedTo(world, other, facing.func_176734_d()) || func_176524_e(world, other, facing.func_176734_d());
+ }
+
+ /* ======================================== FORGE END ======================================== */
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE : BlockFaceShape.CENTER;
@@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFenceGate.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFenceGate.java
@@ -59,7 +59,7 @@
{
EnumFacing.Axis enumfacing$axis = ((EnumFacing)p_176221_1_.func_177229_b(field_185512_D)).func_176740_k();
- if (enumfacing$axis == EnumFacing.Axis.Z && (p_176221_2_.func_180495_p(p_176221_3_.func_177976_e()).func_177230_c() == Blocks.field_150463_bK || p_176221_2_.func_180495_p(p_176221_3_.func_177974_f()).func_177230_c() == Blocks.field_150463_bK) || enumfacing$axis == EnumFacing.Axis.X && (p_176221_2_.func_180495_p(p_176221_3_.func_177978_c()).func_177230_c() == Blocks.field_150463_bK || p_176221_2_.func_180495_p(p_176221_3_.func_177968_d()).func_177230_c() == Blocks.field_150463_bK))
+ if (enumfacing$axis == EnumFacing.Axis.Z && (p_176221_2_.func_180495_p(p_176221_3_.func_177976_e()).func_177230_c() instanceof BlockWall || p_176221_2_.func_180495_p(p_176221_3_.func_177974_f()).func_177230_c() instanceof BlockWall) || enumfacing$axis == EnumFacing.Axis.X && (p_176221_2_.func_180495_p(p_176221_3_.func_177978_c()).func_177230_c() instanceof BlockWall || p_176221_2_.func_180495_p(p_176221_3_.func_177968_d()).func_177230_c() instanceof BlockWall))
{
p_176221_1_ = p_176221_1_.func_177226_a(field_176467_M, Boolean.valueOf(true));
}
@@ -192,6 +192,23 @@
return new BlockStateContainer(this, new IProperty[] {field_185512_D, field_176466_a, field_176465_b, field_176467_M});
}
+ /* ======================================== FORGE START ======================================== */
+
+ @Override
+ public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() instanceof BlockFenceGate &&
+ state.func_193401_d(world, pos, facing) == BlockFaceShape.MIDDLE_POLE)
+ {
+ Block connector = world.func_180495_p(pos.func_177972_a(facing)).func_177230_c();
+ return connector instanceof BlockFence || connector instanceof BlockWall;
+ }
+ return false;
+ }
+
+ /* ======================================== FORGE END ======================================== */
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
if (p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN)
@@ -0,0 +1,218 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -39,7 +39,15 @@
public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_)
{
- return !p_176221_2_.func_180495_p(p_176221_3_.func_177977_b()).func_185896_q() && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b()) ? p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a()))) : this.func_176223_P();
+ if (!p_176221_2_.func_180495_p(p_176221_3_.func_177977_b()).isSideSolid(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP))
+ {
+ return p_176221_1_.func_177226_a(field_176545_N, this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))
+ .func_177226_a(field_176546_O, this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.WEST))
+ .func_177226_a(field_176541_P, this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))
+ .func_177226_a(field_176539_Q, this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST))
+ .func_177226_a(field_176542_R, this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN));
+ }
+ return this.func_176223_P();
}
protected BlockFire()
@@ -92,6 +100,7 @@
public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_)
{
+ if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.field_149849_a.put(p_180686_1_, Integer.valueOf(p_180686_2_));
this.field_149848_b.put(p_180686_1_, Integer.valueOf(p_180686_3_));
}
@@ -126,19 +135,15 @@
{
if (p_180650_1_.func_82736_K().func_82766_b("doFireTick"))
{
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire
if (!this.func_176196_c(p_180650_1_, p_180650_2_))
{
p_180650_1_.func_175698_g(p_180650_2_);
}
Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c();
- boolean flag = block == Blocks.field_150424_aL || block == Blocks.field_189877_df;
+ boolean flag = block.isFireSource(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP);
- if (p_180650_1_.field_73011_w instanceof WorldProviderEnd && block == Blocks.field_150357_h)
- {
- flag = true;
- }
-
int i = ((Integer)p_180650_3_.func_177229_b(field_176543_a)).intValue();
if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_) && p_180650_4_.nextFloat() < 0.2F + (float)i * 0.03F)
@@ -159,7 +164,7 @@
{
if (!this.func_176533_e(p_180650_1_, p_180650_2_))
{
- if (!p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_185896_q() || i > 3)
+ if (!p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).isSideSolid(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) || i > 3)
{
p_180650_1_.func_175698_g(p_180650_2_);
}
@@ -167,7 +172,7 @@
return;
}
- if (!this.func_176535_e(p_180650_1_, p_180650_2_.func_177977_b()) && i == 15 && p_180650_4_.nextInt(4) == 0)
+ if (!this.canCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) && i == 15 && p_180650_4_.nextInt(4) == 0)
{
p_180650_1_.func_175698_g(p_180650_2_);
return;
@@ -182,12 +187,12 @@
j = -50;
}
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177974_f(), 300 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177976_e(), 300 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177977_b(), 250 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177984_a(), 250 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177978_c(), 300 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177968_d(), 300 + j, p_180650_4_, i);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177974_f(), 300 + j, p_180650_4_, i, EnumFacing.WEST);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177976_e(), 300 + j, p_180650_4_, i, EnumFacing.EAST);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), 250 + j, p_180650_4_, i, EnumFacing.UP);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177984_a(), 250 + j, p_180650_4_, i, EnumFacing.DOWN);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177978_c(), 300 + j, p_180650_4_, i, EnumFacing.SOUTH);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177968_d(), 300 + j, p_180650_4_, i, EnumFacing.NORTH);
for (int k = -1; k <= 1; ++k)
{
@@ -246,22 +251,30 @@
return false;
}
+ @Deprecated // Use Block.getFlammability
public int func_176532_c(Block p_176532_1_)
{
Integer integer = this.field_149848_b.get(p_176532_1_);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use Block.getFireSpreadSpeed
public int func_176534_d(Block p_176534_1_)
{
Integer integer = this.field_149849_a.get(p_176534_1_);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use tryCatchFire with face below
private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_)
{
- int i = this.func_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c());
+ this.tryCatchFire(p_176536_1_, p_176536_2_, p_176536_3_, p_176536_4_, p_176536_5_, EnumFacing.UP);
+ }
+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face)
+ {
+ int i = p_176536_1_.func_180495_p(p_176536_2_).func_177230_c().getFlammability(p_176536_1_, p_176536_2_, face);
+
if (p_176536_4_.nextInt(p_176536_3_) < i)
{
IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_);
@@ -293,7 +306,7 @@
{
for (EnumFacing enumfacing : EnumFacing.values())
{
- if (this.func_176535_e(p_176533_1_, p_176533_2_.func_177972_a(enumfacing)))
+ if (this.canCatchFire(p_176533_1_, p_176533_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()))
{
return true;
}
@@ -314,7 +327,7 @@
for (EnumFacing enumfacing : EnumFacing.values())
{
- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i);
+ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c().getFireSpreadSpeed(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i);
}
return i;
@@ -326,9 +339,10 @@
return false;
}
+ @Deprecated // Use canCatchFire with face sensitive version below
public boolean func_176535_e(IBlockAccess p_176535_1_, BlockPos p_176535_2_)
{
- return this.func_176534_d(p_176535_1_.func_180495_p(p_176535_2_).func_177230_c()) > 0;
+ return canCatchFire(p_176535_1_, p_176535_2_, EnumFacing.UP);
}
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
@@ -372,9 +386,9 @@
p_180655_2_.func_184134_a((double)((float)p_180655_3_.func_177958_n() + 0.5F), (double)((float)p_180655_3_.func_177956_o() + 0.5F), (double)((float)p_180655_3_.func_177952_p() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false);
}
- if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_185896_q() && !Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177977_b()))
+ if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).isSideSolid(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP) && !Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP))
{
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177976_e()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177976_e(), EnumFacing.EAST))
{
for (int j = 0; j < 2; ++j)
{
@@ -385,7 +399,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177974_f()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), EnumFacing.WEST))
{
for (int k = 0; k < 2; ++k)
{
@@ -396,7 +410,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177978_c()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), EnumFacing.SOUTH))
{
for (int l = 0; l < 2; ++l)
{
@@ -407,7 +421,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177968_d()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), EnumFacing.NORTH))
{
for (int i1 = 0; i1 < 2; ++i1)
{
@@ -418,7 +432,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177984_a()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), EnumFacing.DOWN))
{
for (int j1 = 0; j1 < 2; ++j1)
{
@@ -462,6 +476,21 @@
return new BlockStateContainer(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R});
}
+ /*================================= Forge Start ======================================*/
+ /**
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param pos Block position
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ return world.func_180495_p(pos).func_177230_c().isFlammable(world, pos, face);
+ }
+ /*================================= Forge Start ======================================*/
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;
@@ -0,0 +1,64 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
@@ -152,12 +152,14 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return super.func_176196_c(p_176196_1_, p_176196_2_) && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q();
+ IBlockState downState = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ return super.func_176196_c(p_176196_1_, p_176196_2_) && (downState.func_185896_q() || downState.func_193401_d(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID);
}
public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_)
{
- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q())
+ IBlockState downState = p_189540_2_.func_180495_p(p_189540_3_.func_177977_b());
+ if (!downState.func_185896_q() && downState.func_193401_d(p_189540_2_, p_189540_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID)
{
this.func_176226_b(p_189540_2_, p_189540_3_, p_189540_1_, 0);
p_189540_2_.func_175698_g(p_189540_3_);
@@ -166,13 +168,6 @@
public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_)
{
- TileEntityFlowerPot tileentityflowerpot = this.func_176442_d(p_180663_1_, p_180663_2_);
-
- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null)
- {
- func_180635_a(p_180663_1_, p_180663_2_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b()));
- }
-
super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_);
}
@@ -398,6 +393,30 @@
return BlockFaceShape.UNDEFINED;
}
+
+ /*============================FORGE START=====================================*/
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ super.getDrops(drops, world, pos, state, fortune);
+ TileEntityFlowerPot te = world.func_175625_s(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.func_175625_s(pos) : null;
+ if (te != null && te.func_145965_a() != null)
+ drops.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b()));
+ }
+ @Override
+ public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops
+ return super.removedByPlayer(state, world, pos, player, willHarvest);
+ }
+ @Override
+ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack tool)
+ {
+ super.func_180657_a(world, player, pos, state, te, tool);
+ world.func_175698_g(pos);
+ }
+ /*===========================FORGE END==========================================*/
+
public static enum EnumFlowerType implements IStringSerializable
{
EMPTY("empty"),
@@ -0,0 +1,42 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -38,7 +38,8 @@
{
if (!p_180650_1_.field_72995_K)
{
- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_185891_c() > 2)
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
+ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2)
{
p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P());
}
@@ -58,7 +59,7 @@
IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos.func_177984_a());
IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos);
- if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate.func_185891_c() <= 2)
+ if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate.getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) <= 2)
{
p_180650_1_.func_175656_a(blockpos, Blocks.field_150349_c.func_176223_P());
}
@@ -96,18 +97,11 @@
{
if (j >= i / 16)
{
- if (p_176474_1_.func_180495_p(blockpos1).func_177230_c().field_149764_J == Material.field_151579_a)
+ if (p_176474_1_.func_175623_d(blockpos1))
{
if (p_176474_2_.nextInt(8) == 0)
{
- BlockFlower.EnumFlowerType blockflower$enumflowertype = p_176474_1_.func_180494_b(blockpos1).func_180623_a(p_176474_2_, blockpos1);
- BlockFlower blockflower = blockflower$enumflowertype.func_176964_a().func_180346_a();
- IBlockState iblockstate = blockflower.func_176223_P().func_177226_a(blockflower.func_176494_l(), blockflower$enumflowertype);
-
- if (blockflower.func_180671_f(p_176474_1_, blockpos1, iblockstate))
- {
- p_176474_1_.func_180501_a(blockpos1, iblockstate, 3);
- }
+ p_176474_1_.func_180494_b(blockpos1).plantFlower(p_176474_1_, p_176474_2_, blockpos1);
}
else
{
@@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java
@@ -222,6 +222,20 @@
return new BlockStateContainer(this, new IProperty[] {field_176380_a});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty<?>>)state.func_177228_b().keySet())
+ {
+ if (prop.func_177701_a().equals("variant"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
public static enum EnumType implements IStringSerializable
{
NORTH_WEST(1, "north_west"),
@@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -41,9 +41,14 @@
p_180657_2_.func_71029_a(StatList.func_188055_a(this));
p_180657_2_.func_71020_j(0.005F);
- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0)
+ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0)
{
- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_));
+ java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
+ items.add(this.func_180643_i(p_180657_4_));
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_);
+ for (ItemStack is : items)
+ func_180635_a(p_180657_1_, p_180657_3_, is);
}
else
{
@@ -54,7 +59,9 @@
}
int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_);
+ harvesters.set(p_180657_2_);
this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i);
+ harvesters.set(null);
Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_185904_a();
if (material.func_76230_c() || material.func_76224_d())
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
@@ -158,6 +158,8 @@
return new BlockStateContainer(this, new IProperty[] {field_176382_a});
}
+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; }
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;
@@ -0,0 +1,139 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -17,7 +17,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class BlockLeaves extends Block
+public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable
{
public static final PropertyBool field_176237_a = PropertyBool.func_177716_a("decayable");
public static final PropertyBool field_176236_b = PropertyBool.func_177716_a("check_decay");
@@ -53,9 +53,9 @@
BlockPos blockpos = p_180663_2_.func_177982_a(j1, k1, l1);
IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos);
- if (iblockstate.func_185904_a() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(field_176236_b)).booleanValue())
+ if (iblockstate.func_177230_c().isLeaves(iblockstate, p_180663_1_, blockpos))
{
- p_180663_1_.func_180501_a(blockpos, iblockstate.func_177226_a(field_176236_b, Boolean.valueOf(true)), 4);
+ iblockstate.func_177230_c().beginLeavesDecay(iblockstate, p_180663_1_, blockpos);
}
}
}
@@ -83,7 +83,8 @@
this.field_150128_a = new int[32768];
}
- if (p_180650_1_.func_175707_a(new BlockPos(k - 5, l - 5, i1 - 5), new BlockPos(k + 5, l + 5, i1 + 5)))
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 1)) return; // Forge: prevent decaying leaves from updating neighbors and loading unloaded chunks
+ if (p_180650_1_.func_175697_a(p_180650_2_, 6)) // Forge: extend range from 5 to 6 to account for neighbor checks in world.markAndNotifyBlock -> world.updateObservingBlocksAt
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
@@ -96,9 +97,9 @@
IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2));
Block block = iblockstate.func_177230_c();
- if (block != Blocks.field_150364_r && block != Blocks.field_150363_s)
+ if (!block.canSustainLeaves(iblockstate, p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)))
{
- if (iblockstate.func_185904_a() == Material.field_151584_j)
+ if (block.isLeaves(iblockstate, p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)))
{
this.field_150128_a[(i2 + 16) * 1024 + (j2 + 16) * 32 + k2 + 16] = -2;
}
@@ -205,40 +206,7 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- if (!p_180653_1_.field_72995_K)
- {
- int i = this.func_176232_d(p_180653_3_);
-
- if (p_180653_5_ > 0)
- {
- i -= 2 << p_180653_5_;
-
- if (i < 10)
- {
- i = 10;
- }
- }
-
- if (p_180653_1_.field_73012_v.nextInt(i) == 0)
- {
- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_);
- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_)));
- }
-
- i = 200;
-
- if (p_180653_5_ > 0)
- {
- i -= 10 << p_180653_5_;
-
- if (i < 40)
- {
- i = 40;
- }
- }
-
- this.func_176234_a(p_180653_1_, p_180653_2_, p_180653_3_, i);
- }
+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
}
protected void func_176234_a(World p_176234_1_, BlockPos p_176234_2_, IBlockState p_176234_3_, int p_176234_4_)
@@ -274,6 +242,51 @@
public abstract BlockPlanks.EnumType func_176233_b(int p_176233_1_);
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; }
+
+ @Override
+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos)
+ {
+ if (!(Boolean)state.func_177229_b(field_176236_b))
+ {
+ world.func_180501_a(pos, state.func_177226_a(field_176236_b, true), 4);
+ }
+ }
+
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random();
+ int chance = this.func_176232_d(state);
+
+ if (fortune > 0)
+ {
+ chance -= 2 << fortune;
+ if (chance < 10) chance = 10;
+ }
+
+ if (rand.nextInt(chance) == 0)
+ {
+ ItemStack drop = new ItemStack(func_180660_a(state, rand, fortune), 1, func_180651_a(state));
+ if (!drop.func_190926_b())
+ drops.add(drop);
+ }
+
+ chance = 200;
+ if (fortune > 0)
+ {
+ chance -= 10 << fortune;
+ if (chance < 40) chance = 40;
+ }
+
+ this.captureDrops(true);
+ if (world instanceof World)
+ this.func_176234_a((World)world, pos, state, chance); // Dammet mojang
+ drops.addAll(this.captureDrops(false));
+ }
+
+
@SideOnly(Side.CLIENT)
public boolean func_176225_a(IBlockState p_176225_1_, IBlockAccess p_176225_2_, BlockPos p_176225_3_, EnumFacing p_176225_4_)
{
@@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLiquid.java
@@ -284,14 +284,14 @@
if (integer.intValue() == 0)
{
- p_176365_1_.func_175656_a(p_176365_2_, Blocks.field_150343_Z.func_176223_P());
+ p_176365_1_.func_175656_a(p_176365_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_176365_1_, p_176365_2_, p_176365_2_, Blocks.field_150343_Z.func_176223_P()));
this.func_180688_d(p_176365_1_, p_176365_2_);
return true;
}
if (integer.intValue() <= 4)
{
- p_176365_1_.func_175656_a(p_176365_2_, Blocks.field_150347_e.func_176223_P());
+ p_176365_1_.func_175656_a(p_176365_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_176365_1_, p_176365_2_, p_176365_2_, Blocks.field_150347_e.func_176223_P()));
this.func_180688_d(p_176365_1_, p_176365_2_);
return true;
}
@@ -448,8 +448,39 @@
return (float)p_190972_2_.func_177956_o() + func_190973_f(p_190972_0_, p_190972_1_, p_190972_2_);
}
+ @Override
+ public float getBlockLiquidHeight(World world, BlockPos pos, IBlockState state, Material material)
+ {
+ return BlockLiquid.func_190973_f(state, world, pos);
+ }
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;
}
+
+ @Override
+ @SideOnly (Side.CLIENT)
+ public Vec3d getFogColor(World world, BlockPos pos, IBlockState state, Entity entity, Vec3d originalColor, float partialTicks)
+ {
+ Vec3d viewport = net.minecraft.client.renderer.ActiveRenderInfo.func_178806_a(entity, partialTicks);
+
+ if (state.func_185904_a().func_76224_d())
+ {
+ float height = 0.0F;
+ if (state.func_177230_c() instanceof BlockLiquid)
+ {
+ height = func_149801_b(state.func_177229_b(field_176367_b)) - 0.11111111F;
+ }
+ float f1 = (float) (pos.func_177956_o() + 1) - height;
+ if (viewport.field_72448_b > (double)f1)
+ {
+ BlockPos upPos = pos.func_177984_a();
+ IBlockState upState = world.func_180495_p(upPos);
+ return upState.func_177230_c().getFogColor(world, upPos, upState, entity, originalColor, partialTicks);
+ }
+ }
+
+ return super.getFogColor(world, pos, state, entity, originalColor, partialTicks);
+ }
}
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java
@@ -34,9 +34,9 @@
{
IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos);
- if (iblockstate.func_185904_a() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(BlockLeaves.field_176236_b)).booleanValue())
+ if (iblockstate.func_177230_c().isLeaves(iblockstate, p_180663_1_, blockpos))
{
- p_180663_1_.func_180501_a(blockpos, iblockstate.func_177226_a(BlockLeaves.field_176236_b, Boolean.valueOf(true)), 4);
+ iblockstate.func_177230_c().beginLeavesDecay(iblockstate, p_180663_1_, blockpos);
}
}
}
@@ -69,6 +69,9 @@
}
}
+ @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+
public static enum EnumAxis implements IStringSerializable
{
X("x"),
@@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java
@@ -40,10 +40,14 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
- int i = 15 + p_180653_1_.field_73012_v.nextInt(15) + p_180653_1_.field_73012_v.nextInt(15);
- this.func_180637_b(p_180653_1_, p_180653_2_, i);
}
+ @Override
+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
+ }
+
public boolean func_149662_c(IBlockState p_149662_1_)
{
return false;
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -89,7 +89,7 @@
}
else
{
- return p_180671_1_.func_175699_k(p_180671_2_) < 13 && this.func_185514_i(iblockstate);
+ return p_180671_1_.func_175699_k(p_180671_2_) < 13 && iblockstate.func_177230_c().canSustainPlant(iblockstate, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
}
}
else
@@ -0,0 +1,21 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -39,7 +39,8 @@
{
if (!p_180650_1_.field_72995_K)
{
- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_185891_c() > 2)
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 2)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
+ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2)
{
p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P().func_177226_a(BlockDirt.field_176386_a, BlockDirt.DirtType.DIRT));
}
@@ -53,7 +54,7 @@
IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos);
IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos.func_177984_a());
- if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate1.func_185891_c() <= 2)
+ if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && iblockstate1.getLightOpacity(p_180650_1_, blockpos.func_177984_a()) <= 2)
{
p_180650_1_.func_175656_a(blockpos, this.func_176223_P());
}
@@ -0,0 +1,60 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -42,25 +42,28 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
- return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()));
+ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_);
}
public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_)
{
int i = ((Integer)p_180650_3_.func_177229_b(field_176486_a)).intValue();
- if (i < 3 && p_180650_4_.nextInt(10) == 0)
+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_.nextInt(10) == 0))
{
- p_180650_3_ = p_180650_3_.func_177226_a(field_176486_a, Integer.valueOf(i + 1));
- p_180650_1_.func_180501_a(p_180650_2_, p_180650_3_, 2);
+ IBlockState newState = p_180650_3_.func_177226_a(field_176486_a, Integer.valueOf(i + 1));
+ p_180650_1_.func_180501_a(p_180650_2_, newState, 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, newState);
}
super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_);
}
+ @SuppressWarnings("unused")
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- if (!p_180653_1_.field_72995_K)
+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
+ if (false && !p_180653_1_.field_72995_K)
{
int i = 1;
@@ -106,6 +109,23 @@
return ((Integer)p_176201_1_.func_177229_b(field_176486_a)).intValue();
}
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random();
+ int count = 1;
+
+ if (((Integer)state.func_177229_b(field_176486_a)) >= 3)
+ {
+ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ drops.add(new ItemStack(Items.field_151075_bm));
+ }
+ }
+
protected BlockStateContainer func_180661_e()
{
return new BlockStateContainer(this, new IProperty[] {field_176486_a});
@@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java
@@ -106,4 +106,10 @@
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
}
}
+
+ @Override
+ public NonNullList<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return NonNullList.func_191197_a(1, new ItemStack(this, 1, world.func_180495_p(pos).func_177229_b(field_176240_P).func_176839_a() - 4));
+ }
}
@@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNote.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java
@@ -63,7 +63,9 @@
if (tileentity instanceof TileEntityNote)
{
TileEntityNote tileentitynote = (TileEntityNote)tileentity;
+ int old = tileentitynote.field_145879_a;
tileentitynote.func_145877_a();
+ if (old == tileentitynote.field_145879_a) return false;
tileentitynote.func_175108_a(p_180639_1_, p_180639_2_);
p_180639_4_.func_71029_a(StatList.field_188087_U);
}
@@ -103,6 +105,10 @@
public boolean func_189539_a(IBlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_)
{
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_5_, p_189539_4_);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
+ p_189539_4_ = e.getInstrument().ordinal();
+ p_189539_5_ = e.getVanillaNoteId();
float f = (float)Math.pow(2.0D, (double)(p_189539_5_ - 12) / 12.0D);
p_189539_2_.func_184133_a((EntityPlayer)null, p_189539_3_, this.func_185576_e(p_189539_4_), SoundCategory.RECORDS, 3.0F, f);
p_189539_2_.func_175688_a(EnumParticleTypes.NOTE, (double)p_189539_3_.func_177958_n() + 0.5D, (double)p_189539_3_.func_177956_o() + 1.2D, (double)p_189539_3_.func_177952_p() + 0.5D, (double)p_189539_5_ / 24.0D, 0.0D, 0.0D);
@@ -0,0 +1,15 @@
--- ../src-base/minecraft/net/minecraft/block/BlockObserver.java
+++ ../src-work/minecraft/net/minecraft/block/BlockObserver.java
@@ -145,4 +145,12 @@
{
return this.func_176223_P().func_177226_a(field_176387_N, EnumFacing.func_82600_a(p_176203_1_ & 7));
}
+
+ /* ======================================== FORGE START =====================================*/
+ @Override
+ public void observedNeighborChange(IBlockState observerState, World world, BlockPos observerPos, Block changedBlock, BlockPos changedBlockPos)
+ {
+ func_190962_b(observerState, world, observerPos, changedBlock, changedBlockPos);
+ }
+ /* ========================================= FORGE END ======================================*/
}
@@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java
@@ -101,11 +101,16 @@
if (!p_180657_1_.field_72995_K && p_180657_6_.func_77973_b() == Items.field_151097_aZ)
{
p_180657_2_.func_71029_a(StatList.func_188055_a(this));
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176239_P)).func_176839_a()));
}
else
{
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
}
}
+
+ @Override
+ public NonNullList<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return NonNullList.func_191197_a(1, new ItemStack(this, 1, world.func_180495_p(pos).func_177229_b(field_176239_P).func_176839_a()));
+ }
}
@@ -0,0 +1,50 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
@@ -78,34 +78,39 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
-
- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this))
+ }
+ @Override
+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random();
+ if (this.func_180660_a(state, rand, fortune) != Item.func_150898_a(this))
{
int i = 0;
if (this == Blocks.field_150365_q)
{
- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 0, 2);
+ i = MathHelper.func_76136_a(rand, 0, 2);
}
else if (this == Blocks.field_150482_ag)
{
- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7);
+ i = MathHelper.func_76136_a(rand, 3, 7);
}
else if (this == Blocks.field_150412_bA)
{
- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7);
+ i = MathHelper.func_76136_a(rand, 3, 7);
}
else if (this == Blocks.field_150369_x)
{
- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5);
+ i = MathHelper.func_76136_a(rand, 2, 5);
}
else if (this == Blocks.field_150449_bY)
{
- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5);
+ i = MathHelper.func_76136_a(rand, 2, 5);
}
- this.func_180637_b(p_180653_1_, p_180653_2_, i);
+ return i;
}
+ return 0;
}
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
@@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -112,7 +112,10 @@
public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_)
{
- return p_176221_1_.func_177226_a(field_176241_b, Boolean.valueOf(this.func_193393_b(p_176221_2_, p_176221_2_.func_180495_p(p_176221_3_.func_177978_c()), p_176221_3_.func_177978_c(), EnumFacing.SOUTH))).func_177226_a(field_176243_N, Boolean.valueOf(this.func_193393_b(p_176221_2_, p_176221_2_.func_180495_p(p_176221_3_.func_177968_d()), p_176221_3_.func_177968_d(), EnumFacing.NORTH))).func_177226_a(field_176244_O, Boolean.valueOf(this.func_193393_b(p_176221_2_, p_176221_2_.func_180495_p(p_176221_3_.func_177976_e()), p_176221_3_.func_177976_e(), EnumFacing.EAST))).func_177226_a(field_176242_M, Boolean.valueOf(this.func_193393_b(p_176221_2_, p_176221_2_.func_180495_p(p_176221_3_.func_177974_f()), p_176221_3_.func_177974_f(), EnumFacing.WEST)));
+ return p_176221_1_.func_177226_a(field_176241_b, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.NORTH))
+ .func_177226_a(field_176243_N, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.SOUTH))
+ .func_177226_a(field_176244_O, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.WEST))
+ .func_177226_a(field_176242_M, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.EAST));
}
public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_)
@@ -197,6 +200,24 @@
return new BlockStateContainer(this, new IProperty[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N});
}
+ /* ======================================== FORGE START ======================================== */
+
+ @Override
+ public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
+ {
+ BlockPos offset = pos.func_177972_a(facing);
+ return func_193393_b(world, world.func_180495_p(offset), offset, facing.func_176734_d());
+ }
+
+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir)
+ {
+ BlockPos other = pos.func_177972_a(dir);
+ IBlockState state = world.func_180495_p(other);
+ return state.func_177230_c().canBeConnectedTo(world, other, dir.func_176734_d()) || func_193393_b(world, state, other, dir.func_176734_d());
+ }
+
+ /* ======================================== FORGE END ======================================== */
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE_THIN : BlockFaceShape.CENTER_SMALL;
@@ -0,0 +1,45 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -241,7 +241,7 @@
}
}
- if (!flag1 && iblockstate.func_185904_a() != Material.field_151579_a && func_185646_a(iblockstate, p_189539_2_, blockpos, enumfacing.func_176734_d(), false, enumfacing) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.field_150331_J || block == Blocks.field_150320_F))
+ if (!flag1 && !iblockstate.func_177230_c().isAir(iblockstate, p_189539_2_, blockpos) && func_185646_a(iblockstate, p_189539_2_, blockpos, enumfacing.func_176734_d(), false, enumfacing) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.field_150331_J || block == Blocks.field_150320_F))
{
this.func_176319_a(p_189539_2_, p_189539_3_, enumfacing, false);
}
@@ -307,7 +307,7 @@
return false;
}
- return !block.func_149716_u();
+ return !block.hasTileEntity(p_185646_0_);
}
else
{
@@ -353,7 +353,9 @@
{
BlockPos blockpos1 = list2.get(j);
IBlockState iblockstate = p_176319_1_.func_180495_p(blockpos1);
- iblockstate.func_177230_c().func_176226_b(p_176319_1_, blockpos1, iblockstate, 0);
+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = iblockstate.func_177230_c() instanceof BlockSnow ? -1.0f : 1.0f;
+ iblockstate.func_177230_c().func_180653_a(p_176319_1_, blockpos1, iblockstate, chance, 0);
p_176319_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 4);
--k;
aiblockstate[k] = iblockstate;
@@ -434,6 +436,13 @@
return new BlockStateContainer(this, new IProperty[] {field_176387_N, field_176320_b});
}
+ /* ======================================== FORGE START =====================================*/
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ return !state.func_177229_b(field_176320_b) && super.rotateBlock(world, pos, axis);
+ }
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
p_193383_2_ = this.func_176221_a(p_193383_2_, p_193383_1_, p_193383_3_);
@@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java
@@ -116,7 +116,7 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- if (!p_180653_1_.field_72995_K)
+ if (false && !p_180653_1_.field_72995_K) // Forge: Noop this out
{
TileEntityPiston tileentitypiston = this.func_185589_c(p_180653_1_, p_180653_2_);
@@ -126,6 +126,7 @@
iblockstate.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate, 0);
}
}
+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, 1, p_180653_5_); // mimic vanilla behavior from above and ignore chance
}
@Nullable
@@ -210,6 +211,17 @@
return new BlockStateContainer(this, new IProperty[] {field_176426_a, field_176425_b});
}
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos);
+ if (tileentitypiston != null)
+ {
+ IBlockState pushed = tileentitypiston.func_174927_b();
+ drops.addAll(pushed.func_177230_c().getDrops(world, pos, pushed, fortune)); // use the old method until it gets removed, for backward compatibility
+ }
+ }
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;
@@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPortal.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPortal.java
@@ -111,7 +111,7 @@
{
BlockPortal.Size blockportal$size = new BlockPortal.Size(p_176548_1_, p_176548_2_, EnumFacing.Axis.X);
- if (blockportal$size.func_150860_b() && blockportal$size.field_150864_e == 0)
+ if (blockportal$size.func_150860_b() && blockportal$size.field_150864_e == 0 && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, blockportal$size))
{
blockportal$size.func_150859_c();
return true;
@@ -120,7 +120,7 @@
{
BlockPortal.Size blockportal$size1 = new BlockPortal.Size(p_176548_1_, p_176548_2_, EnumFacing.Axis.Z);
- if (blockportal$size1.func_150860_b() && blockportal$size1.field_150864_e == 0)
+ if (blockportal$size1.func_150860_b() && blockportal$size1.field_150864_e == 0 && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, blockportal$size1))
{
blockportal$size1.func_150859_c();
return true;
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java
@@ -27,7 +27,7 @@
{
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
- if (!p_180653_1_.field_72995_K)
+ if (false && !p_180653_1_.field_72995_K) //Forge: Moved to getDrops
{
if (this.func_185525_y(p_180653_3_) && p_180653_1_.field_73012_v.nextInt(50) == 0)
{
@@ -40,4 +40,12 @@
{
return field_185534_a[((Integer)p_185496_1_.func_177229_b(this.func_185524_e())).intValue()];
}
+
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ super.getDrops(drops, world, pos, state, fortune);
+ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0)
+ drops.add(new ItemStack(Items.field_151170_bI));
+ }
}
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
@@ -136,7 +136,7 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j() && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q();
+ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_) && p_176196_1_.isSideSolid(p_176196_2_.func_177977_b(), EnumFacing.UP);
}
public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_)
@@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java
+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java
@@ -108,6 +108,26 @@
return new BlockStateContainer(this, new IProperty[] {field_176335_a});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : state.func_177228_b().keySet())
+ {
+ if (prop.func_177701_a().equals("variant") && prop.func_177699_b() == EnumType.class)
+ {
+ EnumType current = (EnumType)state.func_177229_b(prop);
+ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y :
+ current == EnumType.LINES_Y ? EnumType.LINES_Z :
+ current == EnumType.LINES_Z ? EnumType.LINES_X : current;
+ if (next == current)
+ return false;
+ world.func_175656_a(pos, state.func_177226_a(prop, next));
+ return true;
+ }
+ }
+ return false;
+ }
+
public static enum EnumType implements IStringSerializable
{
DEFAULT(0, "default", "default"),
@@ -0,0 +1,237 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java
@@ -34,7 +34,7 @@
public static boolean func_176563_d(IBlockState p_176563_0_)
{
Block block = p_176563_0_.func_177230_c();
- return block == Blocks.field_150448_aq || block == Blocks.field_150318_D || block == Blocks.field_150319_E || block == Blocks.field_150408_cc;
+ return block instanceof BlockRailBase;
}
protected BlockRailBase(boolean p_i45389_1_)
@@ -57,7 +57,7 @@
public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_)
{
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = p_185496_1_.func_177230_c() == this ? (BlockRailBase.EnumRailDirection)p_185496_1_.func_177229_b(this.func_176560_l()) : null;
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = p_185496_1_.func_177230_c() == this ? getRailDirection(p_185496_2_, p_185496_3_, p_185496_1_, null) : null;
return blockrailbase$enumraildirection != null && blockrailbase$enumraildirection.func_177018_c() ? field_190959_b : field_185590_a;
}
@@ -73,7 +73,7 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q();
+ return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).isSideSolid(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP);
}
public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_)
@@ -93,32 +93,33 @@
{
if (!p_189540_2_.field_72995_K)
{
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_189540_1_.func_177229_b(this.func_176560_l());
+ final IBlockState currentState = p_189540_2_.func_180495_p(p_189540_3_);
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = getRailDirection(p_189540_2_, p_189540_3_, currentState.func_177230_c() == this ? currentState : p_189540_1_, null);
boolean flag = false;
- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q())
+ if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).isSideSolid(p_189540_2_, p_189540_3_.func_177977_b(), EnumFacing.UP))
{
flag = true;
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_185896_q())
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).isSideSolid(p_189540_2_, p_189540_3_.func_177974_f(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).isSideSolid(p_189540_2_, p_189540_3_.func_177976_e(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).isSideSolid(p_189540_2_, p_189540_3_.func_177978_c(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).isSideSolid(p_189540_2_, p_189540_3_.func_177968_d(), EnumFacing.UP))
{
flag = true;
}
- if (flag && !p_189540_2_.func_175623_d(p_189540_3_))
+ if (flag && !currentState.func_177230_c().isAir(currentState, p_189540_2_, p_189540_3_))
{
this.func_176226_b(p_189540_2_, p_189540_3_, p_189540_1_, 0);
p_189540_2_.func_175698_g(p_189540_3_);
@@ -154,7 +155,7 @@
{
super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_);
- if (((BlockRailBase.EnumRailDirection)p_180663_3_.func_177229_b(this.func_176560_l())).func_177018_c())
+ if (getRailDirection(p_180663_1_, p_180663_2_, p_180663_3_, null).func_177018_c())
{
p_180663_1_.func_175685_c(p_180663_2_.func_177984_a(), this, false);
}
@@ -166,8 +167,101 @@
}
}
+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract IProperty<BlockRailBase.EnumRailDirection> func_176560_l();
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos)
+ {
+ return !this.field_150053_a;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos)
+ {
+ return true;
+ }
+
+ /**
+ * Return the rail's direction.
+ * Can be used to make the cart think the rail is a different shape,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * @param world The world.
+ * @param pos Block's position in world
+ * @param state The BlockState
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @return The direction.
+ */
+ public EnumRailDirection getRailDirection(IBlockAccess world, BlockPos pos, IBlockState state, @javax.annotation.Nullable net.minecraft.entity.item.EntityMinecart cart)
+ {
+ return state.func_177229_b(func_176560_l());
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param pos Block's position in world
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
+ {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param pos Block's position in world
+ */
+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
+ {
+ }
+
+ /**
+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit).
+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the
+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations.
+ * The method should return true if the rotation was successful though.
+ *
+ * @param world The world
+ * @param pos Block position in world
+ * @param axis The axis to rotate around
+ * @return True if the rotation was successful, False if the rotation failed, or is not possible
+ */
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : state.func_177228_b().keySet())
+ {
+ if (prop.func_177701_a().equals("shape"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /* ======================================== FORGE END =====================================*/
+
public static enum EnumRailDirection implements IStringSerializable
{
NORTH_SOUTH(0, "north_south"),
@@ -238,6 +332,7 @@
private IBlockState field_180366_e;
private final boolean field_150656_f;
private final List<BlockPos> field_150657_g = Lists.<BlockPos>newArrayList();
+ private final boolean canMakeSlopes;
public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_)
{
@@ -245,8 +340,9 @@
this.field_180367_c = p_i45739_3_;
this.field_180366_e = p_i45739_4_;
this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c();
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(this.field_180365_d.func_176560_l());
- this.field_150656_f = this.field_180365_d.field_150053_a;
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = field_180365_d.getRailDirection(p_i45739_2_, p_i45739_3_, p_i45739_4_, null);
+ this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_);
+ this.canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_);
this.func_180360_a(blockrailbase$enumraildirection);
}
@@ -438,7 +534,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
{
@@ -451,7 +547,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
{
@@ -594,7 +690,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
{
@@ -607,7 +703,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
{
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailDetector.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailDetector.java
@@ -163,6 +163,8 @@
{
if (((Boolean)p_180641_1_.func_177229_b(field_176574_M)).booleanValue())
{
+ List<EntityMinecart> carts = this.func_176571_a(p_180641_2_, p_180641_3_, EntityMinecart.class);
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
List<EntityMinecartCommandBlock> list = this.<EntityMinecartCommandBlock>func_176571_a(p_180641_2_, p_180641_3_, EntityMinecartCommandBlock.class);
if (!list.isEmpty())
@@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailPowered.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailPowered.java
@@ -23,9 +23,17 @@
});
public static final PropertyBool field_176569_M = PropertyBool.func_177716_a("powered");
+ private final boolean isActivator;
+
protected BlockRailPowered()
{
+ this(false);
+ }
+
+ protected BlockRailPowered(boolean isActivator)
+ {
super(true);
+ this.isActivator = isActivator;
this.func_180632_j(this.field_176227_L.func_177621_b().func_177226_a(field_176568_b, BlockRailBase.EnumRailDirection.NORTH_SOUTH).func_177226_a(field_176569_M, Boolean.valueOf(false)));
}
@@ -146,7 +154,7 @@
{
IBlockState iblockstate = p_176567_1_.func_180495_p(p_176567_2_);
- if (iblockstate.func_177230_c() != this)
+ if (!(iblockstate.func_177230_c() instanceof BlockRailPowered) || isActivator != ((BlockRailPowered)iblockstate.func_177230_c()).isActivator)
{
return false;
}
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java
@@ -319,6 +319,21 @@
return this.func_176223_P().func_177226_a(field_185512_D, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE);
}
+ @Override
+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor)
+ {
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World) world).field_72995_K)
+ {
+ func_189540_a(world.func_180495_p(pos), (World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor);
+ }
+ }
+
+ @Override
+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos)
+ {
+ return true;
+ }
+
public static enum Mode implements IStringSerializable
{
COMPARE("compare"),
@@ -0,0 +1,54 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java
@@ -39,12 +39,14 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q() ? super.func_176196_c(p_176196_1_, p_176196_2_) : false;
+ IBlockState downState = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ return (downState.func_185896_q() || downState.func_193401_d(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID) ? super.func_176196_c(p_176196_1_, p_176196_2_) : false;
}
public boolean func_176409_d(World p_176409_1_, BlockPos p_176409_2_)
{
- return p_176409_1_.func_180495_p(p_176409_2_.func_177977_b()).func_185896_q();
+ IBlockState downState = p_176409_1_.func_180495_p(p_176409_2_.func_177977_b());
+ return downState.func_185896_q() || downState.func_193401_d(p_176409_1_, p_176409_2_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
}
public void func_180645_a(World p_180645_1_, BlockPos p_180645_2_, IBlockState p_180645_3_, Random p_180645_4_)
@@ -227,6 +229,8 @@
{
EnumFacing enumfacing = (EnumFacing)p_176400_3_.func_177229_b(field_185512_D);
BlockPos blockpos = p_176400_2_.func_177972_a(enumfacing.func_176734_d());
+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(enumfacing.func_176734_d()), false).isCanceled())
+ return;
p_176400_1_.func_190524_a(blockpos, this, p_176400_2_);
p_176400_1_.func_175695_a(blockpos, this, enumfacing);
}
@@ -307,6 +311,25 @@
return BlockRenderLayer.CUTOUT;
}
+ /* ======================================== FORGE START =====================================*/
+ @Override
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ if (super.rotateBlock(world, pos, axis))
+ {
+ IBlockState state = world.func_180495_p(pos);
+ state = func_180675_k(state);
+ world.func_175656_a(pos, state);
+
+ if (func_176404_e(world, pos, state))
+ {
+ world.func_175684_a(pos, this, 1);
+ }
+ return true;
+ }
+ return false;
+ }
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return p_193383_4_ == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
@@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java
@@ -92,12 +92,16 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
+ }
- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this))
+ @Override
+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ if (this.func_180660_a(state, RANDOM, fortune) != Item.func_150898_a(this))
{
- int i = 1 + p_180653_1_.field_73012_v.nextInt(5);
- this.func_180637_b(p_180653_1_, p_180653_2_, i);
+ return 1 + RANDOM.nextInt(5);
}
+ return 0;
}
@SideOnly(Side.CLIENT)
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneTorch.java
@@ -23,7 +23,7 @@
public class BlockRedstoneTorch extends BlockTorch
{
- private static final Map<World, List<BlockRedstoneTorch.Toggle>> field_150112_b = Maps.<World, List<BlockRedstoneTorch.Toggle>>newHashMap();
+ private static final Map<World, List<BlockRedstoneTorch.Toggle>> field_150112_b = new java.util.WeakHashMap<World, List<Toggle>>(); // FORGE - fix vanilla MC-101233
private final boolean field_150113_a;
private boolean func_176598_a(World p_176598_1_, BlockPos p_176598_2_, boolean p_176598_3_)
@@ -0,0 +1,68 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -99,15 +99,15 @@
BlockPos blockpos = p_176341_2_.func_177972_a(p_176341_3_);
IBlockState iblockstate = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_));
- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos), p_176341_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177977_b()))))
+ if (!canConnectTo(p_176341_1_.func_180495_p(blockpos), p_176341_3_, p_176341_1_, blockpos) && (iblockstate.func_185915_l() || !func_176340_e(p_176341_1_, blockpos.func_177977_b())))
{
IBlockState iblockstate1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a());
if (!iblockstate1.func_185915_l())
{
- boolean flag = p_176341_1_.func_180495_p(blockpos).func_185896_q() || p_176341_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN;
+ boolean flag = p_176341_1_.func_180495_p(blockpos).isSideSolid(p_176341_1_, blockpos, EnumFacing.UP) || p_176341_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN;
- if (flag && func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177984_a())))
+ if (flag && func_176340_e(p_176341_1_, blockpos.func_177984_a()))
{
if (iblockstate.func_185898_k())
{
@@ -144,7 +144,8 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q() || p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c() == Blocks.field_150426_aN;
+ IBlockState downState = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ return downState.func_185896_q() || downState.func_193401_d(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID || p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c() == Blocks.field_150426_aN;
}
private IBlockState func_176338_e(World p_176338_1_, BlockPos p_176338_2_, IBlockState p_176338_3_)
@@ -414,7 +415,7 @@
{
return true;
}
- else if (func_176343_a(iblockstate, p_176339_3_))
+ else if (canConnectTo(iblockstate, p_176339_3_, p_176339_1_, p_176339_2_))
{
return true;
}
@@ -430,16 +431,11 @@
protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_)
{
- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_));
+ return canConnectTo(p_176340_0_.func_180495_p(p_176340_1_), null, p_176340_0_, p_176340_1_);
}
- protected static boolean func_176346_d(IBlockState p_176346_0_)
+ protected static boolean canConnectTo(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_, IBlockAccess world, BlockPos pos)
{
- return func_176343_a(p_176346_0_, (EnumFacing)null);
- }
-
- protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_)
- {
Block block = p_176343_0_.func_177230_c();
if (block == Blocks.field_150488_af)
@@ -457,7 +453,7 @@
}
else
{
- return p_176343_0_.func_185897_m() && p_176343_1_ != null;
+ return p_176343_0_.func_177230_c().canConnectRedstone(p_176343_0_, world, pos, p_176343_1_);
}
}
@@ -0,0 +1,58 @@
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
@@ -21,7 +21,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockReed extends Block
+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15);
protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D);
@@ -55,6 +55,8 @@
{
int j = ((Integer)p_180650_3_.func_177229_b(field_176355_a)).intValue();
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, p_180650_2_, p_180650_3_, true))
+ {
if (j == 15)
{
p_180650_1_.func_175656_a(p_180650_2_.func_177984_a(), this.func_176223_P());
@@ -64,6 +66,8 @@
{
p_180650_1_.func_180501_a(p_180650_2_, p_180650_3_.func_177226_a(field_176355_a, Integer.valueOf(j + 1)), 4);
}
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
+ }
}
}
}
@@ -71,7 +75,9 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c();
+ IBlockState state = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ Block block = state.func_177230_c();
+ if (block.canSustainPlant(state, p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP, this)) return true;
if (block == this)
{
@@ -165,6 +171,17 @@
return ((Integer)p_176201_1_.func_177229_b(field_176355_a)).intValue();
}
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
+ {
+ return net.minecraftforge.common.EnumPlantType.Beach;
+ }
+ @Override
+ public IBlockState getPlant(IBlockAccess world, BlockPos pos)
+ {
+ return this.func_176223_P();
+ }
+
protected BlockStateContainer func_180661_e()
{
return new BlockStateContainer(this, new IProperty[] {field_176355_a});
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java
@@ -28,6 +28,21 @@
super(p_i46385_1_, p_i46385_2_);
}
+ @Override
+ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis)
+ {
+ net.minecraft.block.state.IBlockState state = world.func_180495_p(pos);
+ for (net.minecraft.block.properties.IProperty<?> prop : state.func_177228_b().keySet())
+ {
+ if (prop.func_177701_a().equals("axis"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_)
{
switch (p_185499_2_)
@@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java
@@ -53,6 +53,7 @@
{
super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_);
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) >= 9 && p_180650_4_.nextInt(7) == 0)
{
this.func_176478_d(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_);
@@ -74,6 +75,7 @@
public void func_176476_e(World p_176476_1_, BlockPos p_176476_2_, IBlockState p_176476_3_, Random p_176476_4_)
{
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_176476_1_, p_176476_4_, p_176476_2_)) return;
WorldGenerator worldgenerator = (WorldGenerator)(p_176476_4_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true));
int i = 0;
int j = 0;
@@ -0,0 +1,54 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
@@ -128,10 +128,6 @@
return new ItemStack(Items.field_151144_bL, 1, i);
}
- public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
- {
- }
-
public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_)
{
if (p_176208_4_.field_71075_bZ.field_75098_d)
@@ -139,13 +135,17 @@
p_176208_3_ = p_176208_3_.func_177226_a(field_176417_b, Boolean.valueOf(true));
p_176208_1_.func_180501_a(p_176208_2_, p_176208_3_, 4);
}
+ this.func_176226_b(p_176208_1_, p_176208_2_, p_176208_3_, 0);
super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_)
{
- if (!p_180663_1_.field_72995_K)
+ super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_);
+ }
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_, int fortune)
+ {
{
if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue())
{
@@ -154,7 +154,7 @@
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
- ItemStack itemstack = this.func_185473_a(p_180663_1_, p_180663_2_, p_180663_3_);
+ ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, tileentityskull.func_145904_a());
if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null)
{
@@ -164,11 +164,9 @@
itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound);
}
- func_180635_a(p_180663_1_, p_180663_2_, itemstack);
+ drops.add(itemstack);
}
}
-
- super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_);
}
}
@@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSlab.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java
@@ -80,6 +80,19 @@
return this.func_176552_j();
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
+ return super.doesSideBlockRendering(state, world, pos, face);
+
+ if ( state.func_185914_p() )
+ return true;
+
+ EnumBlockHalf side = state.func_177229_b(field_176554_a);
+ return (side == EnumBlockHalf.TOP && face == EnumFacing.UP) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.DOWN);
+ }
+
public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_)
{
IBlockState iblockstate = super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176554_a, BlockSlab.EnumBlockHalf.BOTTOM);
@@ -115,7 +128,7 @@
{
return false;
}
- else
+ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful.
{
IBlockState iblockstate = p_176225_2_.func_180495_p(p_176225_3_.func_177972_a(p_176225_4_));
boolean flag = func_185675_i(iblockstate) && iblockstate.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP;
@@ -149,6 +162,7 @@
return !func_185675_i(iblockstate) || flag;
}
}
+ return super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_, p_176225_4_);
}
@SideOnly(Side.CLIENT)
@@ -0,0 +1,55 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -85,7 +85,7 @@
if (block != Blocks.field_150432_aD && block != Blocks.field_150403_cj && block != Blocks.field_180401_cv)
{
BlockFaceShape blockfaceshape = iblockstate.func_193401_d(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP);
- return blockfaceshape == BlockFaceShape.SOLID || iblockstate.func_185904_a() == Material.field_151584_j || block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 8;
+ return blockfaceshape == BlockFaceShape.SOLID || iblockstate.func_177230_c().isLeaves(iblockstate, p_176196_1_, p_176196_2_.func_177977_b()) || block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 8;
}
else
{
@@ -102,7 +102,6 @@
{
if (!this.func_176196_c(p_176314_1_, p_176314_2_))
{
- this.func_176226_b(p_176314_1_, p_176314_2_, p_176314_3_, 0);
p_176314_1_.func_175698_g(p_176314_2_);
return false;
}
@@ -114,9 +113,8 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_)
{
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, ((Integer)p_180657_4_.func_177229_b(field_176315_a)).intValue() + 1, 0));
+ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
p_180657_1_.func_175698_g(p_180657_3_);
- p_180657_2_.func_71029_a(StatList.func_188055_a(this));
}
public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_)
@@ -126,14 +124,13 @@
public int func_149745_a(Random p_149745_1_)
{
- return 0;
+ return 1;
}
public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_)
{
if (p_180650_1_.func_175642_b(EnumSkyBlock.BLOCK, p_180650_2_) > 11)
{
- this.func_176226_b(p_180650_1_, p_180650_2_, p_180650_1_.func_180495_p(p_180650_2_), 0);
p_180650_1_.func_175698_g(p_180650_2_);
}
}
@@ -167,6 +164,8 @@
return ((Integer)p_176201_1_.func_177229_b(field_176315_a)).intValue() - 1;
}
+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.func_177229_b(field_176315_a)) + 1; }
+
protected BlockStateContainer func_180661_e()
{
return new BlockStateContainer(this, new IProperty[] {field_176315_a});
@@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStairs.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java
@@ -483,6 +483,29 @@
return new BlockStateContainer(this, new IProperty[] {field_176309_a, field_176308_b, field_176310_M});
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
+ return super.doesSideBlockRendering(state, world, pos, face);
+
+ if ( state.func_185914_p() )
+ return true;
+
+ state = this.func_176221_a(state, world, pos);
+
+ EnumHalf half = state.func_177229_b(field_176308_b);
+ EnumFacing side = state.func_177229_b(field_176309_a);
+ EnumShape shape = state.func_177229_b(field_176310_M);
+ if (face == EnumFacing.UP) return half == EnumHalf.TOP;
+ if (face == EnumFacing.DOWN) return half == EnumHalf.BOTTOM;
+ if (shape == EnumShape.OUTER_LEFT || shape == EnumShape.OUTER_RIGHT) return false;
+ if (face == side) return true;
+ if (shape == EnumShape.INNER_LEFT && face.func_176746_e() == side) return true;
+ if (shape == EnumShape.INNER_RIGHT && face.func_176735_f() == side) return true;
+ return false;
+ }
+
public static enum EnumHalf implements IStringSerializable
{
TOP("top"),
@@ -1,26 +0,0 @@
--- a/net/minecraft/block/BlockState.java
+++ b/net/minecraft/block/BlockState.java
@@ -51,7 +51,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class BlockState extends StateHolder<Block, BlockState> implements IStateHolder<BlockState> {
+public class BlockState extends StateHolder<Block, BlockState> implements IStateHolder<BlockState>, net.minecraftforge.common.extensions.IForgeBlockState {
@Nullable
private BlockState.Cache field_215707_c;
private final int field_215708_d;
@@ -107,10 +107,14 @@
return this.field_215708_d;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
public boolean func_196958_f() {
return this.func_177230_c().func_196261_e(this);
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
+ @Deprecated
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_);
}
@@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java
@@ -52,22 +52,22 @@
{
blockpos = blockpos.func_177982_a(p_180650_4_.nextInt(3) - 1, 1, p_180650_4_.nextInt(3) - 1);
- if (blockpos.func_177956_o() >= 0 && blockpos.func_177956_o() < 256 && !p_180650_1_.func_175667_e(blockpos))
+ if (blockpos.func_177956_o() >= 0 && blockpos.func_177956_o() < p_180650_1_.func_72800_K() && !p_180650_1_.func_175667_e(blockpos))
{
return;
}
- Block block = p_180650_1_.func_180495_p(blockpos).func_177230_c();
+ IBlockState block = p_180650_1_.func_180495_p(blockpos);
- if (block.field_149764_J == Material.field_151579_a)
+ if (block.func_177230_c().isAir(block, p_180650_1_, blockpos))
{
if (this.func_176369_e(p_180650_1_, blockpos))
{
- p_180650_1_.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P());
+ p_180650_1_.func_175656_a(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_180650_1_, blockpos, p_180650_2_, Blocks.field_150480_ab.func_176223_P()));
return;
}
}
- else if (block.field_149764_J.func_76230_c())
+ else if (block.func_185904_a().func_76230_c())
{
return;
}
@@ -86,7 +86,7 @@
if (p_180650_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_180650_1_, blockpos1))
{
- p_180650_1_.func_175656_a(blockpos1.func_177984_a(), Blocks.field_150480_ab.func_176223_P());
+ p_180650_1_.func_175656_a(blockpos1.func_177984_a(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_180650_1_, blockpos1.func_177984_a(), p_180650_2_, Blocks.field_150480_ab.func_176223_P()));
}
}
}
@@ -0,0 +1,71 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -66,18 +66,19 @@
{
super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_);
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) >= 9)
{
float f = BlockCrops.func_180672_a(this, p_180650_1_, p_180650_2_);
- if (p_180650_4_.nextInt((int)(25.0F / f) + 1) == 0)
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_.nextInt((int)(25.0F / f) + 1) == 0))
{
int i = ((Integer)p_180650_3_.func_177229_b(field_176484_a)).intValue();
if (i < 7)
{
- p_180650_3_ = p_180650_3_.func_177226_a(field_176484_a, Integer.valueOf(i + 1));
- p_180650_1_.func_180501_a(p_180650_2_, p_180650_3_, 2);
+ IBlockState newState = p_180650_3_.func_177226_a(field_176484_a, Integer.valueOf(i + 1));
+ p_180650_1_.func_180501_a(p_180650_2_, newState, 2);
}
else
{
@@ -90,13 +91,15 @@
}
p_180650_2_ = p_180650_2_.func_177972_a(EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180650_4_));
- Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c();
+ IBlockState soil = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b());
+ Block block = soil.func_177230_c();
- if (p_180650_1_.func_180495_p(p_180650_2_).func_177230_c().field_149764_J == Material.field_151579_a && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_150349_c))
+ if (p_180650_1_.func_175623_d(p_180650_2_) && (block.canSustainPlant(soil, p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c))
{
p_180650_1_.func_175656_a(p_180650_2_, this.field_149877_a.func_176223_P());
}
}
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_1_.func_180495_p(p_180650_2_));
}
}
}
@@ -110,20 +113,23 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
+ }
- if (!p_180653_1_.field_72995_K)
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
{
Item item = this.func_176481_j();
if (item != null)
{
- int i = ((Integer)p_180653_3_.func_177229_b(field_176484_a)).intValue();
+ int i = ((Integer)state.func_177229_b(field_176484_a)).intValue();
for (int j = 0; j < 3; ++j)
{
- if (p_180653_1_.field_73012_v.nextInt(15) <= i)
+ if (RANDOM.nextInt(15) <= i)
{
- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item));
+ drops.add(new ItemStack(item));
}
}
}
@@ -0,0 +1,49 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java
@@ -22,7 +22,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockTallGrass extends BlockBush implements IGrowable
+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
{
public static final PropertyEnum<BlockTallGrass.EnumType> field_176497_a = PropertyEnum.<BlockTallGrass.EnumType>func_177709_a("type", BlockTallGrass.EnumType.class);
protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -40,7 +40,7 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
- return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()));
+ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_);
}
public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_)
@@ -50,7 +50,7 @@
public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_)
{
- return p_180660_2_.nextInt(8) == 0 ? Items.field_151014_N : Items.field_190931_a;
+ return null;
}
public int func_149679_a(int p_149679_1_, Random p_149679_2_)
@@ -178,4 +178,19 @@
}
}
}
+
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public NonNullList<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return NonNullList.func_191197_a(1, new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)world.func_180495_p(pos).func_177229_b(field_176497_a)).func_177044_a()));
+ }
+ @Override
+ public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ if (RANDOM.nextInt(8) != 0) return;
+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM, fortune);
+ if (!seed.func_190926_b())
+ drops.add(seed);
+ }
}
@@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java
@@ -82,18 +82,8 @@
private boolean func_176594_d(World p_176594_1_, BlockPos p_176594_2_)
{
- Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c();
- boolean flag = block == Blocks.field_185775_db || block == Blocks.field_150428_aP;
-
- if (p_176594_1_.func_180495_p(p_176594_2_).func_185896_q())
- {
- return !flag;
- }
- else
- {
- boolean flag1 = block instanceof BlockFence || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_150399_cn;
- return flag1 && !flag;
- }
+ IBlockState state = p_176594_1_.func_180495_p(p_176594_2_);
+ return state.func_177230_c().canPlaceTorchOnTop(state, p_176594_1_, p_176594_2_);
}
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
@@ -0,0 +1,21 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java
@@ -250,6 +250,18 @@
return (p_193383_4_ == EnumFacing.UP && p_193383_2_.func_177229_b(field_176285_M) == BlockTrapDoor.DoorHalf.TOP || p_193383_4_ == EnumFacing.DOWN && p_193383_2_.func_177229_b(field_176285_M) == BlockTrapDoor.DoorHalf.BOTTOM) && !((Boolean)p_193383_2_.func_177229_b(field_176283_b)).booleanValue() ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
+ @Override
+ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity)
+ {
+ if (state.func_177229_b(field_176283_b))
+ {
+ IBlockState down = world.func_180495_p(pos.func_177977_b());
+ if (down.func_177230_c() == net.minecraft.init.Blocks.field_150468_ap)
+ return down.func_177229_b(BlockLadder.field_176382_a) == state.func_177229_b(field_176284_a);
+ }
+ return false;
+ }
+
public static enum DoorHalf implements IStringSerializable
{
TOP("top"),
@@ -0,0 +1,47 @@
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
@@ -28,7 +28,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockVine extends Block
+public class BlockVine extends Block implements net.minecraftforge.common.IShearable
{
public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up");
public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north");
@@ -185,7 +185,7 @@
{
if (!p_180650_1_.field_72995_K)
{
- if (p_180650_1_.field_73012_v.nextInt(4) == 0)
+ if (p_180650_1_.field_73012_v.nextInt(4) == 0 && p_180650_1_.func_175697_a(p_180650_2_, 4)) // Forge: check area to prevent loading unloaded chunks
{
int i = 4;
int j = 5;
@@ -244,7 +244,7 @@
IBlockState iblockstate3 = p_180650_1_.func_180495_p(blockpos4);
Block block1 = iblockstate3.func_177230_c();
- if (block1.field_149764_J == Material.field_151579_a)
+ if (block1.isAir(iblockstate3, p_180650_1_, blockpos4))
{
EnumFacing enumfacing3 = enumfacing1.func_176746_e();
EnumFacing enumfacing4 = enumfacing1.func_176735_f();
@@ -459,7 +459,17 @@
return i;
}
+ /*************************FORGE START***********************************/
+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; }
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(this, 1));
+ }
+ /*************************FORGE END***********************************/
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;
Loaded 100 of 2137 files, more files were not shown because too many files have changed in this diff. Show more