Compare commits

..
1 Commits
Author SHA1 Message Date
Space Toad 13af66b1ab tagged 1.0.1 2011-08-02 06:30:43 +00:00
2113 changed files with 1773 additions and 138267 deletions

No files matched your search

-23
View File
@@ -1,23 +0,0 @@
* text eol=lf
*.bat text eol=crlf
*.patch text eol=lf
*.java text eol=lf
*.gradle text eol=crlf
*.png binary
*.gif binary
*.exe binary
*.dll binary
*.jar binary
*.lzma binary
*.zip binary
*.pyd binary
*.cfg text eol=lf
*.py text eol=lf
*.jks binary
# Disable autocrlf on generated files, they always generate with LF
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
src/generated_test/**/.cache/cache text eol=lf
src/generated_test/**/*.json text eol=lf
-13
View File
@@ -1,13 +0,0 @@
---
name: Feature request
about: Want to request a feature?
title: ''
labels: Feature
assignees: ''
---
<!-- Please note, feature requests that are submitted as GitHub issues here are rarely implemented. -->
<!-- If you'd like to see something in Forge, you should be ready to implement it as a PR. -->
<!-- If you're not sure, open a Draft PR or discuss it in the Discord server. -->
<!-- Discord: https://discord.gg/UvedJ9m -->
-26
View File
@@ -1,26 +0,0 @@
---
name: Issue report
about: Visit the forum first for issues with crashes.
title: ''
labels: Triage
assignees: ''
---
<!-- Thank you for reporting! -->
<!-- For support with crashes and issues, please create a post on the forum instead: -->
<!-- https://www.minecraftforge.net/forum/forum/18-support-bug-reports/ -->
**Minecraft Version:** {Minecraft version}
**Forge Version:** {Forge version. *Version number, not latest/rb*}
**Logs:** {Link(s) to GitHub Gist with full latest.log and/or crash report}
**Steps to Reproduce:**
1. Do this
2. Then do that
3. ...
**Description of issue:**
-43
View File
@@ -1,43 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Label to use when marking as stale
staleLabel: Stale
# Comment to post when removing the stale label. Set to `false` to disable
unmarkComment: false
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 1
# Issues with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- Assigned
pulls:
# Number of days of inactivity before a Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale Pull Request is closed
daysUntilClose: 14
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This pull request has been automatically marked as stale because it has not had recent
activity, and will be closed if no further activity occurs. If this pull request was
overlooked, forgotten, or should remain open for any other reason, please reply
here to call attention to it and remove the stale status. Thank you for your contributions.
# Comment to post when closing a stale Pull Request. Set to `false` to disable
closeComment: >
This pull request has been automatically closed because it has not had
recent activity. Please feel free to update or reopen it.
issues:
# Number of days of inactivity before an Issue becomes stale
daysUntilStale: 180
# Number of days of inactivity before a stale Issue is closed
daysUntilClose: 14
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had activity
in a long time. If this issue is still relevant and should remain open, please reply
with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___."
or "Here's a screenshot of this issue on the latest version").
Thank you for your contributions!
# Comment to post when closing a stale Issue. Set to `false` to disable
closeComment: >
This issue has been automatically closed because it has not had
activity in a long time. Please feel free to reopen it or create a new issue.
-16
View File
@@ -1,16 +0,0 @@
# Configuration for support-requests - https://github.com/dessant/support-requests
# Label used to mark issues as support requests
supportLabel: Forum
# Comment to post on issues marked as support requests. Add a link
# to a support page, or set to `false` to disable
supportComment: >
👋 We use the issue tracker exclusively for final bug reports and feature requests.
However, this issue appears to be better suited for the
[Forge Support Forums](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/).
Please create a new topic on the support forum with this issue, and the conversation can
continue there.
# Whether to close issues marked as support requests
close: true
# Whether to lock issues marked as support requests
lock: true
-48
View File
@@ -1,48 +0,0 @@
#eclipse
**/bin
**/.settings
**/.classpath
*.project
#In case people make their workspace in the repo
/eclipse/
#idea
/.idea
/classes
*.iml
#gradle
/build
/.gradle
/mdk/.gradle
/mdk/build
#occupational hazards
/projects/mcp/
/projects/clean/
/projects/forge/
/projects/**/build/
/projects/**/out/
/projects/**/run/
/projects/**/*.launch
/repo/
src/generated/resources/.cache/
#Patch rejects
/patches-/
*.patch.rej
# FML changelog
changelog.txt
*.py
*.7z
/logs/
gradle.properties
!/mdk/gradle.properties
/projects/forge/rejects/
# Srg2Source causes import bugs on these patches. If you intentionnally change these, remove the ignore.
/patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch
/patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch
-65
View File
@@ -1,65 +0,0 @@
Minecraft Forge: Credits/Thank You
Forge is a set of tools and modifications to the Minecraft base game code to assist
mod developers in creating new and exciting content. It has been in development for
several years now, but I would like to take this time thank a few people who have
helped it along it's way.
First, the people who originally created the Forge projects way back in Minecraft
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
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
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.
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
sane as well as guiding the community into creating better additions to Forge.
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
I am a part}. For creating some of the core tools needed to make Minecraft modding
both possible, and as stable as can be.
On that note, here is some specific information of the MCP data we use:
* Minecraft Coder Pack (MCP) *
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
download components of MCP and distribute MCP data files. This permission is not
transitive and others wishing to redistribute the Minecraft Forge source independently
should seek permission of MCP or remove the MCP data files and request their users
to download MCP separately.
And lastly, the countless community members who have spent time submitting bug reports,
pull requests, and just helping out the community in general. Thank you.
--LexManos
=========================================================================
This is Forge Mod Loader.
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
and minecraft clients.
The code is authored by cpw.
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
http://www.minecraftforum.net/topic/75440-
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
http://www.minecraftforge.net/
Additionally, it contains an implementation of topological sort based on that
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
It also contains code from the Maven project for performing versioned dependency
resolution. http://maven.apache.org/
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
with credit to it's authors.
Forge Mod Loader downloads components from the Minecraft Coder Pack
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
Vendored
-103
View File
@@ -1,103 +0,0 @@
@Library('forge-shared-library')_
pipeline {
options {
disableConcurrentBuilds()
}
agent {
docker {
image 'gradle:jdk8'
args '-v forgegc:/home/gradle/.gradle/'
}
}
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('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
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
)
}
}
}
}
}
-16
View File
@@ -1,16 +0,0 @@
Minecraft Forge
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
License as published by the Free Software Foundation version 2.1
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
-520
View File
@@ -1,520 +0,0 @@
Unless noted below, Minecraft Forge, Forge Mod Loader, and all
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
A note on authorship:
All source artifacts are property of their original author, with
the exclusion of the contents of the patches directory and others
copied from it from time to time. Authorship of the contents of
the patches directory is retained by the Minecraft Forge project.
This is because the patches are partially machine generated
artifacts, and are changed heavily due to the way forge works.
Individual attribution within them is impossible.
Consent:
All contributions to Forge must consent to the release of any
patch content to the Forge project.
A note on infectivity:
The LGPL is chosen specifically so that projects may depend on Forge
features without being infected with its license. That is the
purpose of the LGPL. Mods and others using this code via ordinary
Java mechanics for referencing libraries are specifically not bound
by Forge's license for the Mod code.
=== MCP Data ===
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
from them. The license to MCP data is not transitive - distribution of this data by
third parties requires independent licensing from the MCP team. This data is not
redistributable without permission from the MCP team.
=== Sharing ===
I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of
the minecraft modding community. All contributions to these parts should be licensed under the same additional grant.
-- Runtime patcher --
License is granted to redistribute the runtime patcher code (src/main/java/net/minecraftforge/fml/common/patcher
and subdirectories) under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
-- ASM transformers --
License is granted to redistribute the ASM transformer code (src/main/java/net/minecraftforge/common/asm/ and subdirectories)
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
=========================================================================
This software includes portions from the Apache Maven project at
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
included based on guidelines at
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
with notices intact. The only change is a non-functional change of package name.
This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating
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.
=========================================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
-1074
View File
File diff suppressed because it is too large. Load diff
-2
View File
@@ -1,2 +0,0 @@
/.gradle/
/build/
-10
View File
@@ -1,10 +0,0 @@
repositories {
//mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
}
dependencies {
implementation 'org.ow2.asm:asm:7.2'
}
@@ -1,231 +0,0 @@
package net.minecraftforge.forge.tasks
import java.util.ArrayList
import java.util.TreeMap
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.Opcodes
public class CheckATs extends DefaultTask {
@InputFile File inheritance
@InputFiles File[] ats
@TaskAction
protected void exec() {
Util.init()
def parse = { line ->
def idx = line.indexOf('#')
def comment = idx == -1 ? null : line.substring(idx)
if (idx != -1) line = line.substring(0, idx - 1)
def (modifier, cls, desc) = (line.trim() + ' ').split(' ', -1)
def key = cls + (desc.isEmpty() ? '' : ' ' + desc)
return [modifier, cls, desc, comment, key]
}
def accessLevel = { access ->
if ((access & Opcodes.ACC_PUBLIC) != 0) return 3
if ((access & Opcodes.ACC_PROTECTED) != 0) return 2
if ((access & Opcodes.ACC_PRIVATE) != 0) return 0
return 1
}
def accessStr = { access ->
if (access.endsWith('-f') || access.endsWith('+f'))
return 4
switch (access.toLowerCase()) {
case 'public': return 3
case 'protected': return 2
case 'default': return 1
case 'private': return 0
default: return -1
}
}
def json = inheritance.json()
ats.each { f ->
TreeMap lines = [:]
def group = null
for (def line : f.readLines()) {
if (line.isEmpty()) continue
if (line.startsWith('#group ')) {
def (modifier, cls, desc, comment, key) = parse.call(line.substring(7))
if (!desc.equals('*') && !desc.equals('*()') && !desc.equals('<init>'))
throw new IllegalStateException('Invalid group: ' + line)
group = [modifier: modifier, cls: cls, desc: desc, comment: comment,
'existing': [] as Set,
'children': [] as TreeSet,
group: true
]
if (lines.containsKey(key))
throw new IllegalStateException('Duplicate group: ' + line)
lines[key] = group
} else if (group != null) {
if (line.startsWith('#endgroup')) {
group = null
} else {
def (modifier, cls, desc, comment, key) = parse.call(line)
group['existing'].add(key)
}
} else if (line.startsWith('#endgroup')) {
throw new IllegalStateException('Invalid group ending: ' + line)
} else if (line.startsWith('#')) {
//Nom
} else {
def (modifier, cls, desc, comment, key) = parse.call(line)
if (lines.containsKey(key)) {
println('Duplicate: ' + line)
continue
}
lines[key] = [modifier: modifier, cls: cls, desc: desc, comment: comment, group: false]
}
}
// Process Groups, this will remove any entries outside the group that is covered by the group
for (def key : new ArrayList<>(lines.keySet())) {
def entry = lines.get(key)
if (entry != null && entry['group']) {
def cls = entry['cls']
def jcls = json.get(cls.replaceAll('\\.', '/'))
if (jcls == null) {
lines.remove(key)
println('Invalid Group: ' + key)
} else if ('*'.equals(entry['desc'])) {
if (!jcls.containsKey('fields')) {
lines.remove(key)
println('Invalid Group, Class has no fields: ' + key)
} else {
jcls['fields'].each { field, value ->
def fkey = cls + ' ' + field
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
if (lines.containsKey(fkey)) {
lines.remove(fkey)
} else if (!entry['existing'].contains(fkey)) {
println('Added: ' + fkey)
}
entry['children'].add(fkey)
} else if (lines.containsKey(fkey)) {
lines.remove(fkey)
println('Removed: ' + fkey)
}
}
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
}
} else if ('*()'.equals(entry['desc'])) {
if (!jcls.containsKey('methods')) {
lines.remove(key)
println('Invalid Group, Class has no methods: ' + key)
} else {
jcls['methods'].each{ mtd, value ->
if (mtd.startsWith('<clinit>'))
return
key = cls + ' ' + mtd.replace(' ', '')
if (accessLevel.call(value['access']) < accessStr.call(entry['modifier'])) {
if (lines.containsKey(key)) {
lines.remove(key)
} else if (!entry['existing'].contains(key)) {
println('Added: ' + key)
}
entry['children'].add(key)
} else if (lines.containsKey(key)) {
lines.remove(key)
println('Removed: ' + key)
}
}
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
}
} else if ('<init>'.equals(entry['desc'])) { //Make all public non-abstract subclasses
json.each{ tcls,value ->
if (!value.containsKey('methods') || ((value['access'] & Opcodes.ACC_ABSTRACT) != 0))
return
def parents = [] as Set
def parent = tcls
while (parent != null && json.containsKey(parent)) {
parents.add(parent)
def p = json[parent]
parent = p == null ? null : p['superName']
}
if (parents.contains(cls.replaceAll('\\.', '/'))) {
value['methods'].each{ mtd, v ->
if (mtd.startsWith('<init>')) {
def child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
if (accessLevel.call(v['access']) < 3) {
if (lines.containsKey(child)) {
lines.remove(child)
} else if (!entry['existing'].contains(child)) {
println('Added: ' + child)
}
entry['children'].add(child)
} else if (lines.containsKey(child)) {
lines.remove(child)
println('Removed: ' + child)
}
}
}
}
}
entry['existing'].stream().findAll{ !entry['children'].contains(it) }.each{ println('Removed: ' + it) }
}
}
}
// Process normal lines, remove invalid and remove narrowing
for (def key : new ArrayList<>(lines.keySet())) {
def entry = lines.get(key)
if (entry != null && !entry['group']) {
def cls = entry['cls']
def jcls = json.get(cls.replaceAll('\\.', '/'))
if (jcls == null) {
lines.remove(key)
println('Invalid: ' + key)
} else if (entry['desc'] == '') {
if (accessLevel.call(jcls['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
lines.remove(key)
println('Invalid Narrowing: ' + key)
}
} else if (!entry['desc'].contains('(')) {
if (!jcls.containsKey('fields') || !jcls['fields'].containsKey(entry['desc'])) {
lines.remove(key)
println('Invalid: ' + key)
} else {
def value = jcls['fields'][entry['desc']]
if (accessLevel.call(value['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
lines.remove(key)
println('Invalid Narrowing: ' + key)
println(entry.comment)
}
}
} else {
def jdesc = entry['desc'].replace('(', ' (')
if (!jcls.containsKey('methods') || !jcls['methods'].containsKey(jdesc)) {
lines.remove(key)
println('Invalid: ' + key)
} else {
def value = jcls['methods'][jdesc]
if (accessLevel.call(value['access']) >= accessStr.call(entry['modifier']) && (entry.comment == null || !entry.comment.startsWith('#force '))) {
lines.remove(key)
println('Invalid Narrowing: ' + key)
}
}
}
}
}
def data = []
lines.each { key,value ->
if (!value.group) {
data.add(value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
} else {
data.add('#group ' + value.modifier + ' ' + key + (value.comment == null ? '' : ' ' + value.comment))
value.children.each{ data.add(value.modifier + ' ' + it) }
data.add('#endgroup')
}
}
f.text = data.join('\n')
}
}
}
@@ -1,95 +0,0 @@
package net.minecraftforge.forge.tasks
import java.util.ArrayList
import java.util.TreeMap
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.Type
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
public class CheckExcs extends DefaultTask {
@InputFile File binary
@InputFiles File[] excs
@TaskAction
protected void exec() {
Util.init()
def known = []
binary.withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
def visitor = new ClassVisitor(Opcodes.ASM7) {
private String cls
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.cls = name
}
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
known.add(this.cls + '.' + name + descriptor)
super.visitMethod(access, name, descriptor, signature, exceptions)
}
}
ZipEntry zein
while ((zein = zin.nextEntry) != null) {
if (zein.name.endsWith('.class')) {
ClassReader reader = new ClassReader(zin)
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
}
}
}
}
excs.each { f ->
def lines = []
f.eachLine { line ->
def idx = line.indexOf('#')
if (idx == 0 || line.isEmpty()) {
return
}
def comment = idx == -1 ? null : line.substring(idx)
if (idx != -1) line = line.substring(0, idx - 1)
if (!line.contains('=')) {
println('Invalid: ' + line)
return
}
def (key, value) = line.split('=', 2)
if (!known.contains(key)) {
println(key)
println('Invalid: ' + line)
return
}
def (cls, desc) = key.split('\\.', 2)
if (!desc.contains('(')) {
println('Invalid: ' + line)
return
}
def name = desc.split('\\(', 2)[0]
desc = '(' + desc.split('\\(', 2)[1]
def (exceptions, args) = value.contains('|') ? value.split('|', 2) : [value, '']
if (args.split(',').length != Type.getArgumentTypes(desc).length) {
println('Invalid: ' + line)
return
}
lines.add(line)
}
f.text = lines.sort().join('\n')
}
}
}
@@ -1,218 +0,0 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
import java.nio.file.Paths
import java.util.regex.Pattern
public class CheckPatches extends DefaultTask {
@InputDirectory File patchDir
@Input boolean autoFix = false
@TaskAction
protected void exec() {
def hasS2SArtifact = [
Paths.get("patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch"),
Paths.get("patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch")
]
def verified = true;
project.fileTree(patchDir).each { patch ->
def patchPath = project.rootDir.toPath().relativize(patch.toPath())
verified &= verifyPatch(patch, autoFix, patchPath.toString(), hasS2SArtifact.contains(patchPath))
}
if (!verified)
throw new RuntimeException('One or more patches failed verification. Check the log for errors.')
}
def verifyPatch(patch, fix, patchPath, hasS2SArtifact) {
def hunk_start_pattern = Pattern.compile('^@@ -[0-9,]* \\+[0-9,]* @@$')
def white_space_pattern = Pattern.compile('^[+\\-]\\s*$')
def import_pattern = Pattern.compile('^[+\\-]\\s*import.*')
def field_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
def method_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
def class_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
def accessMap = [("private"):0, (null):1, ("protected"):2, ("public"):3]
def hasProblem = false;
def lines = patch.readLines()
def hunksStart = 0
def onlyWhiteSpace = false
def didFix = false
def newLines = []
def whiteSpaceErrors = []
// First two lines are file name ++/-- and we do not care
newLines.add(lines[0] + '\n')
newLines.add(lines[1] + '\n')
int i = 2
for (; i < lines.size(); ++i) {
def line = lines[i]
newLines.add(line + '\n')
if (hunk_start_pattern.matcher(line).find()) {
if (onlyWhiteSpace) {
if (fix || hasS2SArtifact) {
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
def toRemove = i - hunksStart;
while (toRemove-- > 0)
newLines.remove(newLines.size() - 1)
didFix = true
}
else {
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
hasProblem = true
}
}
else {
if (!whiteSpaceErrors.empty)
hasProblem = true
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
whiteSpaceErrors.clear()
}
hunksStart = i
onlyWhiteSpace = true
continue
}
if (line.startsWithAny('+','-')) {
def prefixChange = false
def prevLine = lines[i - 1]
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
def currTrim = line.substring(1).replaceAll("\\s", "")
if (prevTrim.equals(currTrim)) {
prefixChange = true
}
def pMatcher = field_pattern.matcher(prevLine)
def cMatcher = field_pattern.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // = ...
pMatcher.group(5) == cMatcher.group(5) && // field name
pMatcher.group(3) == cMatcher.group(3) && // static
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
pMatcher = method_pattern.matcher(prevLine)
cMatcher = method_pattern.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // params
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
pMatcher.group(3) == cMatcher.group(3) && // static
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
pMatcher = class_pattern.matcher(prevLine)
cMatcher = class_pattern.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
pMatcher.group(5) == cMatcher.group(5) && // class | interface
pMatcher.group(3) == cMatcher.group(3) && // static
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
}
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
def nextLine = lines[i + 1]
if (nextLine.charAt(0) == (char)'+') {
def nextTrim = nextLine.substring(1).replaceAll("\\s", "")
def currTrim = line.substring(1).replaceAll("\\s", "")
if (nextTrim.equals(currTrim)) {
prefixChange = true
}
}
}
def isWhiteSpaceChange = white_space_pattern.matcher(line).find()
if (!prefixChange && !isWhiteSpaceChange) {
onlyWhiteSpace = hasS2SArtifact && import_pattern.matcher(line).find()
}
else if (isWhiteSpaceChange) {
def prevLineChange = prevLine.startsWithAny('+','-')
def nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
if (!prevLineChange && !nextLineChange) {
whiteSpaceErrors.add(String.format("Patch contains white space change in valid hunk at line %d (cannot auto fix), file: %s", i + 1, patchPath))
}
}
if (line.contains("\t")) {
if (!fix) {
logger.lifecycle("Patch contains tabs on line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
else {
logger.lifecycle("Fixing tabs on line {}, file: {}", i + 1, patchPath)
line = line.replaceAll('\t', ' ')
newLines.remove(newLines.size() - 1)
newLines.add(line + '\n')
didFix = true
}
}
if (import_pattern.matcher(line).find() && !hasS2SArtifact) {
logger.lifecycle("Patch contains import change on line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
}
}
if (onlyWhiteSpace) {
if (fix || hasS2SArtifact) {
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
def toRemove = i - hunksStart;
while (toRemove-- > 0)
newLines.remove(newLines.size() - 1)
didFix = true
}
else {
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
hasProblem = true
}
}
else {
if (!whiteSpaceErrors.empty)
hasProblem = true
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
}
if (didFix) {
if (newLines.size() <= 2) {
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
Files.delete(patch.toPath())
}
else {
if (!hasS2SArtifact)
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
patch.withWriter('UTF-8') { writer ->
newLines.each { l -> writer.write(l) }
}
}
}
return !hasProblem
}
}
@@ -1,64 +0,0 @@
package net.minecraftforge.forge.tasks
import java.util.ArrayList
import java.util.TreeMap
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.Opcodes
public class CheckSAS extends DefaultTask {
@InputFile File inheritance
@InputFiles File[] sass
@TaskAction
protected void exec() {
Util.init()
def json = inheritance.json()
sass.each { f ->
def lines = []
f.eachLine { line ->
if (line[0] == '\t') return //Skip any tabbed lines, those are ones we add
def idx = line.indexOf('#')
if (idx == 0 || line.isEmpty()) {
lines.add(line)
return
}
def comment = idx == -1 ? null : line.substring(idx)
if (idx != -1) line = line.substring(0, idx - 1)
def (cls, desc) = (line.trim() + ' ').split(' ', -1)
cls = cls.replaceAll('\\.', '/')
desc = desc.replace('(', ' (')
if (json[cls] == null || (!desc.isEmpty() && (json[cls]['methods'] == null || json[cls]['methods'][desc] == null))) {
println('Invalid: ' + line)
return
}
//Class SAS
if (desc.isEmpty()) {
lines.add(cls + (comment == null ? '' : ' ' + comment))
if (json[cls]['methods'] != null)
(json[cls]['methods'] as TreeMap).each {
findChildMethods(json, cls, it.key).each { lines.add('\t' + it) }
}
return
}
//Method SAS
lines.add(cls + ' ' + desc.replace(' ', '') + (comment == null ? '' : ' ' + comment))
findChildMethods(json, cls, desc).each { lines.add('\t' + it) }
}
f.text = lines.join('\n')
}
}
protected static findChildMethods(json, cls, desc)
{
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls}
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
}
}
@@ -1,65 +0,0 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
import java.net.URL
public class CrowdinTask extends DefaultTask {
@Input String id = 'minecraft-forge'
@Input @Optional String key
@Input boolean json = true
@OutputFile output = project.file("build/${name}/output.zip")
@OutputFile export = project.file("build/${name}/export.json")
CrowdinTask() {
outputs.upToDateWhen{ false }
}
@TaskAction
def run() {
if (output.exists())
output.delete()
if (key == null)
return
// Force an export
new URL("https://api.crowdin.com/api/project/${id}/export?key=${key}").withInputStream { i ->
export.withOutputStream { it << i }
}
if (!export.text.contains('success')) {
throw new RuntimeException("Crowdin export failed, see ${export} for more info")
}
new URL("https://api.crowdin.com/api/project/${id}/download/all.zip?key=${key}").withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
output.withOutputStream { out ->
new ZipOutputStream(out).withCloseable { zout ->
ZipEntry zein
while ((zein = zin.nextEntry) != null) {
if (zein.isDirectory()) {
zout.putNextEntry(new ZipEntry(zein.name))
} else {
// 1.13+ uses json
if (zein.name.endsWith('.json') == json) {
ZipEntry zeout = new ZipEntry(json ? zein.name.toLowerCase() : zein.name)
zeout.time = 1
zout.putNextEntry(zeout)
zout << zin
}
}
}
}
}
}
}
}
}
@@ -1,43 +0,0 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.OutputDirectory
import java.io.File
import java.util.HashSet
import java.util.Set
import java.net.URL
public class DownloadLibrariesTask extends DefaultTask {
@InputFile File input
@OutputDirectory File output = project.file("build/${name}/")
Set<File> libraries = new HashSet<>()
@TaskAction
def run() {
Util.init()
def json = input.json().libraries.each { lib ->
//TODO: Thread?
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
artifacts.each{ art ->
def target = new File(output, art.path)
libraries.add(target)
if (!target.exists() || !art.sha1.equals(target.sha1())) {
project.logger.lifecycle("Downloading ${art.url}")
if (!target.parentFile.exists()) {
target.parentFile.mkdirs()
}
new URL(art.url).withInputStream { i ->
target.withOutputStream { it << i }
}
if (!art.sha1.equals(target.sha1())) {
throw new IllegalStateException("Failed to download ${art.url} to ${target.canonicalPath} SHA Mismatch")
}
}
}
}
}
}
@@ -1,118 +0,0 @@
package net.minecraftforge.forge.tasks
import groovy.json.JsonSlurper
import java.io.File
import java.security.MessageDigest
import java.text.SimpleDateFormat
import java.util.Date
public class Util {
static void init() {
File.metaClass.sha1 = { ->
MessageDigest md = MessageDigest.getInstance('SHA-1')
delegate.eachByte 4096, {bytes, size ->
md.update(bytes, 0, size)
}
return md.digest().collect {String.format "%02x", it}.join()
}
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
Date.metaClass.iso8601 = { ->
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
def result = format.format(delegate)
return result[0..21] + ':' + result[22..-1]
}
}
public static String[] getClasspath(project, libs, artifact) {
def ret = []
artifactTree(project, artifact).each { key, lib ->
libs[lib.name] = lib
if (lib.name != artifact)
ret.add(lib.name)
}
return ret
}
public static def getArtifacts(project, config, classifiers) {
def ret = [:]
config.resolvedConfiguration.resolvedArtifacts.each {
def art = [
group: it.moduleVersion.id.group,
name: it.moduleVersion.id.name,
version: it.moduleVersion.id.version,
classifier: it.classifier,
extension: it.extension,
file: it.file
]
def key = art.group + ':' + art.name
def folder = "${art.group.replace('.', '/')}/${art.name}/${art.version}/"
def filename = "${art.name}-${art.version}"
if (art.classifier != null)
filename += "-${art.classifier}"
filename += ".${art.extension}"
def path = "${folder}${filename}"
def url = "https://libraries.minecraft.net/${path}"
if (!checkExists(url)) {
url = "https://files.minecraftforge.net/maven/${path}"
}
//TODO remove when Mojang launcher is updated
if (!classifiers && art.classifier != null) {
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
// However, keep the path normal so that our mirror system works.
art.version = "${art.version}-${art.classifier}"
art.classifier = null
art.extension = 'jar'
}
ret[key] = [
name: "${art.group}:${art.name}:${art.version}" + (art.classifier == null ? '' : ":${art.classifier}") + (art.extension == 'jar' ? '' : "@${art.extension}"),
downloads: [
artifact: [
path: path,
url: url,
sha1: sha1(art.file),
size: art.file.length()
]
]
]
}
return ret
}
public static def iso8601Now() { new Date().iso8601() }
public static def sha1(file) {
MessageDigest md = MessageDigest.getInstance('SHA-1')
file.eachByte 4096, {bytes, size ->
md.update(bytes, 0, size)
}
return md.digest().collect {String.format "%02x", it}.join()
}
private static def artifactTree(project, artifact) {
if (!project.ext.has('tree_resolver'))
project.ext.tree_resolver = 1
def cfg = project.configurations.create('tree_resolver_' + project.ext.tree_resolver++)
def dep = project.dependencies.create(artifact)
cfg.dependencies.add(dep)
def files = cfg.resolve()
return getArtifacts(project, cfg, true)
}
private static boolean checkExists(url) {
try {
def code = new URL(url).openConnection().with {
requestMethod = 'HEAD'
connect()
responseCode
}
return code == 200
} catch (Exception e) {
if (e.toString().contains('unable to find valid certification path to requested target'))
throw new RuntimeException('Failed to connect to ' + url + ': Missing certificate root authority, try updating java')
throw e
}
}
}
-22
View File
@@ -1,22 +0,0 @@
Contributing to Forge
=====================
1) Keep patches to Minecraft classes minimal. If you need a lot of things done, you may either add to relevant forge classes or make a new class.
2) An example mod must be provided for all PRs adding events/hooks to Forge. Whether it's a full mod using your proposed hooks, or just a pastebin containing a simple example, an example mod is required. Please also explain in detail what your new hook does.
3) Follow Forge coding guidelines (braces on newlines, spaces instead of tabs, etc)
For more information, refer to [the wiki](https://github.com/MinecraftForge/MinecraftForge/wiki/If-you-want-to-contribute-to-Forge)
Contributor License Agreement
=============================
- You grant Forge a license to use your code contributed to the primary codebase (everything **not** under patches) in Forge, under the LGPLv2.1 license.
- You assign copyright ownership of your contributions to the patches codebase (everything under patches) to Forge, where it will be licensed under the LGPLv2.1 license.
Additionally, while 1.9.4 is being maintained, you will be asked to acknowledge these two additional clauses.
- You grant Forge a license to use your code contributed to the primary codebase (everything **not** under patches) in Forge, under the MinecraftForge license.
- You grant assign copyright ownership of your contributions to the patches codebase (everything under patches) to Forge, where it will be licensed under the MinecraftForge license.
"Forge" is Forge Development LLC, a legally incorporated entity in Oregon, USA.
-9
View File
@@ -1,9 +0,0 @@
# On the Contribution of an RF-lite Energy System: "Energy"
Forge has acquired an Energy system, after many years of debate on the topic. The prevalence of the RF API has warranted the inclusion of a similar (but simpler) implementation to forge for 1.10.2 and onwards.
Those who wish to use an RF like API, feel free to use it. If you don't want to think about Energy, but know you need it, you can use it *if you wish*. If you want to interoperate with other energy systems, feel free to use this to broker with them.
# On Diversity in Energy Systems
Forge has always supported diversity in energy-like systems. If you have a burning desire to simulate electricity flow in all it's glory, we fully support you and look forward to playing your mod. If you wish to have pneumatic power, we have no objections, and would love to see your wonderful creations. If you have a power system of your own devising that is simply beyond our imagination, please, blow us away.
# On Modder Obligations
As a modder, you are under *no* obligation to use or support the forge Energy system. If anyone, user, mod-pack maker or even us, tells you otherwise, refer them to this statement. The Forge energy system is not intended to supplant diversity in energy systems. It is not intended to be one-size-fits-all. The choice to support it, is the choice of the modder.
-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
-68
View File
@@ -1,68 +0,0 @@
![Forge Logo](assets/Forge_logo.svg)
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.16.3-&query=$.promos["1.16.3-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.16.3-&query=$.promos["1.16.3-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)](https://files.minecraftforge.net) [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)](https://discord.gg/UvedJ9m) [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)](https://www.patreon.com/LexManos)
Forge is a free, open-source modding API all of your favourite mods use!
| Version | Support |
| ------------- | ------------- |
| 1.16.x | Active |
| 1.15.x | LTS |
* [Download]
* [Forum]
* [Discord]
* [Documentation]
#### Notes:
- Introduced in 1.13 was a new FML, information found [here](NewFML.md).
# Installing Forge
Go to [the Forge website](https://files.minecraftforge.net)
and select the Minecraft version you wish to get Forge for from the list.
You can download the installer for the *Recommended Build* or the
*Latest build* there. Latest builds may have newer features but may be
more unstable as a result. The installer will attempt to install Forge
into your vanilla launcher environment, where you can then create a new
profile using that version and play the game!
For support and questions, visit [the Support Forum](https://www.minecraftforge.net/forum/forum/18-support-bug-reports/).
[Here is a short video from Rorax showing how to install and setup Forge.](https://www.youtube.com/watch?v=lB3ArN_-3Oc)
# Creating Mods
[See the "Getting Started" section in the Forge Documentation](https://mcforge.readthedocs.io/en/latest/gettingstarted/).
# Contribute to Forge
If you wish to actually inspect Forge, submit PRs or otherwise work
with Forge itself, you're in the right place!
[See the guide to setting up a Forge workspace](http://mcforge.readthedocs.io/en/latest/forgedev/).
### Pull requests
[See the "Making Changes and Pull Requests" section in the Forge documentation](https://mcforge.readthedocs.io/en/latest/forgedev/#making-changes-and-pull-requests).
Please read the contributing guidelines found [here](CONTRIBUTING.md) before making a pull request.
### Contributor License Agreement
We require all contributors to acknowledge the [Forge Contributor
License Agreement](https://cla-assistant.io/MinecraftForge/MinecraftForge). Please ensure you have a valid email address
associated with your GitHub account to do this. If you have previously
signed it, you should be OK.
#### Donate
*Forge is a large project with many collaborators working on it around the clock. Forge is and will always remain free to use and modify. However, it costs money to run such a large project as this, so please consider [becoming a patron](https://www.patreon.com/LexManos).*
[Download]: https://files.minecraftforge.net/
[Forum]: https://www.minecraftforge.net/forum/
[Discord]: https://discord.gg/UvedJ9m
[Documentation]: https://mcforge.readthedocs.io
-146
View File
@@ -1,146 +0,0 @@
Getting Support Surrounding Forge
=================================
**If you do not want to read the following wall of text, no matter its relevance for helping get your issue resolved quickly, please refer to the [Forge Forums](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/) for support.**
Before reporting an issue on this repository's bug tracker, please carefully read this document. There are various resources that are more likely to be able to help you with certain kinds of issues. This document provides instructions on how to determine which place best to report to.
*Note: While this guide generally is more geared towards end-user problems, modders should also read it before reporting any issue with Forge in order to ensure it actually is one. This does of course not cover feature suggestions.*
### Contents
1. [Identifying the Source of a Problem](#identifying-the-source-of-a-problem)
1. [Analyzing a Stacktrace](#analyzing-a-stacktrace)
2. [Isolating an Issue](#isolating-an-issue)
2. [Choosing the Correct Support Channel](#choosing-the-correct-support-channel)
1. [Forge Support](#forge-support)
2. [Mod Support](#mod-support)
3. [Vanilla Support](#vanilla-support)
3. [Writing a Helpful Bug Report](#writing-a-helpful-bug-report)
1. [Preventing Duplicates and Unnecessary Reports](#preventing-duplicates-and-unnecessary-reports)
2. [Required Information](#required-information)
3. [Markdown Issue Template](#markdown-issue-template)
4. [Waiting for an Issue to Be Resolved](#waiting-for-an-issue-to-be-resolved)
Identifying the Source of a Problem
-----------------------------------
You're most likely to get fast and valuable responses to your issues if you report them in the correct place. For this, you need to find the root cause of the problem.
The most important source for this information are the log files Forge creates for every run of the game. You can find them in the `logs` subdirectory of your Minecraft game directory. The most important log file is `latest.log` which contains all of Forge's and any mod's output for `info` of above. `debug.log` contains all the logs in `latest.log` plus the `debug` logs for more detailed debugging.
If you're faced by a crash, consult these logs files first. Near the end of the log should be a section labelled 'Minecraft Crash Report', and after it, one about `a detailed walkthrough of the error, ...`. In these sections, you'll see a bunch of lines that look like
```
at some.words.related.to.a.mod.MoreWords(MoreWords.java:number)
```
These lines are the most important part of a crash log, called the stacktrace, because they pinpoint the place in the code where something went irrecoverably wrong. Mod authors usually name their code so that these lines describe what the game was doing when it crashed. The further down one of these lines is, the earlier that piece of code ran, so at the bottom you'll see the place where Minecraft started, and at the top is where it stopped. You should use this information to figure out who to report the bug to.
### Analyzing a Stacktrace
You can generally tell pretty quickly what caused the error at the head of your stacktrace, simply follow these rules:
1. If you can find the name of a mod in the trace, that mod most likely is the culprit.
- Be aware that you may find multiple mods as participants of a crash. In that case, you can either report to both or try to reason (using the names in the stacktrace) about which mod is at fault.
2. If you can only find Forge (usually starting with `net.minecraftforge`) alongside Vanilla (usually starting with `net.minecraft`) references, chances are that you have found a bug in Forge. In this case, use one of the various [support channels](#forge-support) listed below.
- The occurence of a single call to Forge somewhere in the stacktrace *does not* warrant a report to Forge if there are mods present in the crash report.
3. If there's no mention of Forge or a mod, but any Vanilla class, you might have found a Vanilla bug. You should probably still report it via the Forge channels first, however, due the nature of modded environments and the rarity of Vanilla crash bugs.
4. Always check whether there's a mention of coremods at the beginning of a crash report. If there is and you can't find any clear culprit, consider reporting to these coremods first, since they are free to change any of the code executed in your environment.
The rules are numbered in decreasing priority, which means that you should always prefer finding a mod in a crash report over directly jumping to conclusions about Forge or even Vanilla.
### Isolating an Issue
A significant step of reporting an issue, after having found the involved parties, is reliably reproducing it to identify potential incompatibilities or weird interactions between mods. If you're unable to pinpoint a bug to a set of mods and just randomly report it to any mod, chances are it won't get much attention and hence not a fix.
Reliable methods of isolating the issue are listed below:
- **Retrace your last steps before the crash/bug occurred.** It might sound too simple, but a big part of reliably reproducing an issue is determining the steps required to trigger it. If you can't exactly remember what you last did, looking at the stacktrace again can also help you a bit, since there are often descriptive names in there which reflect an action you could take, such as using an item or placing a block.
- **Reduce the number of mod interactions.** You can achieve this in multiple ways. One of them is simply disabling any compatibility layers between involved mods via configuration files. The other one, which takes a little more effort, is actually removing mods from your instance. But don't be afraid, you won't have to remove mods one-by-one if you follow these steps (known as a binary search):
1. Move half the mods out of your instance (obviously keep those definitely participating in the issue).
2. If the issue persists after another try of reproducing it, repeat from step 1 one by halving the mod list again.
3. If the issue does not occur anymore without the other half, repeat from step 1 but instead discard the half you just used and split the other one (plus any definitely required mods).
4. Repeat these steps until you can't remove any more mods from your instance without also 'solving' the issue. This set of mods can serve as a basis for your issue report.
Choosing the Correct Support Channel
-------------------------------------
The place you need to report issues to varies depending on the source of the problem. Below you can find a list of support channels you can usually consult for each of the sources listed in the previous section.
Please note that this list has to be considered incomplete as there is a large number of sub-communities within the Minecraft modding world. You should always prefer channels you know and have access to over any of those listed below which would require extra effort on your part.
### Forge Support
If you're certain you've found an issue that is directly caused by Forge, you have the following three platforms available for dealing with it, with decreasing relevance for end-users:
1. **Forge Forums:** There's a dedicated [Support & Bug Report](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/) section on the Forge forums, which is led by team of moderators and volunteers who will try to deal with your reports as quickly as possible. *As a player you should probably report here first.*
- For modders, there also is a separate [Modder Support](http://www.minecraftforge.net/forum/forum/70-modder-support/) section where you can ask all your development-related questions. *You should prefer this section for coding help.*
2. **Forge IRC Channel:** You can find a lot of help on the official [`#minecraftforge`](irc://irc.esper.net:6667/minecraftforge) channel on EsperNet. Especially smaller issues that you quickly need help with could be reported there. *Be aware that the channel is more suited towards development questions, so while you may get support there as a player, you should almost always prefer the forums.*
3. **Forge Issue Tracker:** If you're absolutely certain that you've found an issue in the Forge codebase (e.g. you're a modder yourself and have analyzed the stacktrace and relevant code), don't refrain from reporting it on this repository's [issue tracker](https://github.com/MinecraftForge/MinecraftForge/issues). *Please do not use the issues as a means of getting coding help. For developers, the IRC and the [official documentation](https://mcforge.readthedocs.io) are the best sources of information.*
### Mod Support
A lot of mods also use GitHub or other source management systems and their integrated issue trackers. The following options will give you the best chances of reporting your issue in the right place:
- **CurseForge:** Many mods are hosted on the [CurseForge platform](https://minecraft.curseforge.com) nowadays. Chances are you already downloaded them from there or as a part of a modpack hosted there. Projects may specify an issue reporting link on their own page, so simply look for it on the mod's project page and you should be directed to the preferred means of error reporting.
- **Searching for a repository directly:** You may need to try and find a repository directly on source control sites. The most common ones are [GitHub](https://github.com) and [BitBucket](https://bitbucket.org). Both come with search capabilities, so simply try to search for the mod's name.
### Vanilla Support
Just like Forge or mods, Mojang has its own issue tracker for Vanilla Minecraft. This official [bug tracker](https://bugs.mojang.com/projects/MC/issues/) has the exclusive purpose of managing any concrete issues with the game's code and functionality. It is *not* a place for requesting any features or getting help with playing the game, similar to the Forge issue tracker.
Writing a Helpful Bug Report
----------------------------
Now that you've identified the source of your issue and decided on the correct support channel, it's time to actually write your report. Before you actually try to blindly create it, however, you should first check if the problem was noticed or even fixed already.
### Preventing Duplicates and Unnecessary Reports
Use the target issue tracker's search functionality to look for issues which have descriptions similar to yours, but make sure to also search for already closed issues. If you can find one, verify it is in fact the same (or a very similar issue) and simply comment on it if you have anything else to contribute to the discussion, such as other steps to reproduce it. *Do not create duplicates of an existing issue, since it only puts extra effort on maintainers to recognize and close/mark them.*
Additionally, always check the *latest* changelogs of Forge and participating mods to find out if the bug was already noticed and fixed by the developer. Often the maintainer may only support newer versions of the game, so also check the changelogs for versions of Minecraft you don't actually actively play. If the issue was adressed already, *do not report it*, even if the fix only exists for a newer version of the game, since the developer probably had a good reason to do so. If your issue only exists with versions of a mod that are for very old versions of the game, also refrain from reporting them, considering most modders only support the two latest versions of Minecraft, if at all.
### Required Information
If you're certain that your issue went unnoticed up until now, you can get to actually writing up the report. Below you can find a list of the *required* information any bug report should contain:
- **Minecraft Version:** Although many developers can deduce the Minecraft version in use from the mod's version, it is still an important piece of information to include, since it helps maintainers more easily decide whether to look into your issue at all or whether to close it right away due to being for an outdated version.
- **Forge Version:** The Forge API is in constant flux and while breaking changes are limited to major Minecraft updates, new bugs or regressions might creep in during active development or newer versions than a mod was built with might change semantics slightly that manifest themselves for this mod.
- **Mod Version:** Just like the Forge and Minecraft version, this is crucial for quickly telling where an issue might come from. *If you're reporting an issue caused by Forge that only occurs with a certain mod installed, include this mod here. No mod version is required if it's a pure Forge bug.*
- **Complete List of Mods:** In order to reliably analyze a bug, developers need the exact same context as you do when trying to find its cause. Hence, you should always include a *full list of mods with their corresponding version* in your report. Note that you should probably only include the ones you found by [isolating the issue](#isolating-an-issue).
- **Steps to Reproduce:** You should always include a list of steps required to provoke an issue to occur. Without it, developers can only take rough guesses at what might cause the bug. Try to reduce the amount of steps to a bare minimum, to make reproducing the issue easier. If you require a sophisticated setup to get even close to the issue, you might want to consider including your save file in your report.
- **Full Log:** This is probably the most important part of your bug report. You *always* have to include the full log (`debug.log` from earlier), since it is the only way of telling what has caused an issue in code. *Do not* paste the full log as plain text in your report, but use [GitHub Gist](https://gist.github.com) instead and link to that from your report.
### Markdown Issue Template
GitHub and BitBucket allow you to use the Markdown format for writing your issues. Below you can find a simple template that you can copy and fill in with your data. `{variables}` are written in braces and are supposed to be replaced by you with the information the variable name indicates. Everything behind two slashes (`//`) has to be interpreted as a comment and should be removed. If you want to include any link, you have to write in the `[title](url)` form. For further information on Markdown, see [this cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
```markdown
**Minecraft Version:** {mc version}
**Forge Version:** {forge version}
**Mod Version:** {mod version} // Remove this line if you're reporting to Forge and no specific mod is involved
[**Full Log**]({link to gist/pastebin with full log})
**Mods in This Instance:**
| Name | Version |
| ------------------------ | ----------- |
| [{mod 1}]({download 1}) | {version 1} | // The download links are entirely optional
| {mod 2} | {version 2} |
| {mod 3} | {version 3} |
| ... | ... |
**Steps to Reproduce:**
1. Do this
2. Then do that
3. ...
```
*Note: The mod list here is formatted as table for easy reading (when displayed) and to look nice in text. Markdown does not care about any alignment of the spaces, so you can simply write individual rows of the table as* `| {mod name} | {version} |` *without having to care about the spacing.*
### Waiting for an Issue to Be Resolved
After you have written your bug report, it is time to *wait*. Please be *patient* after submitting your issue, since it probably isn't the only one. If there's no response after 5 minutes or even a day of writing it, *do not* try to bump the issue by commenting on it, people *will* read it in due time. The only excuse for bumping a report is if it is a *critical* bug that prevents you from playing the game.
Every project has a different way of dealing with issues, so don't wonder if there's no comment on it, but somebody "labels" it with certain markers. This helps developers to more easily keep track of bugs and priorities. When any further input from you is required, you will be asked specifically. Do not bug anyone through other channels about resolving your issue.
Once your issue is closed, you will know whether it was valid or turned out to be irreproducible. If you included all of the data from above in your report, chances are that the latter won't be the case.
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg enable-background="new 164.072 372.466 294.41 46.56" version="1.1" viewBox="164.072 372.466 294.41 46.56" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<g fill="#DFA86A">
<polygon points="266.16 417.99 277.12 417.99 277.12 401.05 295.09 401.05 295.09 390.78 277.12 390.78 277.12 383.77 296.18 383.77 296.18 373.5 266.16 373.5"/>
<path d="m337.33 378.7c-2.103-2.057-4.629-3.64-7.51-4.704-2.743-1.015-5.786-1.528-9.041-1.528l-0.356 2e-3c-3.362 0-6.503 0.556-9.338 1.651-2.857 1.106-5.357 2.707-7.434 4.761-2.073 2.052-3.714 4.559-4.877 7.45-1.158 2.876-1.748 6.104-1.748 9.59 0 3.417 0.59 6.582 1.753 9.403 1.163 2.829 2.807 5.297 4.88 7.329 2.073 2.03 4.572 3.621 7.425 4.724 2.834 1.096 5.975 1.651 9.339 1.651h0.023c3.402-0.043 6.57-0.639 9.42-1.772 2.863-1.142 5.375-2.757 7.465-4.804 2.091-2.051 3.742-4.524 4.91-7.358 1.162-2.823 1.75-5.987 1.75-9.402 0-3.487-0.588-6.705-1.748-9.568-1.168-2.874-2.82-5.371-4.913-7.425zm-4.644 16.762c0 1.96-0.302 3.782-0.896 5.413-0.587 1.607-1.42 3.011-2.479 4.167-1.05 1.147-2.335 2.065-3.821 2.728-1.479 0.656-3.164 0.99-5.008 0.99-1.84 0-3.514-0.333-4.973-0.988-1.47-0.662-2.747-1.578-3.799-2.729-1.062-1.156-1.895-2.559-2.479-4.167-0.595-1.63-0.896-3.451-0.896-5.413 0-1.801 0.298-3.497 0.887-5.044 0.584-1.536 1.419-2.894 2.479-4.037 1.048-1.132 2.323-2.03 3.792-2.674 1.465-0.642 3.145-0.968 4.988-0.968 1.848 0 3.539 0.326 5.025 0.971 1.481 0.643 2.766 1.541 3.812 2.671 1.062 1.143 1.896 2.501 2.479 4.036 0.589 1.548 0.889 3.245 0.889 5.044z"/>
<path d="m376.27 395.65c1.902-2.327 2.867-5.221 2.867-8.603 0-2.614-0.508-4.84-1.506-6.613-0.997-1.762-2.354-3.188-4.035-4.234-1.603-0.995-3.445-1.705-5.482-2.114-1.938-0.388-3.969-0.583-6.037-0.583h-16.021v44.487h10.961v-17.282h2.35l9.447 17.282h13.127l-11.199-18.646c2.262-0.728 4.116-1.964 5.528-3.694zm-19.254-12.223h4.426c0.844 0 1.73 0.054 2.636 0.16 0.784 0.094 1.503 0.283 2.132 0.568 0.496 0.225 0.888 0.553 1.193 0.998 0.283 0.415 0.428 1.031 0.428 1.836 0 0.931-0.16 1.643-0.459 2.06-0.34 0.472-0.771 0.813-1.32 1.046-0.686 0.289-1.459 0.477-2.301 0.554-0.975 0.089-1.963 0.136-2.938 0.136h-3.795l-2e-3 -7.358z"/>
<path d="m394.82 386.38c1.05-1.132 2.325-2.03 3.793-2.674 1.464-0.642 3.144-0.968 4.988-0.968 1.843 0 3.611 0.311 5.26 0.921 1.609 0.599 2.992 1.449 4.107 2.531l1.314 1.278 8.019-8.105-1.454-1.298c-2.355-2.103-5.066-3.586-8.058-4.407-2.879-0.789-5.987-1.189-9.247-1.189-3.361 0-6.503 0.556-9.339 1.651-2.856 1.106-5.355 2.707-7.431 4.761-2.074 2.052-3.716 4.559-4.88 7.45-1.158 2.876-1.746 6.104-1.746 9.59 0 3.417 0.59 6.582 1.752 9.403 1.164 2.829 2.807 5.297 4.88 7.329 2.073 2.03 4.572 3.621 7.425 4.724 2.832 1.096 5.975 1.651 9.339 1.651 6.501 0 12.475-1.432 17.751-4.25l0.979-0.522v-23.814h-19.313v10.27h8.354v6.639c-0.871 0.397-1.834 0.709-2.881 0.933-1.5 0.314-3.127 0.478-4.83 0.478-1.841 0-3.514-0.333-4.973-0.988-1.472-0.662-2.748-1.578-3.801-2.729-1.06-1.156-1.893-2.559-2.478-4.167-0.595-1.63-0.896-3.451-0.896-5.413 0-1.801 0.299-3.497 0.887-5.044 0.586-1.54 1.421-2.897 2.479-4.041z"/>
<polygon points="437.69 407.72 437.69 400.36 456.41 400.36 456.41 390.09 437.69 390.09 437.69 383.77 457.44 383.77 457.44 373.5 426.72 373.5 426.72 417.99 458.48 417.99 458.48 407.72"/>
</g>
<path d="m243.63 379.09l-37.842-1.852 46.229-0.034v-3.727h-52.125l-1e-3 7.798v6.201c0 0.115-1.52-9.144-1.87-11.734h-4.098v13.029c0 0.123-1.753-10.888-1.939-12.264h-27.914c1.902 1.648 12.401 10.598 19.865 14.28 3.741 1.846 8.33 1.86 12.414 1.974 2.075 0.06 4.25 0.217 5.803 1.754 2.255 2.236 2.758 5.704 0.814 8.33-1.922 2.594-7.335 3.156-7.335 3.156l-4.509 5.531v6.424h10.251l0.319-6.348 8.863-6.285c-0.946 0.757-3.058 2.783-6.229 7.666-0.717 1.102-1.275 2.306-1.711 3.49 2.238-1.896 6.84-3.194 12.153-3.194 5.307 0 9.903 1.295 12.146 3.188-0.437-1.185-0.994-2.385-1.709-3.483-3.172-4.883-5.284-6.909-6.229-7.666l8.863 6.285 0.32 6.348h9.565v-6.424l-4.507-5.531s-6.675-0.425-8.423-3.156c-5.032-7.869 2.115-20.082 18.836-23.756z" fill="#1E2D41"/>
</svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

+11
View File
@@ -0,0 +1,11 @@
cd ..
rmdir /S /Q src
mkdir src
xcopy /Y /E src_work\* src\
xcopy /Y /E forge\forge_client\src\net\* src\minecraft\net
xcopy /Y /E forge\forge_common\net\* src\minecraft\net
xcopy /Y /E forge\forge_common\net\* src\minecraft_server\net
cmd /C recompile.bat
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
pushd ..
rm -rf src
cp -a src_work src
rm -rf bin
popd
cp -a forge_client/src/net/* ../src/minecraft/net/
cp -a forge_common/net/* ../src/minecraft/net/
cp -a forge_common/net/* ../src/minecraft_server/net/
pushd ..
./recompile.sh
+1
View File
@@ -0,0 +1 @@
forge_client/src/net/minecraft/src/forge/
+1
View File
@@ -0,0 +1 @@
forge_common/net/minecraft/src/forge
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="forge_common"/>
<classpathentry kind="src" path="minecraft"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="../../jars/bin/jinput.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/>
<classpathentry kind="lib" path="../../jars/bin/minecraft.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>forge_client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>forge_common</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI>
</link>
<link>
<name>minecraft</name>
<type>2</type>
<locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft</locationURI>
</link>
</linkedResources>
</projectDescription>
@@ -0,0 +1,13 @@
package net.minecraft.src.forge;
import java.util.ArrayList;
import java.util.List;
public class BlockTextureParticles {
public String texture;
public List effects;
public BlockTextureParticles(){
effects = new ArrayList();
}
}
@@ -0,0 +1,52 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.Block;
import net.minecraft.src.ModLoader;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.Tessellator;
import org.lwjgl.opengl.GL11;
public class MinecraftForgeClient {
public static void beforeBlockRender(Block block, RenderBlocks renderblocks) {
if (block instanceof ITextureProvider
&& renderblocks.overrideBlockTexture == -1) {
Tessellator tessellator = Tessellator.instance;
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
.getMinecraftInstance().renderEngine
.getTexture(((ITextureProvider) (block)).getTextureFile()));
}
}
public static void afterBlockRender(Block block, RenderBlocks renderblocks) {
if (block instanceof ITextureProvider
&& renderblocks.overrideBlockTexture == -1) {
Tessellator tessellator = Tessellator.instance;
tessellator.draw();
tessellator.startDrawingQuads();
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
.getMinecraftInstance().renderEngine
.getTexture("/terrain.png"));
}
}
public static void overrideTexture (Object o) {
if (o instanceof ITextureProvider) {
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
.getMinecraftInstance().renderEngine
.getTexture(((ITextureProvider) (o))
.getTextureFile()));
}
}
}
@@ -0,0 +1,313 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.TreeMap;
import net.minecraft.src.Block;
/**
* This class offers advanced configurations capabilities, allowing to provide
* various categories for configuration variables.
*/
public class Configuration {
private boolean configBlocks[] = null;
public static final int GENERAL_PROPERTY = 0;
public static final int BLOCK_PROPERTY = 1;
public static final int ITEM_PROPERTY = 2;
File file;
public TreeMap<String, Property> blockProperties = new TreeMap<String, Property>();
public TreeMap<String, Property> itemProperties = new TreeMap<String, Property>();
public TreeMap<String, Property> generalProperties = new TreeMap<String, Property>();
/**
* Create a configuration file for the file given in parameter.
*/
public Configuration(File file) {
this.file = file;
}
/**
* Gets or create a block id property. If the block id property key is
* already in the configuration, then it will be used. Otherwise,
* defaultId will be used, except if already taken, in which case this
* will try to determine a free default id.
*/
public Property getOrCreateBlockIdProperty(String key, int defaultId) {
if (configBlocks == null) {
configBlocks = new boolean[Block.blocksList.length];
for (int i = 0; i < configBlocks.length; ++i) {
configBlocks[i] = false;
}
}
if (blockProperties.containsKey(key)) {
Property property = getOrCreateIntProperty(key,
Configuration.BLOCK_PROPERTY, defaultId);
configBlocks[Integer.parseInt(property.value)] = true;
return property;
} else {
Property property = new Property();
blockProperties.put(key, property);
property.name = key;
if (Block.blocksList[defaultId] == null
&& !configBlocks[defaultId]) {
property.value = Integer.toString(defaultId);
configBlocks[defaultId] = true;
return property;
} else {
for (int j = Block.blocksList.length - 1; j >= 0; --j) {
if (Block.blocksList[j] == null && !configBlocks[j]) {
property.value = Integer.toString(j);
configBlocks[j] = true;
return property;
}
}
throw new RuntimeException("No more block ids available for "
+ key);
}
}
}
public Property getOrCreateIntProperty(String key, int kind,
int defaultValue) {
Property prop = getOrCreateProperty(key, kind,
Integer.toString(defaultValue));
try {
Integer.parseInt(prop.value);
return prop;
} catch (NumberFormatException e) {
prop.value = Integer.toString(defaultValue);
return prop;
}
}
public Property getOrCreateBooleanProperty(String key, int kind,
boolean defaultValue) {
Property prop = getOrCreateProperty(key, kind,
Boolean.toString(defaultValue));
if ("true".equals(prop.value.toLowerCase())
|| "false".equals(prop.value.toLowerCase())) {
return prop;
} else {
prop.value = Boolean.toString(defaultValue);
return prop;
}
}
public Property getOrCreateProperty(String key, int kind,
String defaultValue) {
TreeMap<String, Property> source = null;
switch (kind) {
case GENERAL_PROPERTY:
source = generalProperties;
break;
case BLOCK_PROPERTY:
source = blockProperties;
break;
case ITEM_PROPERTY:
source = itemProperties;
break;
}
if (source.containsKey(key)) {
return source.get(key);
} else if (defaultValue != null) {
Property property = new Property();
source.put(key, property);
property.name = key;
property.value = defaultValue;
return property;
} else {
return null;
}
}
public void load() {
try {
if (file.getParentFile() != null) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
return;
}
if (file.canRead()) {
FileInputStream fileinputstream = new FileInputStream(file);
BufferedReader buffer = new BufferedReader(
new InputStreamReader(fileinputstream, "8859_1"));
String line;
TreeMap<String, Property> currentMap = null;
while (true) {
line = buffer.readLine();
if (line == null) {
break;
}
int nameStart = -1, nameEnd = -1;
boolean skip = false;
for (int i = 0; i < line.length() && !skip; ++i) {
if (Character.isLetterOrDigit(line.charAt(i))
|| line.charAt(i) == '.') {
if (nameStart == -1) {
nameStart = i;
}
nameEnd = i;
} else if (Character.isWhitespace(line.charAt(i))) {
// ignore space charaters
} else {
switch (line.charAt(i)) {
case '#':
skip = true;
continue;
case '{':
String scopeName = line.substring(nameStart,
nameEnd + 1);
if (scopeName.equals("general")) {
currentMap = generalProperties;
} else if (scopeName.equals("block")) {
currentMap = blockProperties;
} else if (scopeName.equals("item")) {
currentMap = itemProperties;
} else {
throw new RuntimeException(
"unknown section " + scopeName);
}
break;
case '}':
currentMap = null;
break;
case '=':
String propertyName = line.substring(nameStart,
nameEnd + 1);
if (currentMap == null) {
throw new RuntimeException("property "
+ propertyName + " has no scope");
}
Property prop = new Property();
prop.name = propertyName;
prop.value = line.substring(i + 1);
i = line.length();
currentMap.put(propertyName, prop);
break;
default:
throw new RuntimeException("unknown character "
+ line.charAt(i));
}
}
}
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void save() {
try {
if (file.getParentFile() != null) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
return;
}
if (file.canWrite()) {
FileOutputStream fileoutputstream = new FileOutputStream(file);
BufferedWriter buffer = new BufferedWriter(
new OutputStreamWriter(fileoutputstream, "8859_1"));
buffer.write("# Configuration file\r\n");
buffer.write("# Generated on "
+ DateFormat.getInstance().format(new Date()) + "\r\n");
buffer.write("\r\n");
buffer.write("###########\r\n");
buffer.write("# General #\r\n");
buffer.write("###########\r\n\r\n");
buffer.write("general {\r\n");
writeProperties(buffer, generalProperties.values());
buffer.write("}\r\n\r\n");
buffer.write("#########\r\n");
buffer.write("# Block #\r\n");
buffer.write("#########\r\n\r\n");
buffer.write("block {\r\n");
writeProperties(buffer, blockProperties.values());
buffer.write("}\r\n\r\n");
buffer.write("########\r\n");
buffer.write("# Item #\r\n");
buffer.write("########\r\n\r\n");
buffer.write("item {\r\n");
writeProperties(buffer, itemProperties.values());
buffer.write("}\r\n\r\n");
buffer.close();
fileoutputstream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void writeProperties(BufferedWriter buffer,
Collection<Property> props) throws IOException {
for (Property property : props) {
if (property.comment != null) {
buffer.write(" # " + property.comment + "\r\n");
}
buffer.write(" " + property.name + "=" + property.value);
buffer.write("\r\n");
}
}
}
@@ -0,0 +1,23 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
public interface IBucketHandler {
/**
* This is called before Minecraft tries to fill a bucket with water or
* lava. If it returns a non-null result, then the filling process will
* be stopped and the empty bucket will be changed to the result of this
* subprogram.
*
* @see MinecraftForge#registerCustomBucketHander(IBucketHandler)
*/
public ItemStack fillCustomBucket(World w, int i, int j, int k);
}
@@ -0,0 +1,27 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
/**
* This interface is to be implemented by Block classes. It will override
* standard algorithms controlling connection between two blocks by redstone
*
* @see Block
*/
public interface IConnectRedstone {
/**
* When this returns false, the block at location i, j, k cannot make
* a redstone connection in the direction given in parameter, otherwise
* it can. Use to control which sides are inputs and outputs for redstone
* wires.
*/
public boolean canConnectRedstone(IBlockAccess iba, int i, int j, int k,
int dir);
}
@@ -0,0 +1,23 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.Block;
import net.minecraft.src.ItemTool;
public interface IHarvestHandler {
/**
* Return true if the tool in parameter is known to be able to harvest
* the given block, false if this handler does not know of any particular
* harvesting. Other rules may activate the harvesting outside of this
* handler. This is typically used to add e.g. blocks only extracted by
* diamond pickaxe
*
* @see MinecraftForge#registerHarvestHandler(IHarvestHandler)
*/
public boolean canHarvestBlock(ItemTool item, Block block);
}
@@ -0,0 +1,17 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
/** This interface is to be implemented by a Block class. Allows a block
* type to perform rendering in both render passes, in case some parts of the
* block are solid and others are transparent.
*/
public interface IMultipassRender {
/** Returns true when the block has things to render in this render
* pass.
*/
public boolean canRenderInPass(int n);
}
@@ -0,0 +1,30 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.Block;
import net.minecraft.src.World;
/**
* This interface is to be implemented by block classes. It will allow a block
* to control how it can be replaced
*
* @see Block
*/
public interface IOverrideReplace {
/**
* Return true if this block has to take control over replacement, for
* the intended replacement given by the parameter bid. If false, then
* the block replacement will be prevented.
*/
public boolean canReplaceBlock(World world, int i, int j, int k, int bid);
/**
* Return the status of the actual replacement.
*/
public boolean getReplacedSuccess();
}
@@ -0,0 +1,27 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.ItemArmor;
/**
* This interface is to be implemented by ItemArmor classes. It will allow to
* modify computation of damage and health loss. Computation will be called
* before the actual armor computation, which can then be cancelled.
*
* @see ItemArmor
*/
public interface ISpecialArmor {
/**
* This interface will adjust the amount of damage received by the entity.
*/
public int adjustArmorDamage (int damage);
/**
* When this return true, the regular armor computation will be cancelled
*/
public boolean allowRegularComputation ();
}
@@ -0,0 +1,26 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.World;
/**
* This interface is to be implemented by block classes. It will allow a block
* to control how it resists to explosion
*
* @see Block
*/
public interface ISpecialResistance {
/**
* Return the explosion resistance of the block located at position i, j,
* k, from an exploder explosing on src_x, src_y, src_z.
*/
public float getSpecialExplosionResistance(World world, int i, int j, int k,
double src_x, double src_y, double src_z, Entity exploder);
}
@@ -0,0 +1,21 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
/**
* This interface has to be implemented either by an instance of Block or Item.
* It allow to use texture files different from terrain.png or items.png.
*/
public interface ITextureProvider {
/**
* This interface has to return the path to a file that is the same size as
* terrain.png, but not named terrain.png. It will be used instead of the
* regular terrain file to render blocks and items.
*/
public String getTextureFile();
}
@@ -0,0 +1,28 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
/**
* This interface is to be implemented by item classes. It will allow an item
* to perform a use before the block is activated.
*
* @see Item
*/
public interface IUseItemFirst {
/**
* This is called when the item is used, before the block is activated.
* Stop the computation when return true.
*/
public boolean onItemUseFirst(ItemStack ist,
EntityPlayer player, World world,
int i, int j, int k, int l);
}
@@ -0,0 +1,75 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import java.util.LinkedList;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.Block;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ItemTool;
import net.minecraft.src.World;
public class MinecraftForge {
private static LinkedList<IBucketHandler> bucketHandlers = new LinkedList<IBucketHandler>();
private static LinkedList<IHarvestHandler> harvestHandlers = new LinkedList<IHarvestHandler>();
/**
* Registers a new custom bucket handler.
*/
public static void registerCustomBucketHander(IBucketHandler handler) {
bucketHandlers.add(handler);
}
/**
* Registers a new harvest handler.
*/
public static void registerHarvestHandler(IHarvestHandler handler) {
harvestHandlers.add(handler);
}
/**
* This is not supposed to be called outside of Minecraft internals.
*/
public static ItemStack fillCustomBucket(World w, int i, int j, int k) {
for (IBucketHandler handler : bucketHandlers) {
ItemStack stack = handler.fillCustomBucket(w, i, j, k);
if (stack != null) {
return stack;
}
}
return null;
}
/**
* This is not supposed to be called outside of Minecraft internals.
*/
public static boolean canHarvestBlock(ItemTool item, Block block) {
for (IHarvestHandler handler : harvestHandlers) {
if (handler.canHarvestBlock(item, block)) {
return true;
}
}
return false;
}
/**
* Add a block to the list of blocks to which the pickaxe is know to be
* effective.
*/
public static void addPickaxeBlockEffectiveAgainst (Block block) {
((ItemTool) Item.pickaxeWood).addBlockEffectiveAgainst(block);
((ItemTool) Item.pickaxeStone).addBlockEffectiveAgainst(block);
((ItemTool) Item.pickaxeSteel).addBlockEffectiveAgainst(block);
((ItemTool) Item.pickaxeGold).addBlockEffectiveAgainst(block);
((ItemTool) Item.pickaxeDiamond).addBlockEffectiveAgainst(block);
}
}
+12
View File
@@ -0,0 +1,12 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
public class Property {
public String name;
public String value;
public String comment;
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="forge_common"/>
<classpathentry kind="src" path="minecraft_server"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="../../jars/bin/jinput.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/>
<classpathentry kind="lib" path="../../jars/minecraft_server.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>forge_server</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>forge_common</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI>
</link>
<link>
<name>minecraft_server</name>
<type>2</type>
<locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft_server</locationURI>
</link>
</linkedResources>
</projectDescription>
+65
View File
@@ -0,0 +1,65 @@
Minecraft Forge Public Licence
==============================
Version 1.0
0. Definitions
--------------
Minecraft: Denotes a copy of the Minecraft game licensed by Mojang AB
User: Anybody that interract with the software in one of the following ways:
- play
- decompile
- recompile or compile
- modify
Minecraft Forge: The Minecraft Forge code, in source form, class file form, as
obtained in a standalone fashion or as part of a wider distribution.
Dependency: Code required to have Minecraft Forge working properly. That can
include dependencies required to compile the code as well as modifications in
the Minecraft sources that are required to have Minecraft Forge working.
1. Scope
--------
The present license is granted to any user of Minecraft Forge. As a
prerequisite, a user of Minecraft Forge must own a legally aquired copy of
Minecraft
2. Play rights
--------------
The user of Minecraft Forge is allowed to install the software on a client or
a server and to play it without restriction.
3. Modification rights
----------------------
The user has the right to decompile the source code, look at either the
decompiled version or the original source code, and to modify it.
4. Derivation rights
--------------------
The user has the rights to derive code from Minecraft Forge, that is to say to
write code that either extends Minecraft Forge class and interfaces,
instantiate the objects declared or calls the functions. This code is known as
"derived" code, and can be licensed with conditions different from Minecraft
Forge.
5. Distribution rights
----------------------
The user of Minecraft Forge is allowed to redistribute Minecraft Forge in
partially, in totallity, or included in a distribution. When distributing
binaries or class files, the user must provide means to obtain the sources of
the distributed version of Minecraft Forge at no costs. This includes the
files as well as any dependency that the code may rely on, including patches to
minecraft original sources.
Modification of Minecraft Forge as well as dependencies, including patches to
minecraft original sources, has to remain under the terms of the present
license.
+742
View File
@@ -0,0 +1,742 @@
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
@@ -451,6 +452,10 @@
{
return false;
}
+ if (Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr = (IConnectRedstone) Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess, i, j, k, l);
+ }
if(Block.blocksList[i1].canProvidePower())
{
return true;
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Chunk.java ../src_work/minecraft/net/minecraft/src/Chunk.java
--- ../src_base/minecraft/net/minecraft/src/Chunk.java 2011-07-29 16:35:26.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -249,6 +250,13 @@
}
int l1 = xPosition * 16 + i;
int i2 = zPosition * 16 + k;
+
+ if (Block.blocksList[k1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1];
+ if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
if(k1 != 0 && !worldObj.multiplayerWorld)
{
@@ -292,6 +300,13 @@
}
int k1 = xPosition * 16 + i;
int l1 = zPosition * 16 + k;
+
+ if (Block.blocksList[j1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[j1];
+ if (!iovr.canReplaceBlock(worldObj, k1, j, l1, l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
if(j1 != 0)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EffectRenderer.java ../src_work/minecraft/net/minecraft/src/EffectRenderer.java
--- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-07-31 21:44:50.000000000 -0400
@@ -7,6 +7,9 @@
import java.util.*;
import org.lwjgl.opengl.GL11;
+import net.minecraft.src.forge.BlockTextureParticles;
+import net.minecraft.src.forge.ITextureProvider;
+
// Referenced classes of package net.minecraft.src:
// EntityFX, Entity, MathHelper, RenderEngine,
// Tessellator, Block, EntityDiggingFX, World
@@ -16,6 +19,7 @@
public EffectRenderer(World world, RenderEngine renderengine)
{
+ effectList = new ArrayList();
fxLayers = new List[4];
rand = new Random();
if(world != null)
@@ -55,6 +59,18 @@
}
}
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ for (int y = 0; y < entry.effects.size(); y++) {
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
+ if (entityfx.isDead) {
+ entry.effects.remove(y--);
+ }
+ }
+ if (effectList.size() == 0)
+ effectList.remove(x--);
+ }
}
@@ -93,11 +109,26 @@
for(int k = 0; k < fxLayers[i].size(); k++)
{
EntityFX entityfx = (EntityFX)fxLayers[i].get(k);
+ if(entityfx instanceof EntityDiggingFX) continue;
entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
}
tessellator.draw();
}
+ Tessellator tessellator = Tessellator.instance;
+
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ GL11.glBindTexture(3553 /* GL_TEXTURE_2D */,
+ renderer.getTexture(entry.texture));
+ tessellator.startDrawingQuads();
+ for (int y = 0; y < entry.effects.size(); y++) {
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
+ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
+ }
+ tessellator.draw();
+ }
}
@@ -124,6 +155,13 @@
{
fxLayers[i].clear();
}
+
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ entry.effects.clear();
+ }
+ effectList.clear();
}
@@ -145,7 +183,12 @@
double d1 = (double)j + ((double)l1 + 0.5D) / (double)j1;
double d2 = (double)k + ((double)i2 + 0.5D) / (double)j1;
int j2 = rand.nextInt(6);
- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, d - (double)i - 0.5D, d1 - (double)j - 0.5D, d2 - (double)k - 0.5D, block, j2, i1)).func_4041_a(i, j, k));
+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj,
+ d, d1, d2, d - (double) i - 0.5D, d1 - (double) j
+ - 0.5D, d2 - (double) k - 0.5D, block, j2,
+ i1);
+ dig_effect.func_4041_a(i, j, k);
+ addDigParticleEffect(dig_effect, block);
}
}
@@ -190,16 +233,48 @@
{
d = (double)i + block.maxX + (double)f;
}
- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k))).func_4041_a(i, j, k).func_407_b(0.2F).func_405_d(0.6F));
+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2,
+ 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k));
+ dig_effect.func_4041_a(i, j, k);
+ dig_effect.func_407_b(0.2F);
+ dig_effect.func_405_d(0.6F);
+ addDigParticleEffect(dig_effect, block);
}
public String getStatistics()
{
return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString();
}
+
+ public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) {
+ boolean added = false;
+ String comp;
+
+ if (block instanceof ITextureProvider) {
+ comp = ((ITextureProvider) block).getTextureFile();
+ } else {
+ comp = "/terrain.png";
+ }
+ for (int x = 0; x < effectList.size(); x++) {
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
+ .get(x);
+ if (entry.texture.equals(comp)) {
+ entry.effects.add(dig_effect);
+ added = true;
+ }
+ }
+ if (!added) {
+ BlockTextureParticles entry = new BlockTextureParticles();
+ entry.texture = comp;
+ entry.effects.add(dig_effect);
+ effectList.add(entry);
+ }
+ addEffect(dig_effect);
+ }
protected World worldObj;
private List fxLayers[];
+ private List effectList;
private RenderEngine renderer;
private Random rand;
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityPlayer.java ../src_work/minecraft/net/minecraft/src/EntityPlayer.java
--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 2011-07-31 21:44:50.000000000 -0400
@@ -6,6 +6,8 @@
import java.util.*;
+import net.minecraft.src.forge.ISpecialArmor;
+
// Referenced classes of package net.minecraft.src:
// EntityLiving, InventoryPlayer, ContainerPlayer, World,
// ChunkCoordinates, DataWatcher, Container, StatList,
@@ -477,6 +479,21 @@
protected void damageEntity(int i)
{
+ boolean doRegularComputation = true;
+ for (ItemStack stack : inventory.armorInventory) {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ i = armor.adjustArmorDamage(i);
+ doRegularComputation = doRegularComputation
+ && armor.allowRegularComputation();
+ }
+ }
+
+ if (!doRegularComputation) {
+ super.damageEntity(i);
+ }
+
int j = 25 - inventory.getTotalArmorValue();
int k = i * j + damageRemainder;
inventory.damageArmor(i);
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Explosion.java ../src_work/minecraft/net/minecraft/src/Explosion.java
--- ../src_base/minecraft/net/minecraft/src/Explosion.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -65,7 +66,17 @@
int i5 = worldObj.getBlockId(j4, k4, l4);
if(i5 > 0)
{
- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ if (Block.blocksList[i5] instanceof ISpecialResistance) {
+ ISpecialResistance isr = (ISpecialResistance) Block.blocksList[i5];
+ f1 -= (isr.getSpecialExplosionResistance(
+ worldObj, j4, k4, l4, explosionX,
+ explosionY, explosionZ, exploder) + 0.3F)
+ * f2;
+ } else {
+ f1 -= (Block.blocksList[i5]
+ .getExplosionResistance(exploder) + 0.3F)
+ * f2;
+ }
}
if(f1 > 0.0F)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-07-31 21:44:50.000000000 -0400
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -55,6 +57,13 @@
}
if(isFull == 0)
{
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world,
+ i, j, k);
+
+ if (customBucket != null) {
+ return customBucket;
+ }
+
if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemPickaxe.java ../src_work/minecraft/net/minecraft/src/ItemPickaxe.java
--- ../src_base/minecraft/net/minecraft/src/ItemPickaxe.java 2011-07-29 16:35:26.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemPickaxe.java 2011-07-31 21:44:50.000000000 -0400
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// ItemTool, Block, EnumToolMaterial, Material
@@ -42,6 +44,9 @@
{
return toolMaterial.getHarvestLevel() >= 2;
}
+ if (MinecraftForge.canHarvestBlock(this, block)) {
+ return true;
+ }
if(block.blockMaterial == Material.rock)
{
return true;
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-07-31 21:44:50.000000000 -0400
@@ -5,6 +5,8 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -34,15 +36,18 @@
if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ MinecraftForgeClient.overrideTexture (Block.blocksList[itemstack.itemID]);
renderBlocksInstance.renderBlockOnInventory(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), entityliving.getEntityBrightness(1.0F));
} else
{
if(itemstack.itemID < 256)
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
+ MinecraftForgeClient.overrideTexture (Block.blocksList[itemstack.itemID]);
} else
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png"));
+ MinecraftForgeClient.overrideTexture (Item.itemsList[itemstack.itemID]);
}
Tessellator tessellator = Tessellator.instance;
int i = entityliving.getItemIcon(itemstack);
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemTool.java ../src_work/minecraft/net/minecraft/src/ItemTool.java
--- ../src_base/minecraft/net/minecraft/src/ItemTool.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 2011-07-31 21:49:24.000000000 -0400
@@ -4,6 +4,7 @@
package net.minecraft.src;
+import java.util.Arrays;
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, ItemStack, Block,
@@ -63,4 +64,11 @@
private float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterial toolMaterial;
+
+ public void addBlockEffectiveAgainst (Block block) {
+ blocksEffectiveAgainst = Arrays.copyOf(blocksEffectiveAgainst,
+ blocksEffectiveAgainst.length + 1);
+
+ blocksEffectiveAgainst [blocksEffectiveAgainst.length-1] = block;
+ }
}
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/PlayerController.java ../src_work/minecraft/net/minecraft/src/PlayerController.java
--- ../src_base/minecraft/net/minecraft/src/PlayerController.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;
@@ -98,6 +99,12 @@
public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) {
+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem();
+ if (iuif.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
+ return true;
+ }
+ }
int i1 = world.getBlockId(i, j, k);
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderItem.java ../src_work/minecraft/net/minecraft/src/RenderItem.java
--- ../src_base/minecraft/net/minecraft/src/RenderItem.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-07-31 21:44:50.000000000 -0400
@@ -5,6 +5,9 @@
package net.minecraft.src;
import java.util.Random;
+
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -51,6 +54,7 @@
{
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
loadTexture("/terrain.png");
+ MinecraftForgeClient.overrideTexture(Block.blocksList[itemstack.itemID]);
float f4 = 0.25F;
if(!Block.blocksList[itemstack.itemID].renderAsNormalBlock() && itemstack.itemID != Block.stairSingle.blockID && Block.blocksList[itemstack.itemID].getRenderType() != 16)
{
@@ -78,10 +82,12 @@
if(itemstack.itemID < 256)
{
loadTexture("/terrain.png");
+ MinecraftForgeClient.overrideTexture(Block.blocksList[itemstack.itemID]);
} else
{
loadTexture("/gui/items.png");
- }
+ MinecraftForgeClient.overrideTexture(Item.itemsList[itemstack.itemID]);
+ }
Tessellator tessellator = Tessellator.instance;
float f6 = (float)((i % 16) * 16 + 0) / 256F;
float f8 = (float)((i % 16) * 16 + 16) / 256F;
@@ -92,6 +98,7 @@
float f14 = 0.25F;
if(field_27004_a)
{
+
int k = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage());
float f15 = (float)(k >> 16 & 0xff) / 255F;
float f17 = (float)(k >> 8 & 0xff) / 255F;
@@ -131,6 +138,7 @@
{
int j1 = i;
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
+ MinecraftForgeClient.overrideTexture (Block.blocksList[i]);
Block block = Block.blocksList[j1];
GL11.glPushMatrix();
GL11.glTranslatef(l - 2, i1 + 3, -3F);
@@ -159,9 +167,11 @@
if(i < 256)
{
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
+ MinecraftForgeClient.overrideTexture (Block.blocksList[i]);
} else
{
renderengine.bindTexture(renderengine.getTexture("/gui/items.png"));
+ MinecraftForgeClient.overrideTexture(Item.itemsList[i]);
}
int k1 = Item.itemsList[i].getColorFromDamage(j);
float f = (float)(k1 >> 16 & 0xff) / 255F;
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/WorldRenderer.java ../src_work/minecraft/net/minecraft/src/WorldRenderer.java
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,8 +3,12 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
+
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -138,14 +142,27 @@
}
Block block = Block.blocksList[i3];
int j3 = block.getRenderBlockPass();
+
+ if (block instanceof IMultipassRender) {
+ if (j3 != i2) {
+ flag = true;
+ }
+ IMultipassRender impr = (IMultipassRender) block;
+ if (impr.canRenderInPass(i2)) {
+ j3 = i2;
+ }
+ }
+
if(j3 != i2)
{
flag = true;
continue;
}
if(j3 == i2)
- {
+ {
+ MinecraftForgeClient.beforeBlockRender(block, renderblocks);
flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
+ MinecraftForgeClient.afterBlockRender(block, renderblocks);
}
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.util.*;
@@ -413,6 +414,10 @@
{
return false;
}
+ if(Block.blocksList[i1] instanceof IConnectRedstone) {
+ IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1];
+ return icr.canConnectRedstone(iblockaccess,i,j,k,l);
+ }
if(Block.blocksList[i1].canProvidePower())
{
return true;
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Chunk.java ../src_work/minecraft_server/net/minecraft/src/Chunk.java
--- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
import java.io.PrintStream;
import java.util.*;
@@ -227,6 +228,13 @@
}
int l1 = xPosition * 16 + i;
int i2 = zPosition * 16 + k;
+
+ if(Block.blocksList[k1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr=(IOverrideReplace)Block.blocksList[k1];
+ if(!iovr.canReplaceBlock(worldObj,l1,j,i2,l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
if(k1 != 0 && !worldObj.singleplayerWorld)
{
@@ -270,6 +278,13 @@
}
int k1 = xPosition * 16 + i;
int l1 = zPosition * 16 + k;
+
+ if(Block.blocksList[j1] instanceof IOverrideReplace) {
+ IOverrideReplace iovr=(IOverrideReplace)Block.blocksList[j1];
+ if(!iovr.canReplaceBlock(worldObj,k1,j,l1,l))
+ return iovr.getReplacedSuccess();
+ }
+
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
if(j1 != 0)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java
--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-07-31 21:44:50.000000000 -0400
@@ -6,6 +6,8 @@
import java.util.*;
+import net.minecraft.src.forge.ISpecialArmor;
+
// Referenced classes of package net.minecraft.src:
// EntityLiving, InventoryPlayer, ContainerPlayer, World,
// ChunkCoordinates, DataWatcher, Container, StatList,
@@ -457,6 +459,21 @@
protected void damageEntity(int i)
{
+ boolean doRegularComputation = true;
+ for (ItemStack stack : inventory.armorInventory) {
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
+
+ i = armor.adjustArmorDamage(i);
+ doRegularComputation = doRegularComputation
+ && armor.allowRegularComputation();
+ }
+ }
+
+ if (!doRegularComputation) {
+ super.damageEntity(i);
+ }
+
int j = 25 - inventory.getTotalArmorValue();
int k = i * j + damageRemainder;
inventory.damageArmor(i);
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Explosion.java ../src_work/minecraft_server/net/minecraft/src/Explosion.java
--- ../src_base/minecraft_server/net/minecraft/src/Explosion.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -65,7 +66,16 @@
int i5 = worldObj.getBlockId(j4, k4, l4);
if(i5 > 0)
{
- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ if(Block.blocksList[i5] instanceof ISpecialResistance) {
+ ISpecialResistance isr=(ISpecialResistance)
+ Block.blocksList[i5];
+ f1-=(isr.getSpecialExplosionResistance(
+ worldObj,j4,k4,l4,
+ explosionX,explosionY,explosionZ,
+ exploder) + 0.3F) * f2;
+ } else {
+ f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ }
}
if(f1 > 0.0F)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-31 21:44:50.000000000 -0400
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -55,6 +57,13 @@
}
if(isFull == 0)
{
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world,
+ i, j, k);
+
+ if (customBucket != null) {
+ return customBucket;
+ }
+
if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-07-31 21:44:50.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.*;
// Referenced classes of package net.minecraft.src:
@@ -145,6 +146,11 @@
public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if(itemstack!=null && itemstack.getItem() instanceof IUseItemFirst) {
+ IUseItemFirst iuif=(IUseItemFirst)itemstack.getItem();
+ if(iuif.onItemUseFirst(itemstack,entityplayer,world,i,j,k,l))
+ return true;
+ }
int i1 = world.getBlockId(i, j, k);
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemPickaxe.java ../src_work/minecraft_server/net/minecraft/src/ItemPickaxe.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemPickaxe.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemPickaxe.java 2011-07-31 21:44:50.000000000 -0400
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// ItemTool, Block, EnumToolMaterial, Material
@@ -42,6 +44,9 @@
{
return toolMaterial.getHarvestLevel() >= 2;
}
+ if (MinecraftForge.canHarvestBlock(this, block)) {
+ return true;
+ }
if(block.blockMaterial == Material.rock)
{
return true;
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemTool.java ../src_work/minecraft_server/net/minecraft/src/ItemTool.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 2011-07-31 21:49:37.000000000 -0400
@@ -4,6 +4,8 @@
package net.minecraft.src;
+import java.util.Arrays;
+
// Referenced classes of package net.minecraft.src:
// Item, EnumToolMaterial, ItemStack, Block,
@@ -58,4 +60,11 @@
private float efficiencyOnProperMaterial;
private int damageVsEntity;
protected EnumToolMaterial toolMaterial;
+
+ public void addBlockEffectiveAgainst (Block block) {
+ blocksEffectiveAgainst = Arrays.copyOf(blocksEffectiveAgainst,
+ blocksEffectiveAgainst.length + 1);
+
+ blocksEffectiveAgainst [blocksEffectiveAgainst.length-1] = block;
+ }
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java
--- ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-07-31 21:44:50.000000000 -0400
@@ -169,12 +169,11 @@
sendPacketToPlayersInInstance(new Packet52MultiBlockChange(chunkX, chunkZ, blocksToUpdate, numBlocksToUpdate, worldserver));
for(int k = 0; k < numBlocksToUpdate; k++)
{
- int j1 = chunkX * 16 + (numBlocksToUpdate >> 12 & 0xf);
- int i2 = numBlocksToUpdate & 0xff;
- int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf);
+ int j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf);
+ int i2 = blocksToUpdate[k] & 0xff;
+ int k2 = chunkZ * 16 + (blocksToUpdate[k] >> 8 & 0xf);
if(Block.isBlockContainer[worldserver.getBlockId(j1, i2, k2)])
{
- System.out.println("Sending!");
updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2));
}
}
+59
View File
@@ -0,0 +1,59 @@
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java
--- ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java 2011-07-17 00:28:07.755771900 +0200
+++ ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java 2011-07-17 00:28:09.485870900 +0200
@@ -333,41 +333,22 @@
}
finally
{
- System.exit(0);
+ try
+ {
+ stopServer();
+ serverStopped = true;
+ }
+ catch(Throwable throwable2)
+ {
+ throwable2.printStackTrace();
+ }
+ finally
+ {
+ System.exit(0);
+ }
}
- break MISSING_BLOCK_LABEL_350;
- }
- try
- {
- stopServer();
- serverStopped = true;
- }
- catch(Throwable throwable)
- {
- throwable.printStackTrace();
- }
- finally
- {
- System.exit(0);
- }
- break MISSING_BLOCK_LABEL_350;
- Exception exception2;
- exception2;
- try
- {
- stopServer();
- serverStopped = true;
- }
- catch(Throwable throwable3)
- {
- throwable3.printStackTrace();
- }
- finally
- {
- System.exit(0);
- }
- throw exception2;
}
+}
private void doTick()
{
+63
View File
@@ -0,0 +1,63 @@
version=$1
build_dir=`pwd`
dir=`pwd`/../forge-$version
function remove_svn () {
(
cd $1
if [ -d .svn ]; then
rm -rf .svn
fi
for j in `ls`
do
if [ -d $j ]; then
remove_svn $j
fi
done
)
}
function package_all () {
qual=$1
zip -r $dir/minecraftforge$qual-$version.zip \
*.class \
forge
}
cd ../reobf
remove_svn .
rm -rf $dir
mkdir $dir
cd minecraft
package_all "-client"
cd ../minecraft_server
package_all "-server"
cd ../..
rm -rf reobf
cd $build_dir
mkdir src
mkdir src/minecraft
mkdir src/minecraft_server
cp -r forge_client/src/* src/minecraft
cp -r forge_server/src/* src/minecraft_server
cp -r forge_common/* src/minecraft
cp -r forge_common/* src/minecraft_server
cp minecraft.patch src
cd src
remove_svn .
cd ..
zip -r $dir/minecraftforge-src-$version.zip src doc
rm -rf src
+13
View File
@@ -0,0 +1,13 @@
cmd /C build.bat
cd ..
cmd /C reobfuscate.bat
set PATH=E:\cygwin\bin;%PATH%
cd forge
sh package.sh 1.0.0
pause
+25
View File
@@ -0,0 +1,25 @@
set CYGWIN=E:\cygwin\bin
cd ..
rmdir /S /Q src
IF EXIST src_base (
move src_base src
rmdir /S /Q src_work
) ELSE (
cmd /C decompile.bat
cd src
%CYGWIN%\patch -u -p2 < ..\forge\modLoaderMP.patch
cd ..
cmd /C recompile.bat
cmd /C updatemd5.bat
)
mkdir src_base
mkdir src_work
xcopy /Y /E src\* src_base
xcopy /Y /E src\* src_work
cd src_work
%CYGWIN%\patch -u -p2 < ..\forge\minecraft.patch
pause
+5
View File
@@ -0,0 +1,5 @@
rm minecraft.patch
touch minecraft.patch
diff -u ../src_base ../src_work -r --strip-trailing-cr | tr -d '\r' \
>> minecraft.patch
Binary file not shown.
-5
View File
@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
Vendored
-172
View File
@@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
-84
View File
@@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

-26
View File
@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!--The ID below indicates application support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates application support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application supprort for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<!-- following stuff is so the EXE doesnt ask for admin access -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
-53
View File
@@ -1,53 +0,0 @@
-------------------------------------------
Source installation information for modders
-------------------------------------------
This code follows the Minecraft Forge installation methodology. It will apply
some small patches to the vanilla MCP source code, giving you and it access
to some of the data and functions you need to build a successful mod.
Note also that the patches are built against "unrenamed" MCP source code (aka
srgnames) - this means that you will not be able to read them directly against
normal code.
Source pack installation information:
Standalone source installation
==============================
See the Forge Documentation online for more detailed instructions:
http://mcforge.readthedocs.io/en/latest/gettingstarted/
Step 1: Open your command-line and browse to the folder where you extracted the zip file.
Step 2: You're left with a choice.
If you prefer to use Eclipse:
1. Run the following command: "gradlew genEclipseRuns" (./gradlew genEclipseRuns if you are on Mac/Linux)
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
or run "gradlew eclipse" to generate the project.
(Current Issue)
4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment
5. Edit MOD_CLASSES to show [modid]%%[Path]; 2 times rather then the generated 4.
If you prefer to use IntelliJ:
1. Open IDEA, and import project.
2. Select your build.gradle file and have it import.
3. Run the following command: "gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux)
4. Refresh the Gradle Project in IDEA if required.
If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again.
Should it still not work,
Refer to #ForgeGradle on EsperNet for more information about the gradle environment.
or the Forge Project Discord discord.gg/UvedJ9m
Forge source installation
=========================
MinecraftForge ships with this code and installs it as part of the forge
installation process, no further action is required on your part.
LexManos' Install Video
=======================
https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be
For more details update more often refer to the Forge Forums:
http://www.minecraftforge.net/forum/index.php/topic,14048.0.html
-151
View File
@@ -1,151 +0,0 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
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'
apply plugin: 'maven-publish'
version = '1.0'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'modid'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// 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@'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
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
}
}
}
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
}
}
}
data {
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'
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
examplemod {
source sourceSets.main
}
}
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"
// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "examplemod",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
// Example configuration to allow publishing using the maven-publish task
// 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 jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
-5
View File
@@ -1,5 +0,0 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
-25
View File
@@ -1,25 +0,0 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# idea
out
*.ipr
*.iws
*.iml
.idea
# gradle
build
.gradle
# other
eclipse
run
# Files from Forge MDK
forge*changelog.txt
-4
View File
@@ -1,4 +0,0 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
@@ -1,84 +0,0 @@
package com.example.examplemod;
import net.minecraft.block.Block;
import net.minecraft.block.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 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")
public class ExampleMod
{
// Directly reference a log4j logger.
private static final Logger LOGGER = LogManager.getLogger();
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);
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}
private void setup(final FMLCommonSetupEvent event)
{
// some preinit code
LOGGER.info("HELLO FROM PREINIT");
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
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)
{
// 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");
}
}
}
-62
View File
@@ -1,62 +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="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="All rights reserved"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #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
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
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 https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #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="[@FORGE_SPEC_VERSION@,)" #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
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@)"
ordering="NONE"
side="BOTH"
-7
View File
@@ -1,7 +0,0 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 6,
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
}
}
@@ -1,20 +0,0 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -572,10 +572,17 @@
GL13.glClientActiveTexture(p_227747_0_);
}
+ /* Stores the last values sent into glMultiTexCoord2f */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
@Deprecated
public static void func_227640_a_(int p_227640_0_, float p_227640_1_, float p_227640_2_) {
RenderSystem.assertThread(RenderSystem::isOnRenderThread);
GL13.glMultiTexCoord2f(p_227640_0_, p_227640_1_, p_227640_2_);
+ if (p_227640_0_ == GL13.GL_TEXTURE1) {
+ lastBrightnessX = p_227640_1_;
+ lastBrightnessY = p_227640_2_;
+ }
}
public static void func_227706_d_(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) {
@@ -1,25 +0,0 @@
--- a/com/mojang/blaze3d/vertex/IVertexBuilder.java
+++ b/com/mojang/blaze3d/vertex/IVertexBuilder.java
@@ -18,7 +18,7 @@
import org.lwjgl.system.MemoryStack;
@OnlyIn(Dist.CLIENT)
-public interface IVertexBuilder {
+public interface IVertexBuilder extends net.minecraftforge.client.extensions.IForgeVertexBuilder {
Logger field_227884_f_ = LogManager.getLogger();
IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_);
@@ -96,11 +96,12 @@
f5 = p_227890_3_[k] * p_227890_6_;
}
- int l = p_227890_7_[k];
+ int l = applyBakedLighting(p_227890_7_[k], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
vector4f.func_229372_a_(matrix4f);
+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.func_227872_b_());
this.func_225588_a_(vector4f.func_195910_a(), vector4f.func_195913_b(), vector4f.func_195914_c(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.func_195899_a(), vector3f.func_195900_b(), vector3f.func_195902_c());
}
}
@@ -1,18 +0,0 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
@@ -63,6 +63,15 @@
}));
}
+ @Override
+ public boolean func_231046_a_(int key, int scanCode, int modifiers) {
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
+ field_230706_i_.func_147108_a(this.field_224228_a);
+ return true;
+ }
+ return super.func_231046_a_(key, scanCode, modifiers);
+ }
+
public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
this.func_230446_a_(p_230430_1_);
func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_224229_b, this.field_230708_k_ / 2, 80, 16777215);
@@ -1,10 +0,0 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -309,6 +309,7 @@
}
public static Advancement.Builder func_241043_a_(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) {
+ if ((p_241043_0_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_241043_0_)) == null) return null;
ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.func_151200_h(p_241043_0_, "parent")) : null;
DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.func_192294_a(JSONUtils.func_152754_s(p_241043_0_, "display")) : null;
AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.func_241096_a_(JSONUtils.func_152754_s(p_241043_0_, "rewards")) : AdvancementRewards.field_192114_a;
@@ -1,10 +0,0 @@
--- a/net/minecraft/advancements/AdvancementList.java
+++ b/net/minecraft/advancements/AdvancementList.java
@@ -96,6 +96,7 @@
}
}
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.field_192093_c);
field_192091_a.info("Loaded {} advancements", (int)this.field_192092_b.size());
}
@@ -1,13 +0,0 @@
--- a/net/minecraft/advancements/AdvancementManager.java
+++ b/net/minecraft/advancements/AdvancementManager.java
@@ -36,6 +36,10 @@
try {
JsonObject jsonobject = JSONUtils.func_151210_l(p_240923_3_, "advancement");
Advancement.Builder advancement$builder = Advancement.Builder.func_241043_a_(jsonobject, new ConditionArrayParser(p_240923_2_, this.field_240922_d_));
+ if (advancement$builder == null) {
+ field_192782_a.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_);
+ return;
+ }
map.put(p_240923_2_, advancement$builder);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
field_192782_a.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage());
@@ -1,11 +0,0 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -39,7 +39,7 @@
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_237457_g_, p_192113_1_.func_213303_ch()).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_237457_g_, p_192113_1_.func_213303_ch()).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) {
@@ -1,30 +0,0 @@
--- a/net/minecraft/advancements/PlayerAdvancements.java
+++ b/net/minecraft/advancements/PlayerAdvancements.java
@@ -159,6 +159,10 @@
}
this.func_240920_c_(p_240921_1_);
+
+ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get())
+ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c);
+ else
this.func_192752_d();
this.func_240919_b_(p_240921_1_);
}
@@ -192,6 +196,8 @@
}
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();
@@ -204,6 +210,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_223586_b(GameRules.field_223620_w)) {
this.field_240917_e_.func_232641_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()), ChatType.SYSTEM, Util.field_240973_b_);
}
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
}
}
@@ -1,38 +0,0 @@
--- a/net/minecraft/advancements/criterion/ItemPredicate.java
+++ b/net/minecraft/advancements/criterion/ItemPredicate.java
@@ -26,6 +26,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 ITag<Item> field_200018_b;
@@ -105,6 +107,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")) {
@@ -204,6 +211,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();
private final List<EnchantmentPredicate> field_226657_b_ = Lists.newArrayList();
@@ -1,165 +0,0 @@
--- a/net/minecraft/block/AbstractBlock.java
+++ b/net/minecraft/block/AbstractBlock.java
@@ -60,7 +60,8 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public abstract class AbstractBlock {
+//TODO, Delegates are weird here now, because Block extends this.
+public abstract class AbstractBlock extends net.minecraftforge.registries.ForgeRegistryEntry<Block> {
protected static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
protected final Material field_149764_J;
protected final boolean field_235688_at_;
@@ -87,6 +88,8 @@
this.field_226887_g_ = p_i241196_1_.field_226894_k_;
this.field_208621_p = p_i241196_1_.field_208772_j;
this.field_235684_aB_ = p_i241196_1_;
+ final ResourceLocation lootTableCache = p_i241196_1_.field_222381_j;
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a());
}
@Deprecated
@@ -129,7 +132,7 @@
@Deprecated
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 (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) {
+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.func_203425_a(p_196243_4_.func_177230_c()) || !p_196243_4_.hasTileEntity())) {
p_196243_2_.func_175713_t(p_196243_3_);
}
@@ -191,7 +194,7 @@
@Deprecated
public boolean func_196253_a(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
- return this.field_149764_J.func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
+ return p_196253_1_.func_185904_a().func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
}
@Deprecated
@@ -294,8 +297,8 @@
if (f == -1.0F) {
return 0.0F;
} else {
- int i = p_180647_2_.func_234569_d_(p_180647_1_) ? 30 : 100;
- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i;
+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100;
+ return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i;
}
}
@@ -321,14 +324,14 @@
return 0;
}
+ @Deprecated //Forge: Use state.hasTileEntity()
public final boolean func_235695_q_() {
return this instanceof ITileEntityProvider;
}
public final ResourceLocation func_220068_i() {
if (this.field_220085_g == null) {
- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this.func_230328_p_());
- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a());
+ this.field_220085_g = this.lootTableSupplier.get();
}
return this.field_220085_g;
@@ -346,6 +349,14 @@
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
}
+ protected boolean isAir(BlockState state) {
+ return ((AbstractBlockState)state).field_235702_f_;
+ }
+
+ /* ======================================== FORGE START ===================================== */
+ private final java.util.function.Supplier<ResourceLocation> lootTableSupplier;
+ /* ========================================= FORGE END ====================================== */
+
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
private final int field_215708_d;
private final boolean field_215709_e;
@@ -428,14 +439,18 @@
return this.field_215708_d;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
public boolean func_196958_f() {
- return this.field_235702_f_;
+ return this.func_177230_c().isAir((BlockState)this);
}
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
return this.field_235704_h_;
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
+ @Deprecated
public BlockState func_185907_a(Rotation p_185907_1_) {
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
}
@@ -802,6 +817,9 @@
private ResourceLocation field_222381_j;
private boolean field_226895_m_ = true;
private boolean field_235813_o_;
+ private int harvestLevel = -1;
+ private net.minecraftforge.common.ToolType harvestTool;
+ private java.util.function.Supplier<ResourceLocation> lootTableSupplier;
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14;
};
@@ -863,6 +881,8 @@
abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_;
abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_;
abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_;
+ abstractblock$properties.harvestLevel = p_200950_0_.field_235684_aB_.harvestLevel;
+ abstractblock$properties.harvestTool = p_200950_0_.field_235684_aB_.harvestTool;
return abstractblock$properties;
}
@@ -877,6 +897,24 @@
return this;
}
+ public AbstractBlock.Properties harvestLevel(int harvestLevel) {
+ this.harvestLevel = harvestLevel;
+ return this;
+ }
+
+ public AbstractBlock.Properties harvestTool(net.minecraftforge.common.ToolType harvestTool) {
+ this.harvestTool = harvestTool;
+ return this;
+ }
+
+ public int getHarvestLevel() {
+ return this.harvestLevel;
+ }
+
+ public net.minecraftforge.common.ToolType getHarvestTool() {
+ return this.harvestTool;
+ }
+
public AbstractBlock.Properties func_200941_a(float p_200941_1_) {
this.field_200961_i = p_200941_1_;
return this;
@@ -932,11 +970,17 @@
return this;
}
+ @Deprecated // FORGE: Use the variant that takes a Supplier below
public AbstractBlock.Properties func_222379_b(Block p_222379_1_) {
- this.field_222381_j = p_222379_1_.func_220068_i();
+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().func_220068_i();
return this;
}
+ public AbstractBlock.Properties lootFrom(java.util.function.Supplier<? extends Block> blockIn) {
+ this.lootTableSupplier = () -> blockIn.get().func_220068_i();
+ return this;
+ }
+
public AbstractBlock.Properties func_235859_g_() {
this.field_235813_o_ = true;
return this;
@@ -1,10 +0,0 @@
--- a/net/minecraft/block/AbstractFireBlock.java
+++ b/net/minecraft/block/AbstractFireBlock.java
@@ -124,6 +124,7 @@
if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) {
if (func_242649_a(p_220082_2_)) {
Optional<PortalSize> optional = PortalSize.func_242964_a(p_220082_2_, p_220082_3_, Direction.Axis.X);
+ optional = net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_220082_2_, p_220082_3_, optional);
if (optional.isPresent()) {
optional.get().func_150859_c();
return;
@@ -1,58 +0,0 @@
--- a/net/minecraft/block/AbstractRailBlock.java
+++ b/net/minecraft/block/AbstractRailBlock.java
@@ -13,7 +13,7 @@
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
-public abstract class AbstractRailBlock extends Block {
+public abstract class AbstractRailBlock extends Block implements net.minecraftforge.common.extensions.IAbstractRailBlock {
protected static final VoxelShape field_185590_a = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
protected static final VoxelShape field_190959_b = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
private final boolean field_196277_c;
@@ -37,6 +37,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_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
+ RailShape railShape2 = p_220053_1_.func_203425_a(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;
}
@@ -61,7 +62,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 && p_220069_2_.func_180495_p(p_220069_3_).func_203425_a(this)) {
- 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);
if (func_235328_a_(p_220069_3_, p_220069_2_, railshape)) {
func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_);
p_220069_2_.func_217377_a(p_220069_3_, p_220069_6_);
@@ -110,7 +111,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);
}
@@ -129,5 +130,20 @@
return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
}
+ @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract Property<RailShape> func_176560_l();
+
+ /* ======================================== FORGE START =====================================*/
+
+ @Override
+ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
+ {
+ return !this.field_196277_c;
+ }
+
+ @Override
+ 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());
+ }
+ /* ========================================= FORGE END ======================================*/
}
@@ -1,15 +0,0 @@
--- a/net/minecraft/block/AbstractTopPlantBlock.java
+++ b/net/minecraft/block/AbstractTopPlantBlock.java
@@ -32,10 +32,11 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && p_225542_4_.nextDouble() < this.field_235503_e_) {
+ if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.func_177972_a(this.field_235498_a_), p_225542_2_.func_180495_p(p_225542_3_.func_177972_a(this.field_235498_a_)),p_225542_4_.nextDouble() < this.field_235503_e_)) {
BlockPos blockpos = p_225542_3_.func_177972_a(this.field_235498_a_);
if (this.func_230334_h_(p_225542_2_.func_180495_p(blockpos))) {
p_225542_2_.func_175656_a(blockpos, p_225542_1_.func_235896_a_(field_235502_d_));
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.func_180495_p(blockpos));
}
}
@@ -1,16 +0,0 @@
--- a/net/minecraft/block/BambooBlock.java
+++ b/net/minecraft/block/BambooBlock.java
@@ -100,10 +100,11 @@
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
if (p_225542_1_.func_177229_b(field_220266_f) == 0) {
- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
+ if (p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
int i = this.func_220260_b(p_225542_2_, p_225542_3_) + 1;
- if (i < 16) {
+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0)) {
this.func_220258_a(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
@@ -1,19 +0,0 @@
--- a/net/minecraft/block/BeehiveBlock.java
+++ b/net/minecraft/block/BeehiveBlock.java
@@ -85,6 +85,7 @@
List<BeeEntity> list = p_226881_1_.func_217357_a(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).func_72314_b(8.0D, 6.0D, 8.0D));
if (!list.isEmpty()) {
List<PlayerEntity> list1 = p_226881_1_.func_217357_a(PlayerEntity.class, (new AxisAlignedBB(p_226881_2_)).func_72314_b(8.0D, 6.0D, 8.0D));
+ if (list1.isEmpty()) return; //Forge: Prevent Error when no players are around.
int i = list1.size();
for(BeeEntity beeentity : list) {
@@ -105,7 +106,7 @@
int i = p_225533_1_.func_177229_b(field_226873_c_);
boolean flag = false;
if (i >= 5) {
- if (itemstack.func_77973_b() == Items.field_151097_aZ) {
+ if (itemstack.func_77973_b() instanceof net.minecraft.item.ShearsItem) {
p_225533_2_.func_184148_a(p_225533_4_, p_225533_4_.func_226277_ct_(), p_225533_4_.func_226278_cu_(), p_225533_4_.func_226281_cx_(), SoundEvents.field_226133_ah_, SoundCategory.NEUTRAL, 1.0F, 1.0F);
func_226878_a_(p_225533_2_, p_225533_3_);
itemstack.func_222118_a(1, p_225533_4_, (p_226874_1_) -> {
@@ -1,176 +0,0 @@
--- a/net/minecraft/block/Block.java
+++ b/net/minecraft/block/Block.java
@@ -54,9 +54,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class Block extends AbstractBlock implements IItemProvider {
+public class Block extends AbstractBlock implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
protected static final Logger field_196273_d = LogManager.getLogger();
- public static final ObjectIntIdentityMap<BlockState> field_176229_d = new ObjectIntIdentityMap<>();
+ @Deprecated //Forge: Do not use, use GameRegistry
+ public static final ObjectIntIdentityMap<BlockState> field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap();
private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
public Boolean load(VoxelShape p_load_1_) {
return !VoxelShapes.func_197879_c(VoxelShapes.func_197868_b(), p_load_1_, IBooleanFunction.field_223236_g_);
@@ -151,6 +152,8 @@
super(p_i48440_1_);
StateContainer.Builder<Block, BlockState> builder = new StateContainer.Builder<>(this);
this.func_206840_a(builder);
+ this.harvestLevel = p_i48440_1_.getHarvestLevel();
+ this.harvestTool = p_i48440_1_.getHarvestTool();
this.field_176227_L = builder.func_235882_a_(Block::func_176223_P, BlockState::new);
this.func_180632_j(this.field_176227_L.func_177621_b());
}
@@ -261,7 +264,7 @@
}
public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) {
- if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180635_0_.restoringBlockSnapshots) {
float f = 0.5F;
double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
@@ -273,7 +276,7 @@
}
public void func_180637_b(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) {
- if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
+ if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180637_1_.restoringBlockSnapshots) {
while(p_180637_3_ > 0) {
int i = ExperienceOrbEntity.func_70527_a(p_180637_3_);
p_180637_3_ -= i;
@@ -283,6 +286,7 @@
}
+ @Deprecated //Forge: Use more sensitive version
public float func_149638_a() {
return this.field_235689_au_;
}
@@ -332,6 +336,7 @@
p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D));
}
+ @Deprecated //Forge: Use more sensitive version
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
return new ItemStack(this);
}
@@ -363,6 +368,7 @@
public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) {
}
+ @Deprecated //Forge: Use more sensitive version
public boolean func_149659_a(Explosion p_149659_1_) {
return true;
}
@@ -382,6 +388,7 @@
return this.field_196275_y;
}
+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) }
public SoundType func_220072_p(BlockState p_220072_1_) {
return this.field_149762_H;
}
@@ -391,7 +398,7 @@
this.field_220086_i = Item.func_150898_a(this);
}
- return this.field_220086_i;
+ return this.field_220086_i.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
}
public boolean func_208619_r() {
@@ -399,7 +406,7 @@
}
public String toString() {
- return "Block{" + Registry.field_212618_g.func_177774_c(this) + "}";
+ return "Block{" + getRegistryName() + "}";
}
@OnlyIn(Dist.CLIENT)
@@ -410,6 +417,83 @@
return this;
}
+ /* ======================================== FORGE START =====================================*/
+ protected Random RANDOM = new Random();
+ private net.minecraftforge.common.ToolType harvestTool;
+ private int harvestLevel;
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::func_199896_a);
+
+ @Override
+ public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) {
+ return this.field_149765_K;
+ }
+
+ @Nullable
+ @Override
+ public net.minecraftforge.common.ToolType getHarvestTool(BlockState state) {
+ return harvestTool; //TODO: RE-Evaluate
+ }
+
+ @Override
+ public int getHarvestLevel(BlockState state) {
+ return harvestLevel; //TODO: RE-Evaluate
+ }
+
+ @Override
+ public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, net.minecraftforge.common.IPlantable plantable) {
+ BlockState plant = plantable.getPlant(world, pos.func_177972_a(facing));
+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.func_177972_a(facing));
+
+ if (plant.func_177230_c() == Blocks.field_150434_aF)
+ return state.func_203425_a(Blocks.field_150434_aF) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+
+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF)
+ return true;
+
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos))
+ return true;
+
+ if (net.minecraftforge.common.PlantType.DESERT.equals(type)) {
+ return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock;
+ } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) {
+ return this.getBlock() == Blocks.field_150425_aM;
+ } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) {
+ return state.func_203425_a(Blocks.field_150458_ak);
+ } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) {
+ return state.func_224755_d(world, pos, Direction.UP);
+ } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) {
+ return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak;
+ } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) {
+ return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
+ } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) {
+ boolean isBeach = state.func_203425_a(Blocks.field_196658_i) || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+ boolean hasWater = false;
+ for (Direction face : Direction.Plane.HORIZONTAL) {
+ BlockState blockState = world.func_180495_p(pos.func_177972_a(face));
+ net.minecraft.fluid.FluidState fluidState = world.func_204610_c(pos.func_177972_a(face));
+ hasWater |= blockState.func_203425_a(Blocks.field_185778_de);
+ hasWater |= fluidState.func_206884_a(net.minecraft.tags.FluidTags.field_206959_a);
+ if (hasWater)
+ break; //No point continuing.
+ }
+ return isBeach && hasWater;
+ }
+ return false;
+ }
+
+ @Override
+ public final java.util.Set<net.minecraft.util.ResourceLocation> getTags() {
+ return reverseTags.getTagNames();
+ }
+
+ static {
+ net.minecraftforge.common.ForgeHooks.setBlockToolSetter((block, tool, level) -> {
+ block.harvestTool = tool;
+ block.harvestLevel = level;
+ });
+ }
+ /* ========================================= FORGE END ======================================*/
+
public static final class RenderSideCacheKey {
private final BlockState field_212164_a;
private final BlockState field_212165_b;
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/BlockState.java
+++ b/net/minecraft/block/BlockState.java
@@ -6,7 +6,7 @@
import net.minecraft.state.Property;
import net.minecraft.util.registry.Registry;
-public class BlockState extends AbstractBlock.AbstractBlockState {
+public class BlockState extends AbstractBlock.AbstractBlockState implements net.minecraftforge.common.extensions.IForgeBlockState {
public static final Codec<BlockState> field_235877_b_ = func_235897_a_(Registry.field_212618_g, Block::func_176223_P).stable();
public BlockState(Block p_i231876_1_, ImmutableMap<Property<?>, Comparable<?>> p_i231876_2_, MapCodec<BlockState> p_i231876_3_) {
@@ -1,35 +0,0 @@
--- a/net/minecraft/block/Blocks.java
+++ b/net/minecraft/block/Blocks.java
@@ -25,6 +25,7 @@
import net.minecraft.world.IBlockReader;
import net.minecraft.world.gen.feature.Features;
[email protected]("minecraft")
public class Blocks {
public static final Block field_150350_a = func_222382_a("air", new AirBlock(AbstractBlock.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e().func_235859_g_()));
public static final Block field_150348_b = func_222382_a("stone", new Block(AbstractBlock.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_235861_h_().func_200948_a(1.5F, 6.0F)));
@@ -119,7 +120,7 @@
public static final Block field_196601_az = func_222382_a("green_bed", func_235422_a_(DyeColor.GREEN));
public static final Block field_196550_aA = func_222382_a("red_bed", func_235422_a_(DyeColor.RED));
public static final Block field_196551_aB = func_222382_a("black_bed", func_235422_a_(DyeColor.BLACK));
- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true));
public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
public static final Block field_150320_F = func_222382_a("sticky_piston", func_235432_a_(true));
public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(AbstractBlock.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_235861_h_().func_200943_b(4.0F)));
@@ -937,15 +938,4 @@
public static void func_235419_a_() {
Block.field_176229_d.forEach(AbstractBlock.AbstractBlockState::func_215692_c);
}
-
- static {
- for(Block block : Registry.field_212618_g) {
- for(BlockState blockstate : block.func_176194_O().func_177619_a()) {
- Block.field_176229_d.func_195867_b(blockstate);
- }
-
- block.func_220068_i();
- }
-
- }
}
@@ -1,32 +0,0 @@
--- a/net/minecraft/block/BushBlock.java
+++ b/net/minecraft/block/BushBlock.java
@@ -7,7 +7,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
-public class BushBlock extends Block {
+public class BushBlock extends Block implements net.minecraftforge.common.IPlantable {
public BushBlock(AbstractBlock.Properties p_i48437_1_) {
super(p_i48437_1_);
}
@@ -22,6 +22,8 @@
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos blockpos = p_196260_3_.func_177977_b();
+ if (p_196260_1_.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.
+ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos);
}
@@ -32,4 +34,11 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return p_196266_4_ == PathType.AIR && !this.field_235688_at_ ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
}
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ BlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() != this) return func_176223_P();
+ return state;
+ }
}
@@ -1,61 +0,0 @@
--- a/net/minecraft/block/CactusBlock.java
+++ b/net/minecraft/block/CactusBlock.java
@@ -19,7 +19,7 @@
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
-public class CactusBlock extends Block {
+public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable {
public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X;
protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D);
protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
@@ -30,6 +30,7 @@
}
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) {
p_225534_2_.func_175655_b(p_225534_3_, true);
}
@@ -45,6 +46,7 @@
if (i < 3) {
int j = p_225542_1_.func_177229_b(field_176587_a);
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
if (j == 15) {
p_225542_2_.func_175656_a(blockpos, this.func_176223_P());
BlockState blockstate = p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
@@ -53,7 +55,8 @@
} else {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
+ }
}
}
}
@@ -84,7 +87,7 @@
}
BlockState blockstate1 = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
- return (blockstate1.func_203425_a(Blocks.field_150434_aF) || blockstate1.func_203425_a(Blocks.field_150354_m) || blockstate1.func_203425_a(Blocks.field_196611_F)) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -98,4 +101,14 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.DESERT;
+ }
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ return func_176223_P();
+ }
}
@@ -1,20 +0,0 @@
--- a/net/minecraft/block/CampfireBlock.java
+++ b/net/minecraft/block/CampfireBlock.java
@@ -181,7 +181,7 @@
public void func_220066_a(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) {
if (!p_220066_1_.field_72995_K && p_220066_4_.func_70027_ad()) {
Entity entity = p_220066_4_.func_234616_v_();
- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
+ boolean flag = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity);
if (flag && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) {
BlockPos blockpos = p_220066_3_.func_216350_a();
p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11);
@@ -208,7 +208,7 @@
return true;
}
- boolean flag = VoxelShapes.func_197879_c(field_226912_f_, blockstate.func_215685_b(p_235474_0_, p_235474_1_, ISelectionContext.func_216377_a()), IBooleanFunction.field_223238_i_);
+ boolean flag = VoxelShapes.func_197879_c(field_226912_f_, blockstate.func_215685_b(p_235474_0_, blockpos, ISelectionContext.func_216377_a()), IBooleanFunction.field_223238_i_);//Forge fix: MC-201374
if (flag) {
BlockState blockstate1 = p_235474_0_.func_180495_p(blockpos.func_177977_b());
return func_226915_i_(blockstate1);
@@ -1,47 +0,0 @@
--- a/net/minecraft/block/ChorusFlowerBlock.java
+++ b/net/minecraft/block/ChorusFlowerBlock.java
@@ -40,7 +40,7 @@
BlockPos blockpos = p_225542_3_.func_177984_a();
if (p_225542_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
int i = p_225542_1_.func_177229_b(field_185607_a);
- if (i < 5) {
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
boolean flag = false;
boolean flag1 = false;
BlockState blockstate = p_225542_2_.func_180495_p(p_225542_3_.func_177977_b());
@@ -65,7 +65,7 @@
if (j < 2 || j <= p_225542_4_.nextInt(flag1 ? 5 : 4)) {
flag = true;
}
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) {
flag = true;
}
@@ -97,7 +97,7 @@
} else {
this.func_185605_c(p_225542_2_, p_225542_3_);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
}
@@ -133,7 +133,7 @@
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
if (blockstate.func_177230_c() != this.field_196405_b && !blockstate.func_203425_a(Blocks.field_150377_bs)) {
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) {
return false;
} else {
boolean flag = false;
@@ -146,7 +146,7 @@
}
flag = true;
- } else if (!blockstate1.func_196958_f()) {
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) {
return false;
}
}
@@ -1,16 +0,0 @@
--- a/net/minecraft/block/CocoaBlock.java
+++ b/net/minecraft/block/CocoaBlock.java
@@ -35,10 +35,11 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_2_.field_73012_v.nextInt(5) == 0) {
+ if (true) {
int i = p_225542_1_.func_177229_b(field_176501_a);
- if (i < 2) {
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.field_73012_v.nextInt(5) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
@@ -1,19 +0,0 @@
--- a/net/minecraft/block/ComparatorBlock.java
+++ b/net/minecraft/block/ComparatorBlock.java
@@ -154,4 +154,16 @@
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c);
}
+
+ @Override
+ public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return state.func_203425_a(Blocks.field_196762_fd);
+ }
+
+ @Override
+ public void onNeighborChange(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) {
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) {
+ state.func_215697_a((World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor, false);
+ }
+ }
}
@@ -1,39 +0,0 @@
--- a/net/minecraft/block/CropsBlock.java
+++ b/net/minecraft/block/CropsBlock.java
@@ -61,12 +61,14 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) {
int i = this.func_185527_x(p_225542_1_);
if (i < this.func_185526_g()) {
float f = func_180672_a(this, p_225542_2_, p_225542_3_);
- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, this.func_185528_e(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
}
@@ -95,9 +97,9 @@
for(int j = -1; j <= 1; ++j) {
float f1 = 0.0F;
BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
- if (blockstate.func_203425_a(Blocks.field_150458_ak)) {
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable) p_180672_0_)) {
f1 = 1.0F;
- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) {
+ if (blockstate.isFertile(p_180672_1_, p_180672_2_.func_177982_a(i, 0, j))) {
f1 = 3.0F;
}
}
@@ -133,7 +135,7 @@
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) {
p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_);
}
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/DeadBushBlock.java
+++ b/net/minecraft/block/DeadBushBlock.java
@@ -5,7 +5,7 @@
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
-public class DeadBushBlock extends BushBlock {
+public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IForgeShearable {
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
public DeadBushBlock(AbstractBlock.Properties p_i48418_1_) {
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/DetectorRailBlock.java
+++ b/net/minecraft/block/DetectorRailBlock.java
@@ -131,6 +131,8 @@
}
List<AbstractMinecartEntity> list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b);
+ List<AbstractMinecartEntity> carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
if (!list1.isEmpty()) {
return Container.func_94526_b((IInventory)list1.get(0));
}
@@ -1,10 +0,0 @@
--- a/net/minecraft/block/DoublePlantBlock.java
+++ b/net/minecraft/block/DoublePlantBlock.java
@@ -51,6 +51,7 @@
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
} else {
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_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.
return blockstate.func_203425_a(this) && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER;
}
}
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/DropperBlock.java
+++ b/net/minecraft/block/DropperBlock.java
@@ -37,7 +37,7 @@
p_176439_1_.func_217379_c(1001, p_176439_2_, 0);
} else {
ItemStack itemstack = dispensertileentity.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_, dispensertileentity, i, itemstack)) {
Direction direction = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
IInventory iinventory = HopperTileEntity.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(direction));
ItemStack itemstack1;
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/EnchantingTableBlock.java
+++ b/net/minecraft/block/EnchantingTableBlock.java
@@ -54,7 +54,7 @@
if (p_180655_4_.nextInt(16) == 0) {
for(int k = 0; k <= 1; ++k) {
BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j);
- if (p_180655_2_.func_180495_p(blockpos).func_203425_a(Blocks.field_150342_X)) {
+ if (p_180655_2_.func_180495_p(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) {
if (!p_180655_2_.func_175623_d(p_180655_3_.func_177982_a(i / 2, 0, j / 2))) {
break;
}
Loaded 100 of 2113 files, more files were not shown because too many files have changed in this diff. Show more