mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 17:14:44 +00:00
Compare commits
314
Commits
v164-pregradle
...
mc172
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e08c63b57b | ||
|
|
db1e2c863d | ||
|
|
ea7be67db2 | ||
|
|
6144650579 | ||
|
|
6998e76d3f | ||
|
|
bcda92e941 | ||
|
|
013c0b0feb | ||
|
|
24c05a73ce | ||
|
|
4c26057a4e | ||
|
|
1275aa732e | ||
|
|
4778c33902 | ||
|
|
127605ec3e | ||
|
|
f7736e9a0a | ||
|
|
ea7c11baf4 | ||
|
|
755dd9b954 | ||
|
|
a21ad8fa9d | ||
|
|
9701e944c2 | ||
|
|
a905fe578b | ||
|
|
5ac6f2289b | ||
|
|
e68cfa9f72 | ||
|
|
bb15efd037 | ||
|
|
7d700c9ad2 | ||
|
|
61a6b67d51 | ||
|
|
96286b77f9 | ||
|
|
7b6b88b002 | ||
|
|
1b7190c50b | ||
|
|
e6bbcf6a3d | ||
|
|
b12e0bff2a | ||
|
|
aaccbb8247 | ||
|
|
c45ed6f6d8 | ||
|
|
dd5b51aac1 | ||
|
|
27d9edac67 | ||
|
|
a08357a845 | ||
|
|
9a3bc1fff5 | ||
|
|
4ae1abd7d4 | ||
|
|
d5a4ee2c10 | ||
|
|
5849458443 | ||
|
|
7a43d2f96a | ||
|
|
b0195f31e4 | ||
|
|
58e69af1b3 | ||
|
|
03ae909762 | ||
|
|
04c2ed554d | ||
|
|
f3cbc6c262 | ||
|
|
42fc3c9516 | ||
|
|
b301b1f70c | ||
|
|
eb1ddab278 | ||
|
|
0456c4d5ae | ||
|
|
fa3feda0d5 | ||
|
|
f2a33ea9f6 | ||
|
|
e7f492a15b | ||
|
|
5fe0a0ea5a | ||
|
|
2e152c52c4 | ||
|
|
7f018dad0f | ||
|
|
deb5df542e | ||
|
|
4a6a49e073 | ||
|
|
0737601dbf | ||
|
|
0a56e19d47 | ||
|
|
5f90e0788b | ||
|
|
36ab17474b | ||
|
|
96ee4caf39 | ||
|
|
3980bf79da | ||
|
|
5eb99791b0 | ||
|
|
6924fef324 | ||
|
|
25ef7e3469 | ||
|
|
507f184144 | ||
|
|
bc1434ff04 | ||
|
|
bab2de72bc | ||
|
|
fcc43e0aaa | ||
|
|
fc70334343 | ||
|
|
db52113a7e | ||
|
|
243aa60bf9 | ||
|
|
acf8e468f3 | ||
|
|
dc10db1d90 | ||
|
|
576a1294da | ||
|
|
8145de123e | ||
|
|
e530089639 | ||
|
|
d63a9b1b10 | ||
|
|
a3e8f0cbe4 | ||
|
|
7b062dd390 | ||
|
|
83e7130216 | ||
|
|
cdad2dc55a | ||
|
|
9d66c91c86 | ||
|
|
1c7341b982 | ||
|
|
5e6c346c7c | ||
|
|
3d9b5b1472 | ||
|
|
7578f0813b | ||
|
|
71b3ba2041 | ||
|
|
f95ca18707 | ||
|
|
711e92a59f | ||
|
|
26c55d89ef | ||
|
|
51b55eaf25 | ||
|
|
4454d3f341 | ||
|
|
bb52a6b062 | ||
|
|
80511409ff | ||
|
|
51628825e5 | ||
|
|
e625622b6e | ||
|
|
9e1f038c16 | ||
|
|
0b01545a03 | ||
|
|
c8abc41aa0 | ||
|
|
3b79370be1 | ||
|
|
eb2549c773 | ||
|
|
d881baa581 | ||
|
|
f81c0cb58f | ||
|
|
0fe2584b77 | ||
|
|
5fc3e7e913 | ||
|
|
2e1033b045 | ||
|
|
80fd60eaff | ||
|
|
f848955263 | ||
|
|
d01758e90d | ||
|
|
5f6e1167f4 | ||
|
|
63a205c043 | ||
|
|
022cefc72a | ||
|
|
3fa0c70f2b | ||
|
|
a008339c6e | ||
|
|
172ea90c59 | ||
|
|
cc08cb46c8 | ||
|
|
fd59ab261f | ||
|
|
2cef9c5cb2 | ||
|
|
cc54645bf3 | ||
|
|
2b40a5e3ce | ||
|
|
ae81ad58ea | ||
|
|
36298e2bfe | ||
|
|
7b19768c4c | ||
|
|
094d80fe66 | ||
|
|
bba42d4230 | ||
|
|
621fb050ce | ||
|
|
5fbc70173c | ||
|
|
72d22c5827 | ||
|
|
12e8d95e9f | ||
|
|
14b9d639a2 | ||
|
|
5f62afb5f2 | ||
|
|
33bf2c8a69 | ||
|
|
56084b584d | ||
|
|
b0bfea4e03 | ||
|
|
aa0c902d22 | ||
|
|
d9a1c718bf | ||
|
|
f436b3e62d | ||
|
|
8576fe6dbe | ||
|
|
1d2d0ea5cd | ||
|
|
5d43695710 | ||
|
|
0e1a1202d8 | ||
|
|
9d3a274cb6 | ||
|
|
2a2e201f4a | ||
|
|
0620a64813 | ||
|
|
05afb0c347 | ||
|
|
185b9f8368 | ||
|
|
ea2c07c727 | ||
|
|
1a9e13f880 | ||
|
|
d97ec2763c | ||
|
|
534b241e9f | ||
|
|
0513182e3c | ||
|
|
741a90c6bd | ||
|
|
68eb0d15dc | ||
|
|
8660d0471f | ||
|
|
0a6dc66749 | ||
|
|
488eb30272 | ||
|
|
d2d2032f93 | ||
|
|
58fde290f8 | ||
|
|
246152d3c4 | ||
|
|
ee7aa93416 | ||
|
|
bad0639e90 | ||
|
|
6f49bba302 | ||
|
|
b01d87f0c6 | ||
|
|
08a636c34f | ||
|
|
3322996885 | ||
|
|
b43d63a7ad | ||
|
|
c8e0b4a193 | ||
|
|
c4972b7658 | ||
|
|
8462f3b17c | ||
|
|
1e2c63f486 | ||
|
|
e68577ffd3 | ||
|
|
9d919f8ac9 | ||
|
|
67d9dac16d | ||
|
|
978bfd6eb1 | ||
|
|
539ee0ea88 | ||
|
|
f85ab543ee | ||
|
|
51414375e4 | ||
|
|
2b9a2b5c1a | ||
|
|
51b008c391 | ||
|
|
0d84da021f | ||
|
|
3059e517c5 | ||
|
|
f8f1b4211b | ||
|
|
30a390d4bf | ||
|
|
790030ab05 | ||
|
|
d73f4fb7b3 | ||
|
|
6f7ac27c96 | ||
|
|
6ae2353f41 | ||
|
|
c62061728b | ||
|
|
796b53f549 | ||
|
|
6c6f664c30 | ||
|
|
2e47771860 | ||
|
|
75a80f2f75 | ||
|
|
aaf6dd2b2e | ||
|
|
af011d1a57 | ||
|
|
e653204638 | ||
|
|
adf0e3ab7d | ||
|
|
eeef1137a8 | ||
|
|
49886aa633 | ||
|
|
28f7f523ee | ||
|
|
b917d48cff | ||
|
|
79ebdfa145 | ||
|
|
612a8a71b0 | ||
|
|
b93217397c | ||
|
|
baf95e747a | ||
|
|
eeeb4d37e8 | ||
|
|
b3d8e4ea68 | ||
|
|
b463476815 | ||
|
|
c71b7554e0 | ||
|
|
3c8bd6346f | ||
|
|
0296803fe3 | ||
|
|
b1f8af7f55 | ||
|
|
3c0ef2cce8 | ||
|
|
aab5b04a6d | ||
|
|
4e45156eaf | ||
|
|
9e91b0ca81 | ||
|
|
08eb897996 | ||
|
|
0da954cc10 | ||
|
|
a1b68d938d | ||
|
|
325423ab02 | ||
|
|
9523059d85 | ||
|
|
95c12b6c20 | ||
|
|
b6199c202e | ||
|
|
367c5d1ede | ||
|
|
ef5d66ebd2 | ||
|
|
3953eb3f6c | ||
|
|
b149ccbc17 | ||
|
|
df0b1751e6 | ||
|
|
bb756115fa | ||
|
|
48a9e24630 | ||
|
|
3896a63016 | ||
|
|
50144d178a | ||
|
|
e0840e392c | ||
|
|
e6bfb6b7b3 | ||
|
|
165cbd1c48 | ||
|
|
bd5e7f8118 | ||
|
|
ccee30b15e | ||
|
|
32f26561b1 | ||
|
|
ea0be720a1 | ||
|
|
b31fbe528a | ||
|
|
2f13622d37 | ||
|
|
03c4282ebf | ||
|
|
5ff5f1b0d5 | ||
|
|
07fa6615f8 | ||
|
|
941c2b1d14 | ||
|
|
aa67bc5da6 | ||
|
|
946166f13e | ||
|
|
6ab5ef1315 | ||
|
|
5c647d4515 | ||
|
|
906ced3c32 | ||
|
|
164fa8f646 | ||
|
|
f075264d6f | ||
|
|
cf3447feea | ||
|
|
78b1b54e2b | ||
|
|
b7eac150cc | ||
|
|
a9876475c1 | ||
|
|
46296328ff | ||
|
|
5f3ece629c | ||
|
|
a6827f9820 | ||
|
|
40d02fe6c3 | ||
|
|
572bc48a25 | ||
|
|
1959e414e2 | ||
|
|
08a875c39a | ||
|
|
90be589ffa | ||
|
|
780865cfed | ||
|
|
d795f1b898 | ||
|
|
ecf8d29724 | ||
|
|
8ca1179e04 | ||
|
|
96e23516f6 | ||
|
|
2102965fac | ||
|
|
436f7fc550 | ||
|
|
2b10a2b874 | ||
|
|
9ee5053b71 | ||
|
|
30494f8ddb | ||
|
|
21e505c334 | ||
|
|
7e668ca9ac | ||
|
|
1d556a5668 | ||
|
|
8654623271 | ||
|
|
e1c0cad8e1 | ||
|
|
a6c45a7ade | ||
|
|
cd34090eb8 | ||
|
|
ae478c92a2 | ||
|
|
439dbd8bb3 | ||
|
|
9cf0a5b68b | ||
|
|
6eb9915690 | ||
|
|
ca7a404fc8 | ||
|
|
4a1a0be51d | ||
|
|
521b8a16c4 | ||
|
|
d4e7a5c68e | ||
|
|
b474c2ca7a | ||
|
|
4142f7c728 | ||
|
|
54c440d75c | ||
|
|
954d46e587 | ||
|
|
198539479f | ||
|
|
30680d0268 | ||
|
|
c1c88644ae | ||
|
|
36ce23073c | ||
|
|
45e2d12d06 | ||
|
|
e18a7569f8 | ||
|
|
3470b44e9a | ||
|
|
23cfb03a3b | ||
|
|
918f91bc44 | ||
|
|
6ff7584f96 | ||
|
|
b15289113b | ||
|
|
99faaae9f6 | ||
|
|
0999017fda | ||
|
|
34f4b58f69 | ||
|
|
e9af710cf4 | ||
|
|
74104fe5d0 | ||
|
|
f5335d59cc | ||
|
|
cdbdd0d6fb | ||
|
|
743d10d50e | ||
|
|
797399ff7f | ||
|
|
9332673944 | ||
|
|
f9563e5a34 |
No files matched your search
+9
-2
@@ -1,7 +1,14 @@
|
||||
* text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.patch text
|
||||
*.patch text eol=lf
|
||||
*.java text eol=lf
|
||||
*.gradle text eol=crlf
|
||||
*.png binary
|
||||
*.exe binary
|
||||
*.dll binary
|
||||
*.zip binary
|
||||
*.jar binary
|
||||
*.lzma binary
|
||||
*.zip binary
|
||||
*.pyd binary
|
||||
*.cfg text eol=lf
|
||||
*.py text eol=lf
|
||||
+22
-8
@@ -1,9 +1,23 @@
|
||||
*.DS_Store
|
||||
/logs/
|
||||
/*.pyc
|
||||
/forge-*/
|
||||
/patches-old/
|
||||
/mcp/
|
||||
#eclipse
|
||||
/bin
|
||||
/.settings
|
||||
/.classpath
|
||||
|
||||
#idea
|
||||
/.idea
|
||||
*.iml
|
||||
|
||||
#gradle
|
||||
/build
|
||||
/.gradle
|
||||
|
||||
#occupational hazards
|
||||
/eclipse/
|
||||
/target/
|
||||
/temp/
|
||||
/repo/
|
||||
/buildSrc
|
||||
|
||||
#Patch rejects
|
||||
*.rej
|
||||
/patches-/
|
||||
# FML changelog
|
||||
changelog.txt
|
||||
File renamed without changes.
@@ -24,9 +24,9 @@ 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
|
||||
The present license is granted to any user of Minecraft Forge, for all files included
|
||||
unless stated otherwise in the file itself. As a prerequisite, a user of Minecraft
|
||||
Forge must own a legally aquired copy of Minecraft.
|
||||
|
||||
2. Play rights
|
||||
--------------
|
||||
File renamed without changes.
File renamed without changes.
+31
@@ -0,0 +1,31 @@
|
||||
*** HOW TO INSTALL ***
|
||||
For Mod Users:
|
||||
|
||||
Download the latest installer from http://files.minecraftforge.net and follow instructions given by the installer.
|
||||
|
||||
|
||||
For Mod Devs:
|
||||
|
||||
Download the latest Forge source distribution from http://files.minecraftforge.net and unzip it to a folder.
|
||||
Open a command prompt, navigate to the directory where you unzipped the Forge sources, and run:
|
||||
If you have Gradle: gradle setupDevWorkspace
|
||||
If you DO NOT have Gradle installed:
|
||||
Windows: ./gradlew.bat setupDevWorkspace
|
||||
MacOS/Linux: ./gradlew setupDevWorkspace
|
||||
|
||||
If you wish to use the Eclipse IDE, run gradle eclipse instead of gradle setupDevWorkspace, or install the Gradle plugin for Eclipse and import the Forge source folder as a Gradle project.
|
||||
|
||||
|
||||
For Contributors: (Note: This assumes you have Gradle installed. If you don't, use ./gradlew(.bat) instead of gradle.
|
||||
|
||||
Clone this repository to a folder.
|
||||
Open a command prompt and navigate to the folder where you cloned this repo.
|
||||
Run gradle setupForge to setup your development environment.
|
||||
|
||||
To use Eclipse, point your Eclipse workspace at the eclipse folder inside the repo.
|
||||
|
||||
|
||||
Requirements (for both mod devs and contributors):
|
||||
You must have a JDK installed and accessible.
|
||||
If you do not wish to use the gradle wrapper, you can install Gradle from http://www.gradle.org/ .
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
import fnmatch
|
||||
import shlex
|
||||
import difflib
|
||||
import time, subprocess
|
||||
from optparse import OptionParser
|
||||
|
||||
def cmdsplit(args):
|
||||
if os.sep == '\\':
|
||||
args = args.replace('\\', '\\\\')
|
||||
return shlex.split(args)
|
||||
|
||||
def main():
|
||||
print("Applying patches")
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to MCP', default=None)
|
||||
parser.add_option('-p', '--patch-dir', action='store', dest='patch_dir', help='Patches Directory', default=None)
|
||||
parser.add_option('-t', '--target-dir', action='store', dest='target_dir', help='Target Directory', default=None)
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
if options.mcp_dir is None:
|
||||
print 'Must supply MCP directory with --mcp-dir'
|
||||
return
|
||||
elif options.patch_dir is None:
|
||||
print 'Must supply patches directory with --patch-dir'
|
||||
return
|
||||
elif options.target_dir is None:
|
||||
print 'Must supplt target directory with --target-dir'
|
||||
return
|
||||
|
||||
print "Applying patches from '%s' to '%s'" % (options.patch_dir, options.target_dir)
|
||||
apply_patches(options.mcp_dir, options.patch_dir, options.target_dir)
|
||||
|
||||
def apply_patches(mcp_dir, patch_dir, target_dir, find=None, rep=None):
|
||||
# Attempts to apply a directory full of patch files onto a target directory.
|
||||
sys.path.append(mcp_dir)
|
||||
|
||||
temp = os.path.abspath('temp.patch')
|
||||
cmd = cmdsplit('patch -p2 -i "%s" ' % temp)
|
||||
|
||||
if os.name == 'nt':
|
||||
applydiff = os.path.abspath(os.path.join(mcp_dir, 'runtime', 'bin', 'applydiff.exe'))
|
||||
cmd = cmdsplit('"%s" -uf -p2 -i "%s"' % (applydiff, temp))
|
||||
|
||||
for path, _, filelist in os.walk(patch_dir, followlinks=True):
|
||||
for cur_file in fnmatch.filter(filelist, '*.patch'):
|
||||
patch_file = os.path.normpath(os.path.join(patch_dir, path[len(patch_dir)+1:], cur_file))
|
||||
target_file = os.path.join(target_dir, fix_patch(patch_file, temp, find, rep))
|
||||
process = subprocess.Popen(cmd, cwd=target_dir, bufsize=-1)
|
||||
process.communicate()
|
||||
|
||||
if os.path.isfile(temp):
|
||||
os.remove(temp)
|
||||
|
||||
def fix_patch(in_file, out_file, find=None, rep=None):
|
||||
#Fixes the following issues in the patch file if they exist:
|
||||
# Normalizes the path seperators for the current OS
|
||||
# Normalizes the line endings
|
||||
# Returns the path that the file wants to apply to
|
||||
|
||||
in_file = os.path.normpath(in_file)
|
||||
if out_file is None:
|
||||
tmp_file = in_file + '.tmp'
|
||||
else:
|
||||
out_file = os.path.normpath(out_file)
|
||||
tmp_file = out_file
|
||||
dir_name = os.path.dirname(out_file)
|
||||
if dir_name:
|
||||
if not os.path.exists(dir_name):
|
||||
os.makedirs(dir_name)
|
||||
|
||||
file = 'not found'
|
||||
with open(in_file, 'rb') as inpatch:
|
||||
with open(tmp_file, 'wb') as outpatch:
|
||||
for line in inpatch:
|
||||
line = line.rstrip('\r\n')
|
||||
if line[:3] in ['+++', '---', 'Onl', 'dif']:
|
||||
if not find == None and not rep == None:
|
||||
line = line.replace('\\', '/').replace(find, rep).replace('/', os.sep)
|
||||
else:
|
||||
line = line.replace('\\', '/').replace('/', os.sep)
|
||||
outpatch.write(line + os.linesep)
|
||||
else:
|
||||
outpatch.write(line + os.linesep)
|
||||
if line[:3] == '---':
|
||||
file = line[line.find(os.sep, line.find(os.sep)+1)+1:]
|
||||
|
||||
if out_file is None:
|
||||
shutil.move(tmp_file, in_file)
|
||||
return file
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
deployJars
|
||||
}
|
||||
|
||||
import static net.minecraftforge.gradle.dev.ForgeDevPlugin.*
|
||||
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'forgedev'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
flatDir {
|
||||
name "fileRepo"
|
||||
dirs "repo"
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = '1.7.2'
|
||||
mcpVersion = '9.03'
|
||||
fmlDir = projectDir.getAbsolutePath() + "/fml";
|
||||
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
|
||||
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
|
||||
installerVersion = "1.4"
|
||||
}
|
||||
|
||||
group = 'net.minecraftforge'
|
||||
version = getVersionFromJava(getProject(), 'src/main/java/net/minecraftforge/common/ForgeVersion.java')
|
||||
|
||||
jenkins {
|
||||
job = 'minecraftforge'
|
||||
}
|
||||
|
||||
launch4j {
|
||||
jreMinVersion = '1.6.0'
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
add getProject().repositories.mavenLocal()
|
||||
}
|
||||
repositories.mavenDeployer {
|
||||
configuration = configurations.deployJars
|
||||
|
||||
if (project.hasProperty("filesmaven")) {
|
||||
logger.info('Publishing to files server')
|
||||
repository(url: project.filesmaven.url) {
|
||||
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
|
||||
}
|
||||
} else {
|
||||
logger.info('Publishing to repo folder')
|
||||
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
|
||||
}
|
||||
|
||||
pom {
|
||||
groupId = project.group
|
||||
version = project.version
|
||||
artifactId = project.archivesBaseName
|
||||
}
|
||||
pom.project {
|
||||
name project.archivesBaseName
|
||||
packaging 'jar'
|
||||
description 'Minecraft Forge API'
|
||||
url 'https://github.com/MinecraftForge/MinecraftForge'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/MinecraftForge/MinecraftForge'
|
||||
connection 'scm:git:git://github.com/MinecraftForge/MinecraftForge.git'
|
||||
developerConnection 'scm:git:[email protected]:MinecraftForge/MinecraftForge.git'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system 'github'
|
||||
url 'https://github.com/MinecraftForge/MinecraftForge/issues'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'Forge Public License'
|
||||
url 'https://raw.github.com/MinecraftForge/MinecraftForge/master/MinecraftForge-License.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'cpw'
|
||||
name 'cpw'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'LexManos'
|
||||
name 'Lex Manos'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'AbrarSyed'
|
||||
name 'Abrar Syed'
|
||||
roles { role 'contributor' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import os, os.path, sys
|
||||
from optparse import OptionParser
|
||||
|
||||
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
mcp_dir = os.path.abspath('..')
|
||||
|
||||
from forge import build_forge_dev
|
||||
|
||||
def main():
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='MCP Path', default=None)
|
||||
parser.add_option('-b', '--build', action='store', dest='build', help='Build number', default=None)
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
build_num = 0
|
||||
if not options.build is None:
|
||||
try:
|
||||
build_num = int(options.build)
|
||||
except:
|
||||
pass
|
||||
|
||||
fml_dir = os.path.join(forge_dir, 'fml')
|
||||
mcp_dir = os.path.join(forge_dir, 'mcp')
|
||||
|
||||
if not options.mcp_dir is None:
|
||||
mcp_dir = os.path.abspath(options.mcp_dir)
|
||||
elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
|
||||
mcp_dir = os.path.abspath('..')
|
||||
|
||||
sys.exit(build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
import os, os.path, sys, re
|
||||
import json, urllib2
|
||||
from pprint import pprint
|
||||
from urlparse import urlparse
|
||||
import base64
|
||||
import optparse, ast
|
||||
|
||||
class PreemptiveBasicAuthHandler(urllib2.BaseHandler):
|
||||
def __init__(self, password_mgr=None):
|
||||
if password_mgr is None:
|
||||
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||
self.passwd = password_mgr
|
||||
self.add_password = self.passwd.add_password
|
||||
|
||||
def http_request(self,req):
|
||||
uri = req.get_full_url()
|
||||
user, pw = self.passwd.find_user_password(None,uri)
|
||||
if pw is None: return req
|
||||
raw = "%s:%s" % (user, pw)
|
||||
auth = 'Basic %s' % base64.b64encode(raw).strip()
|
||||
req.add_unredirected_header('Authorization', auth)
|
||||
return req
|
||||
|
||||
def https_request(self,req):
|
||||
return self.http_request(req)
|
||||
|
||||
def read_url(url):
|
||||
handler = PreemptiveBasicAuthHandler()
|
||||
handler.add_password(None, 'ci.jenkins.minecraftforge.net', 'console_script', 'dc6d48ca20a474beeac280a9a16a926e')
|
||||
file = urllib2.build_opener(handler).open(url)
|
||||
data = file.read()
|
||||
file.close()
|
||||
return data
|
||||
|
||||
def getBuildInfo(url, current_version=None):
|
||||
data = read_url(url)
|
||||
data = ast.literal_eval(data)['allBuilds']
|
||||
data = sorted(data, key=lambda key: key['number'], reverse=False)
|
||||
|
||||
items = []
|
||||
output = []
|
||||
|
||||
for build in data:
|
||||
build['actions'] = filter(lambda act: act is not None, build['actions'])
|
||||
build['actions'] = filter(lambda act: 'text' in act, build['actions'])
|
||||
build['actions'] = filter(lambda act: not ' ' in act['text'], build['actions'])
|
||||
if len(build['actions']) == 0:
|
||||
build['version'] = current_version
|
||||
current_version = None
|
||||
else:
|
||||
build['version'] = build['actions'][0]['text']
|
||||
build['items'] = build['changeSet']['items']
|
||||
for item in build['items']:
|
||||
item['author'] = item['author']['fullName']
|
||||
if build['result'] != 'SUCCESS':
|
||||
items += build['items']
|
||||
else:
|
||||
build['items'] = items + build['items']
|
||||
items = []
|
||||
output += [build]
|
||||
build.pop('changeSet')
|
||||
build.pop('actions')
|
||||
return sorted(output, key=lambda key: key['number'], reverse=True)
|
||||
|
||||
def add_latest_build(url, builds, current_version=None):
|
||||
data = read_url(url)
|
||||
data = ast.literal_eval(data)
|
||||
number = data['number']
|
||||
|
||||
if builds[0]['number'] == data['number']:
|
||||
return builds
|
||||
|
||||
for item in data['changeSet']['items']:
|
||||
item['author'] = item['author']['fullName']
|
||||
|
||||
build = {
|
||||
'number' : data['number'],
|
||||
'result' : 'SUCCESS', #Currently build should always be success... Else things derp after words
|
||||
'version' : current_version,
|
||||
'items' : data['changeSet']['items']
|
||||
}
|
||||
return [build] + builds
|
||||
|
||||
def make_changelog(job_path, target_build, change_file, current_version=None):
|
||||
builds = getBuildInfo('%s/api/python?tree=allBuilds[result,number,actions[text],changeSet[items[author[fullName],comment]]]&pretty=true' % job_path, current_version)
|
||||
builds = add_latest_build('%s/lastBuild/api/python?pretty=true&tree=number,changeSet[items[author[fullName],comment]]' % job_path, builds, current_version)
|
||||
|
||||
log = [ "Changelog:" ]
|
||||
|
||||
for build in builds:
|
||||
if int(build['number']) > target_build: continue
|
||||
if len(build['items']) == 0: continue
|
||||
log.append('')
|
||||
if build['version'] is None:
|
||||
log.append('Build %s' % build['number'])
|
||||
else:
|
||||
log.append('Build %s' % build['version'])
|
||||
for change in build['items']:
|
||||
comments = filter(lambda cmt: len(cmt) > 0, change['comment'].split('\n'))
|
||||
if len(comments) > 1:
|
||||
log.append('\t' + change['author'])
|
||||
for comment in comments:
|
||||
log.append('\t\t' + comment)
|
||||
elif len(comments) == 1:
|
||||
log.append('\t%s: %s' % (change['author'], comments[0]))
|
||||
|
||||
file = open(change_file, 'wb')
|
||||
for line in log:
|
||||
file.write('%s\n' % line)
|
||||
file.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_changelog("http://ci.jenkins.minecraftforge.net/job/minecraftforge/", 70000, 'changelog.txt', 'pinecone')
|
||||
@@ -1,44 +0,0 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.world.EnumGameType;
|
||||
import net.minecraft.util.EnumOS;
|
||||
import net.minecraft.client.settings.EnumOptions;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraftforge.common.EnumHelper;
|
||||
|
||||
public class EnumHelperClient extends EnumHelper
|
||||
{
|
||||
|
||||
private static Class[][] clentTypes =
|
||||
{
|
||||
{EnumGameType.class, int.class, String.class},
|
||||
{EnumOptions.class, String.class, boolean.class, boolean.class},
|
||||
{EnumOS.class},
|
||||
{EnumRarity.class, int.class, String.class}
|
||||
};
|
||||
|
||||
public static EnumGameType addGameType(String name, int id, String displayName)
|
||||
{
|
||||
return addEnum(EnumGameType.class, name, id, displayName);
|
||||
}
|
||||
|
||||
public static EnumOptions addOptions(String name, String langName, boolean isSlider, boolean isToggle)
|
||||
{
|
||||
return addEnum(EnumOptions.class, name, langName, isSlider, isToggle);
|
||||
}
|
||||
|
||||
public static EnumOS addOS2(String name)
|
||||
{
|
||||
return addEnum(EnumOS.class, name);
|
||||
}
|
||||
|
||||
public static EnumRarity addRarity(String name, int color, String displayName)
|
||||
{
|
||||
return addEnum(EnumRarity.class, name, color, displayName);
|
||||
}
|
||||
|
||||
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
|
||||
{
|
||||
return addEnum(clentTypes, enumType, enumName, paramValues);
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.gui.GuiControls;
|
||||
import net.minecraft.client.gui.GuiSlot;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiControlsScrollPanel extends GuiSlot
|
||||
{
|
||||
protected static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png");
|
||||
private GuiControls controls;
|
||||
private GameSettings options;
|
||||
private Minecraft mc;
|
||||
private String[] message;
|
||||
private int _mouseX;
|
||||
private int _mouseY;
|
||||
private int selected = -1;
|
||||
|
||||
public GuiControlsScrollPanel(GuiControls controls, GameSettings options, Minecraft mc)
|
||||
{
|
||||
super(mc, controls.width, controls.height, 16, (controls.height - 32) + 4, 25);
|
||||
this.controls = controls;
|
||||
this.options = options;
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSize()
|
||||
{
|
||||
return options.keyBindings.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void elementClicked(int i, boolean flag)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
if (selected == -1)
|
||||
{
|
||||
selected = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
options.setKeyBinding(selected, -100);
|
||||
selected = -1;
|
||||
KeyBinding.resetKeyBindingArrayAndHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSelected(int i)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground() {}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mX, int mY, float f)
|
||||
{
|
||||
_mouseX = mX;
|
||||
_mouseY = mY;
|
||||
|
||||
if (selected != -1 && !Mouse.isButtonDown(0) && Mouse.getDWheel() == 0)
|
||||
{
|
||||
if (Mouse.next() && Mouse.getEventButtonState())
|
||||
{
|
||||
options.setKeyBinding(selected, -100 + Mouse.getEventButton());
|
||||
selected = -1;
|
||||
KeyBinding.resetKeyBindingArrayAndHash();
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen(mX, mY, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator)
|
||||
{
|
||||
int width = 70;
|
||||
int height = 20;
|
||||
xPosition -= 20;
|
||||
boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height;
|
||||
int k = (flag ? 2 : 1);
|
||||
|
||||
mc.renderEngine.bindTexture(WIDGITS);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height);
|
||||
controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height);
|
||||
controls.drawString(mc.fontRenderer, options.getKeyBindingDescription(index), xPosition + width + 4, yPosition + 6, 0xFFFFFFFF);
|
||||
|
||||
boolean conflict = false;
|
||||
for (int x = 0; x < options.keyBindings.length; x++)
|
||||
{
|
||||
if (x != index && options.keyBindings[x].keyCode == options.keyBindings[index].keyCode)
|
||||
{
|
||||
conflict = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String str = (conflict ? EnumChatFormatting.RED : "") + options.getOptionDisplayString(index);
|
||||
str = (index == selected ? EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<" : str);
|
||||
controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public boolean keyTyped(char c, int i)
|
||||
{
|
||||
if (selected != -1)
|
||||
{
|
||||
options.setKeyBinding(selected, i);
|
||||
selected = -1;
|
||||
KeyBinding.resetKeyBindingArrayAndHash();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ClientChatReceivedEvent extends Event
|
||||
{
|
||||
public String message;
|
||||
public ClientChatReceivedEvent(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
|
||||
public class PlaySoundSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlaySoundSourceEvent(SoundManager manager, String name, float x, float y, float z)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
|
||||
public class PlayStreamingSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlayStreamingSourceEvent(SoundManager manager, String name, float x, float y, float z)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class SoundEvent extends Event
|
||||
{
|
||||
public SoundEvent(){}
|
||||
|
||||
public static SoundPoolEntry getResult(SoundResultEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.result;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
commands.forge.usage=Use /forge <subcommand>. Subcommands are tps, track
|
||||
commands.forge.usage.tracking=Use /forge track <type> <duration>. Valid types are te (Tile Entities). Duration is < 60.
|
||||
commands.forge.tps.summary=%s : Mean tick time: %d ms. Mean TPS: %d
|
||||
|
||||
commands.forge.tracking.te.enabled=Tile Entity tracking enabled for %d seconds.
|
||||
@@ -1,160 +0,0 @@
|
||||
#Main Forge Access Transformer configuration file
|
||||
# Tessellator
|
||||
public-f bfq.a #FD:Tessellator/field_78398_a #instance
|
||||
public bfq.u #FD:Tessellator/field_78409_u #drawMode
|
||||
public bfq.v #FD:Tessellator/field_78408_v #xOffset
|
||||
public bfq.w #FD:Tessellator/field_78407_w #yOffset
|
||||
public bfq.x #FD:Tessellator/field_78417_x #zOffset
|
||||
public bfq.z #FD:Tessellator/field_78415_z #isDrawing
|
||||
# ItemPickaxe
|
||||
public yn.<init>(ILyd;)V #MD:ItemPickaxe/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
|
||||
public+f yn.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst
|
||||
# ItemAxe
|
||||
public ya.<init>(ILyd;)V #MD:ItemAxe/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
|
||||
public+f ya.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst
|
||||
# ItemSpade
|
||||
public yy.<init>(ILyd;)V #MD:ItemSpade/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
|
||||
public+f yy.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst
|
||||
# ItemTool
|
||||
public xj.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial
|
||||
public xj.d #FD:ItemTool/field_77865_bY #damageVsEntity
|
||||
# EntityEnderman
|
||||
public tg.br #FD:EntityEnderman/field_70827_d #carriableBlocks
|
||||
# RenderGlobal
|
||||
public bfl.k #FD:RenderGlobal/field_72769_h #theWorld
|
||||
public bfl.l #FD:RenderGlobal/field_72770_i #renderEngine
|
||||
public bfl.t #FD:RenderGlobal/field_72777_q #mc
|
||||
public bfl.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks
|
||||
public bfl.H #FD:RenderGlobal/field_72738_E #damagedBlocks
|
||||
# SoundManager
|
||||
public bln.b #FD:SoundManager/field_77381_a #sndSystem
|
||||
public bln.d #FD:SoundManager/field_77379_b #soundPoolSounds
|
||||
public bln.e #FD:SoundManager/field_77380_c #soundPoolStreaming
|
||||
public bln.f #FD:SoundManager/field_77377_d #soundPoolMusic
|
||||
# EntityMinecart
|
||||
protected st.* #FD:EntityMinecart/* # All private -> protected
|
||||
# Block
|
||||
public aqz.<init>(ILakc;)V #MD:Block/<init>(ILnet/minecraft/src/Material;) #Constructor
|
||||
public aqz.<init>(IILakc;)V #MD:Block/<init>(IILnet/minecraft/src/Material;) #Constructor
|
||||
public aqz.cH #FD:Block/field_72029_cc #blockResistance
|
||||
public aqz.cG #FD:Block/field_71989_cb #blockHardness
|
||||
public aqz.d(Ljava/lang/String;)Laqz; #MD:Block/func_111022_d #setIconName
|
||||
public aqz.a(Lard;)Laqz; #MD:Block/func_71884_a #setStepSound
|
||||
public aqz.b(F)Laqz; #MD:Block/func_71894_b #setResistance
|
||||
public aqz.c(F)Laqz; #MD:Block/func_71848_c #setHardness
|
||||
public aqz.k(I)Laqz; #MD:Block/func_71868_h #setLightOpacity
|
||||
public aqz.a(F)Laqz; #MD:Block/func_71900_a #setLightValue
|
||||
public aqz.r()Laqz; #MD:Block/func_71875_q #setBlockUnbreakable
|
||||
public aqz.b(Z)Laqz; #MD:Block/func_71907_b #setTickRandomly
|
||||
public aqz.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds
|
||||
public aqz.j(Labw;IIII)V #MD:Block/func_71923_g #dropXpOnBlockBreak
|
||||
# NetServerHandler
|
||||
public ka.f #FD:NetServerHandler/field_72572_g #playerInAirTime
|
||||
# TileEntity
|
||||
public asp.k #FD:TileEntity/field_70331_k #worldObj
|
||||
# BlockLeavesBase
|
||||
public arh.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel
|
||||
# Item
|
||||
public yc.<init>(I)V #MD:Item/<init>(I) #Constructor
|
||||
public yc.e(I)Lyc; #MD:Item/func_77656_e #setMaxDamage
|
||||
public-f yc.h(Lye;)Lms; #MD:Item/func_77650_f #getIconIndex
|
||||
public yc.c(Ljava/lang/String;)Lyc; #MD:Item/func_77631_c #setPotionEffect
|
||||
public yc.d(Ljava/lang/String;)Lyc; #MD:Item/func_111206_d #setIconName
|
||||
# RailLogic
|
||||
public amz #CL:BlockBaseRailLogic
|
||||
public amz.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles
|
||||
# EntityPlayer
|
||||
public uf.a(Lss;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld
|
||||
public uf.i()V #MD:EntityPlayer/func_71053_j #closeScreen
|
||||
public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer
|
||||
# EntityPlayerMP
|
||||
public bdi.a(Lss;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld
|
||||
# World Gen Chests Related
|
||||
public mk.* #FD:WeightedRandomChestContent/* #all
|
||||
public js.T #FD:WorldServer/field_73069_S #bonusChestContent
|
||||
public agh.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents
|
||||
public ahl.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple
|
||||
public ahm.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents
|
||||
public ahm.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents
|
||||
public ahw.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents
|
||||
public aia.a #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents
|
||||
public aif.b #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents
|
||||
public aji.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents
|
||||
public afp.a #FD:WorldGenDungeons/field_111189_a #chestContents
|
||||
# AnvilChunkLoader.chunkSaveLocation
|
||||
public aee.d #FD:AnvilChunkLoader/field_75825_d
|
||||
# ChunkProviderServer.currentChunkLoader
|
||||
public jr.e #FD:ChunkProviderServer/field_73247_e
|
||||
# PlayerManager
|
||||
public jp.a(IIZ)Ljq; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher
|
||||
# PlayerInstance
|
||||
public jq #CL:PlayerInstance
|
||||
# World
|
||||
public-f abw.A #FD:World/field_72982_D #villageCollectionObj
|
||||
public abw.G #FD:World/field_72993_I #activeChunkSet
|
||||
# EntityLiving
|
||||
public og.b #FD:EntityLiving/field_70728_aV #experienceValue
|
||||
public og.d #FD:EntityLiving/field_70715_bh #targetTasks
|
||||
# GuiFlatPresets
|
||||
public avz.a(Ljava/lang/String;ILacq;Ljava/util/List;[Lagd;)V #MD:GuiFlatPresets/func_82294_a
|
||||
public avz.a(Ljava/lang/String;ILacq;[Lagd;)V #MD:GuiFlatPresets/func_82297_a
|
||||
# BiomeGenBase
|
||||
public acq.*() #MD:BiomeGenBase/* #Everything protected->public
|
||||
# MapGenVillage
|
||||
public-f aiw.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes
|
||||
# ShapedRecipes
|
||||
public+f aai.d #FD:ShapedRecipes/field_77574_d #recipeItems
|
||||
public+f aai.b #FD:ShapedRecipes/field_77576_b #recipeWidth
|
||||
public+f aai.c #FD:ShapedRecipes/field_77577_c #recipeHeight
|
||||
# ShapelessRecipes
|
||||
public aaj.b #FD:ShapelessRecipes/field_77579_b #recipeItems
|
||||
# GuiContainer
|
||||
protected awy.a(Lwe;)V #MD:GuiContainer/func_74192_a #drawSlotInventory
|
||||
# ContainerPlayer
|
||||
protected vv.h #FD:ContainerPlayer/field_82862_h #player
|
||||
# BlockButton
|
||||
protected anf.n(Labw;III)V #MD:BlockButton/func_82535_o #checkActivation
|
||||
protected-f anf.a #FD:BlockButton/field_82537_a #sensible
|
||||
# BiomeDecorator
|
||||
public acu.* #FD:BiomeDecorator/* # All private -> protected
|
||||
# CreativeTabs
|
||||
public-f ww.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final
|
||||
# Packet
|
||||
public ey.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping
|
||||
# SaveHandler
|
||||
public alq.b()Ljava/io/File; #MD:SaveHandler/func_75765_b
|
||||
# World stuff
|
||||
public abw.b(Lnn;)V #MD:World/func_72847_b #releaseEntitySkin
|
||||
public abw.m #FD:World/field_73003_n #prevRainingStrength
|
||||
public abw.n #FD:World/field_73004_o #rainingStrength
|
||||
public abw.p #FD:World/field_73017_q #thunderingStrength
|
||||
public abw.o #FD:World/field_73018_p #prevThunderingStrength
|
||||
#WorldClient
|
||||
public bdd.b(Lnn;)V #MD:WorldClient/func_72847_b #releaseEntitySkin
|
||||
#WorldServer
|
||||
public js.b(Lnn;)V #MD:WorldServer/func_72847_b #releaseEntitySkin
|
||||
public js.N #FD:WorldServer/field_73068_P #allPlayersSleeping
|
||||
#TextureMap
|
||||
public bik.g #FD:TextureMap/field_94255_a
|
||||
public bik.h #FD:TextureMap/field_94254_c
|
||||
#Potion
|
||||
public ni.b(II)Lni; #MD:Potion/func_76399_b #setIconIndex
|
||||
#PotionHelper
|
||||
public zp.m #FD:PotionHelper/field_77927_l #potionRequirements
|
||||
public zp.n #FD:PotionHelper/field_77928_m #potionAmplifiers
|
||||
#PotionEffect
|
||||
public nj.b #FD:PotionEffect/field_76460_b #duration
|
||||
#BlockFluid
|
||||
protected apc.a #FD:BlockFluid/field_94425_a #theIcon
|
||||
#GuiIngame
|
||||
protected avj.* #FD:GuiIngame/* # All private -> protected
|
||||
protected avj.*() #MD:GuiIngame/* # All private -> protected
|
||||
#ItemStack
|
||||
default ye.f #FD:ItemStack/field_77991_e # make default access for itemDamage
|
||||
#GuiSlot
|
||||
protected awg.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground
|
||||
#EntityPlayer
|
||||
public uf.bu #FD:EntityPlayer/field_71092_bJ #username
|
||||
#MapGenStructureIO
|
||||
public air.b(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143034_b #registerStart
|
||||
public air.a(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143031_a #registerPiece
|
||||
@@ -1,70 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.structure.MapGenStronghold;
|
||||
import net.minecraft.world.gen.structure.MapGenVillage;
|
||||
import net.minecraft.world.biome.WorldChunkManager;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class BiomeManager
|
||||
{
|
||||
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
|
||||
{
|
||||
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
|
||||
{
|
||||
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
||||
biomes.add(biome);
|
||||
MapGenVillage.villageSpawnBiomes = biomes;
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeVillageBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (MapGenVillage.villageSpawnBiomes.contains(biome))
|
||||
{
|
||||
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
||||
biomes.remove(biome);
|
||||
MapGenVillage.villageSpawnBiomes = biomes;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addStrongholdBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (!MapGenStronghold.allowedBiomes.contains(biome))
|
||||
{
|
||||
MapGenStronghold.allowedBiomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeStrongholdBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (MapGenStronghold.allowedBiomes.contains(biome))
|
||||
{
|
||||
MapGenStronghold.allowedBiomes.remove(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addSpawnBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (!WorldChunkManager.allowedBiomes.contains(biome))
|
||||
{
|
||||
WorldChunkManager.allowedBiomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeSpawnBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (WorldChunkManager.allowedBiomes.contains(biome))
|
||||
{
|
||||
WorldChunkManager.allowedBiomes.remove(biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,927 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import static net.minecraftforge.common.Property.Type.BOOLEAN;
|
||||
import static net.minecraftforge.common.Property.Type.DOUBLE;
|
||||
import static net.minecraftforge.common.Property.Type.INTEGER;
|
||||
import static net.minecraftforge.common.Property.Type.STRING;
|
||||
|
||||
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.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||
|
||||
/**
|
||||
* This class offers advanced configurations capabilities, allowing to provide
|
||||
* various categories for configuration variables.
|
||||
*/
|
||||
public class Configuration
|
||||
{
|
||||
private static boolean[] configMarkers = new boolean[Item.itemsList.length];
|
||||
private static final int ITEM_SHIFT = 256;
|
||||
private static final int MAX_BLOCKS = 4096;
|
||||
|
||||
public static final String CATEGORY_GENERAL = "general";
|
||||
public static final String CATEGORY_BLOCK = "block";
|
||||
public static final String CATEGORY_ITEM = "item";
|
||||
public static final String ALLOWED_CHARS = "._-";
|
||||
public static final String DEFAULT_ENCODING = "UTF-8";
|
||||
public static final String CATEGORY_SPLITTER = ".";
|
||||
public static final String NEW_LINE;
|
||||
private static final Pattern CONFIG_START = Pattern.compile("START: \"([^\\\"]+)\"");
|
||||
private static final Pattern CONFIG_END = Pattern.compile("END: \"([^\\\"]+)\"");
|
||||
public static final CharMatcher allowedProperties = CharMatcher.JAVA_LETTER_OR_DIGIT.or(CharMatcher.anyOf(ALLOWED_CHARS));
|
||||
private static Configuration PARENT = null;
|
||||
|
||||
File file;
|
||||
|
||||
private Map<String, ConfigCategory> categories = new TreeMap<String, ConfigCategory>();
|
||||
private Map<String, Configuration> children = new TreeMap<String, Configuration>();
|
||||
|
||||
private boolean caseSensitiveCustomCategories;
|
||||
public String defaultEncoding = DEFAULT_ENCODING;
|
||||
private String fileName = null;
|
||||
public boolean isChild = false;
|
||||
private boolean changed = false;
|
||||
|
||||
static
|
||||
{
|
||||
Arrays.fill(configMarkers, false);
|
||||
NEW_LINE = System.getProperty("line.separator");
|
||||
}
|
||||
|
||||
public Configuration(){}
|
||||
|
||||
/**
|
||||
* Create a configuration file for the file given in parameter.
|
||||
*/
|
||||
public Configuration(File file)
|
||||
{
|
||||
this.file = file;
|
||||
String basePath = ((File)(FMLInjectionData.data()[6])).getAbsolutePath().replace(File.separatorChar, '/').replace("/.", "");
|
||||
String path = file.getAbsolutePath().replace(File.separatorChar, '/').replace("/./", "/").replace(basePath, "");
|
||||
if (PARENT != null)
|
||||
{
|
||||
PARENT.setChild(path, this);
|
||||
isChild = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = path;
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
public Configuration(File file, boolean caseSensitiveCustomCategories)
|
||||
{
|
||||
this(file);
|
||||
this.caseSensitiveCustomCategories = caseSensitiveCustomCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 getBlock(String key, int defaultID) { return getBlock(CATEGORY_BLOCK, key, defaultID, null); }
|
||||
public Property getBlock(String key, int defaultID, String comment) { return getBlock(CATEGORY_BLOCK, key, defaultID, comment); }
|
||||
public Property getBlock(String category, String key, int defaultID) { return getBlockInternal(category, key, defaultID, null, 256, Block.blocksList.length); }
|
||||
public Property getBlock(String category, String key, int defaultID, String comment) { return getBlockInternal(category, key, defaultID, comment, 256, Block.blocksList.length); }
|
||||
|
||||
/**
|
||||
* Special version of getBlock to be used when you want to garentee the ID you get is below 256
|
||||
* This should ONLY be used by mods who do low level terrain generation, or ones that add new
|
||||
* biomes.
|
||||
* EXA: ExtraBiomesXL
|
||||
*
|
||||
* Specifically, if your block is used BEFORE the Chunk is created, and placed in the terrain byte array directly.
|
||||
* If you add a new biome and you set the top/filler block, they need to be <256, nothing else.
|
||||
*
|
||||
* If you're adding a new ore, DON'T call this function.
|
||||
*
|
||||
* Normal mods such as '50 new ores' do not need to be below 256 so should use the normal getBlock
|
||||
*/
|
||||
public Property getTerrainBlock(String category, String key, int defaultID, String comment)
|
||||
{
|
||||
return getBlockInternal(category, key, defaultID, comment, 0, 256);
|
||||
}
|
||||
|
||||
private Property getBlockInternal(String category, String key, int defaultID, String comment, int lower, int upper)
|
||||
{
|
||||
Property prop = get(category, key, -1, comment);
|
||||
|
||||
if (prop.getInt() != -1)
|
||||
{
|
||||
configMarkers[prop.getInt()] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaultID < lower)
|
||||
{
|
||||
FMLLog.warning(
|
||||
"Mod attempted to get a block ID with a default in the Terrain Generation section, " +
|
||||
"mod authors should make sure there defaults are above 256 unless explicitly needed " +
|
||||
"for terrain generation. Most ores do not need to be below 256.");
|
||||
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
|
||||
defaultID = upper - 1;
|
||||
}
|
||||
|
||||
if (Block.blocksList[defaultID] == null && !configMarkers[defaultID])
|
||||
{
|
||||
prop.set(defaultID);
|
||||
configMarkers[defaultID] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = upper - 1; j > 0; j--)
|
||||
{
|
||||
if (Block.blocksList[j] == null && !configMarkers[j])
|
||||
{
|
||||
prop.set(j);
|
||||
configMarkers[j] = true;
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("No more block ids available for " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Property getItem(String key, int defaultID) { return getItem(CATEGORY_ITEM, key, defaultID, null); }
|
||||
public Property getItem(String key, int defaultID, String comment) { return getItem(CATEGORY_ITEM, key, defaultID, comment); }
|
||||
public Property getItem(String category, String key, int defaultID) { return getItem(category, key, defaultID, null); }
|
||||
|
||||
public Property getItem(String category, String key, int defaultID, String comment)
|
||||
{
|
||||
Property prop = get(category, key, -1, comment);
|
||||
int defaultShift = defaultID + ITEM_SHIFT;
|
||||
|
||||
if (prop.getInt() != -1)
|
||||
{
|
||||
configMarkers[prop.getInt() + ITEM_SHIFT] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaultID < MAX_BLOCKS - ITEM_SHIFT)
|
||||
{
|
||||
FMLLog.warning(
|
||||
"Mod attempted to get a item ID with a default value in the block ID section, " +
|
||||
"mod authors should make sure there defaults are above %d unless explicitly needed " +
|
||||
"so that all block ids are free to store blocks.", MAX_BLOCKS - ITEM_SHIFT);
|
||||
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
|
||||
}
|
||||
|
||||
if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length)
|
||||
{
|
||||
prop.set(defaultID);
|
||||
configMarkers[defaultShift] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = Item.itemsList.length - 1; x >= ITEM_SHIFT; x--)
|
||||
{
|
||||
if (Item.itemsList[x] == null && !configMarkers[x])
|
||||
{
|
||||
prop.set(x - ITEM_SHIFT);
|
||||
configMarkers[x] = true;
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("No more item ids available for " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int defaultValue, String comment)
|
||||
{
|
||||
Property prop = get(category, key, Integer.toString(defaultValue), comment, INTEGER);
|
||||
if (!prop.isIntValue())
|
||||
{
|
||||
prop.set(defaultValue);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean defaultValue, String comment)
|
||||
{
|
||||
Property prop = get(category, key, Boolean.toString(defaultValue), comment, BOOLEAN);
|
||||
if (!prop.isBooleanValue())
|
||||
{
|
||||
prop.set(defaultValue);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double defaultValue, String comment)
|
||||
{
|
||||
Property prop = get(category, key, Double.toString(defaultValue), comment, DOUBLE);
|
||||
if (!prop.isDoubleValue())
|
||||
{
|
||||
prop.set(defaultValue);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String defaultValue, String comment)
|
||||
{
|
||||
return get(category, key, defaultValue, comment, STRING);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String[] defaultValue, String comment)
|
||||
{
|
||||
return get(category, key, defaultValue, comment, STRING);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int[] defaultValue, String comment)
|
||||
{
|
||||
String[] values = new String[defaultValue.length];
|
||||
for (int i = 0; i < defaultValue.length; i++)
|
||||
{
|
||||
values[i] = Integer.toString(defaultValue[i]);
|
||||
}
|
||||
|
||||
Property prop = get(category, key, values, comment, INTEGER);
|
||||
if (!prop.isIntList())
|
||||
{
|
||||
prop.set(values);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double[] defaultValue, String comment)
|
||||
{
|
||||
String[] values = new String[defaultValue.length];
|
||||
for (int i = 0; i < defaultValue.length; i++)
|
||||
{
|
||||
values[i] = Double.toString(defaultValue[i]);
|
||||
}
|
||||
|
||||
Property prop = get(category, key, values, comment, DOUBLE);
|
||||
|
||||
if (!prop.isDoubleList())
|
||||
{
|
||||
prop.set(values);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean[] defaultValue, String comment)
|
||||
{
|
||||
String[] values = new String[defaultValue.length];
|
||||
for (int i = 0; i < defaultValue.length; i++)
|
||||
{
|
||||
values[i] = Boolean.toString(defaultValue[i]);
|
||||
}
|
||||
|
||||
Property prop = get(category, key, values, comment, BOOLEAN);
|
||||
|
||||
if (!prop.isBooleanList())
|
||||
{
|
||||
prop.set(values);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String defaultValue, String comment, Property.Type type)
|
||||
{
|
||||
if (!caseSensitiveCustomCategories)
|
||||
{
|
||||
category = category.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
ConfigCategory cat = getCategory(category);
|
||||
|
||||
if (cat.containsKey(key))
|
||||
{
|
||||
Property prop = cat.get(key);
|
||||
|
||||
if (prop.getType() == null)
|
||||
{
|
||||
prop = new Property(prop.getName(), prop.getString(), type);
|
||||
cat.put(key, prop);
|
||||
}
|
||||
|
||||
prop.comment = comment;
|
||||
return prop;
|
||||
}
|
||||
else if (defaultValue != null)
|
||||
{
|
||||
Property prop = new Property(key, defaultValue, type);
|
||||
prop.set(defaultValue); //Set and mark as dirty to signify it should save
|
||||
cat.put(key, prop);
|
||||
prop.comment = comment;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String[] defaultValue, String comment, Property.Type type)
|
||||
{
|
||||
if (!caseSensitiveCustomCategories)
|
||||
{
|
||||
category = category.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
ConfigCategory cat = getCategory(category);
|
||||
|
||||
if (cat.containsKey(key))
|
||||
{
|
||||
Property prop = cat.get(key);
|
||||
|
||||
if (prop.getType() == null)
|
||||
{
|
||||
prop = new Property(prop.getName(), prop.getString(), type);
|
||||
cat.put(key, prop);
|
||||
}
|
||||
|
||||
prop.comment = comment;
|
||||
|
||||
return prop;
|
||||
}
|
||||
else if (defaultValue != null)
|
||||
{
|
||||
Property prop = new Property(key, defaultValue, type);
|
||||
prop.comment = comment;
|
||||
cat.put(key, prop);
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCategory(String category)
|
||||
{
|
||||
return categories.get(category) != null;
|
||||
}
|
||||
|
||||
public boolean hasKey(String category, String key)
|
||||
{
|
||||
ConfigCategory cat = categories.get(category);
|
||||
return cat != null && cat.containsKey(key);
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
if (PARENT != null && PARENT != this)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedReader buffer = null;
|
||||
UnicodeInputStreamReader input = null;
|
||||
try
|
||||
{
|
||||
if (file.getParentFile() != null)
|
||||
{
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
if (!file.exists() && !file.createNewFile())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.canRead())
|
||||
{
|
||||
input = new UnicodeInputStreamReader(new FileInputStream(file), defaultEncoding);
|
||||
defaultEncoding = input.getEncoding();
|
||||
buffer = new BufferedReader(input);
|
||||
|
||||
String line;
|
||||
ConfigCategory currentCat = null;
|
||||
Property.Type type = null;
|
||||
ArrayList<String> tmpList = null;
|
||||
int lineNum = 0;
|
||||
String name = null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
lineNum++;
|
||||
line = buffer.readLine();
|
||||
|
||||
if (line == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Matcher start = CONFIG_START.matcher(line);
|
||||
Matcher end = CONFIG_END.matcher(line);
|
||||
|
||||
if (start.matches())
|
||||
{
|
||||
fileName = start.group(1);
|
||||
categories = new TreeMap<String, ConfigCategory>();
|
||||
continue;
|
||||
}
|
||||
else if (end.matches())
|
||||
{
|
||||
fileName = end.group(1);
|
||||
Configuration child = new Configuration();
|
||||
child.categories = categories;
|
||||
this.children.put(fileName, child);
|
||||
continue;
|
||||
}
|
||||
|
||||
int nameStart = -1, nameEnd = -1;
|
||||
boolean skip = false;
|
||||
boolean quoted = false;
|
||||
|
||||
for (int i = 0; i < line.length() && !skip; ++i)
|
||||
{
|
||||
if (Character.isLetterOrDigit(line.charAt(i)) || ALLOWED_CHARS.indexOf(line.charAt(i)) != -1 || (quoted && 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 '"':
|
||||
if (quoted)
|
||||
{
|
||||
quoted = false;
|
||||
}
|
||||
if (!quoted && nameStart == -1)
|
||||
{
|
||||
quoted = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '{':
|
||||
name = line.substring(nameStart, nameEnd + 1);
|
||||
String qualifiedName = ConfigCategory.getQualifiedName(name, currentCat);
|
||||
|
||||
ConfigCategory cat = categories.get(qualifiedName);
|
||||
if (cat == null)
|
||||
{
|
||||
currentCat = new ConfigCategory(name, currentCat);
|
||||
categories.put(qualifiedName, currentCat);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentCat = cat;
|
||||
}
|
||||
name = null;
|
||||
|
||||
break;
|
||||
|
||||
case '}':
|
||||
if (currentCat == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Config file corrupt, attepted to close to many categories '%s:%d'", fileName, lineNum));
|
||||
}
|
||||
currentCat = currentCat.parent;
|
||||
break;
|
||||
|
||||
case '=':
|
||||
name = line.substring(nameStart, nameEnd + 1);
|
||||
|
||||
if (currentCat == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum));
|
||||
}
|
||||
|
||||
Property prop = new Property(name, line.substring(i + 1), type, true);
|
||||
i = line.length();
|
||||
|
||||
currentCat.put(name, prop);
|
||||
|
||||
break;
|
||||
|
||||
case ':':
|
||||
type = Property.Type.tryParse(line.substring(nameStart, nameEnd + 1).charAt(0));
|
||||
nameStart = nameEnd = -1;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
if (tmpList != null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum));
|
||||
}
|
||||
|
||||
name = line.substring(nameStart, nameEnd + 1);
|
||||
|
||||
if (currentCat == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum));
|
||||
}
|
||||
|
||||
tmpList = new ArrayList<String>();
|
||||
|
||||
skip = true;
|
||||
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (tmpList == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum));
|
||||
}
|
||||
|
||||
currentCat.put(name, new Property(name, tmpList.toArray(new String[tmpList.size()]), type));
|
||||
name = null;
|
||||
tmpList = null;
|
||||
type = null;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(String.format("Unknown character '%s' in '%s:%d'", line.charAt(i), fileName, lineNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quoted)
|
||||
{
|
||||
throw new RuntimeException(String.format("Unmatched quote in '%s:%d'", fileName, lineNum));
|
||||
}
|
||||
else if (tmpList != null && !skip)
|
||||
{
|
||||
tmpList.add(line.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (buffer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
buffer.close();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
if (input != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
input.close();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
}
|
||||
|
||||
resetChangedState();
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
if (PARENT != null && PARENT != this)
|
||||
{
|
||||
PARENT.save();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (file.getParentFile() != null)
|
||||
{
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
if (!file.exists() && !file.createNewFile())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.canWrite())
|
||||
{
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
BufferedWriter buffer = new BufferedWriter(new OutputStreamWriter(fos, defaultEncoding));
|
||||
|
||||
buffer.write("# Configuration file" + NEW_LINE + NEW_LINE);
|
||||
|
||||
if (children.isEmpty())
|
||||
{
|
||||
save(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Map.Entry<String, Configuration> entry : children.entrySet())
|
||||
{
|
||||
buffer.write("START: \"" + entry.getKey() + "\"" + NEW_LINE);
|
||||
entry.getValue().save(buffer);
|
||||
buffer.write("END: \"" + entry.getKey() + "\"" + NEW_LINE + NEW_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
buffer.close();
|
||||
fos.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void save(BufferedWriter out) throws IOException
|
||||
{
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
if (!cat.isChild())
|
||||
{
|
||||
cat.write(out, 0);
|
||||
out.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigCategory getCategory(String category)
|
||||
{
|
||||
ConfigCategory ret = categories.get(category);
|
||||
|
||||
if (ret == null)
|
||||
{
|
||||
if (category.contains(CATEGORY_SPLITTER))
|
||||
{
|
||||
String[] hierarchy = category.split("\\"+CATEGORY_SPLITTER);
|
||||
ConfigCategory parent = categories.get(hierarchy[0]);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
parent = new ConfigCategory(hierarchy[0]);
|
||||
categories.put(parent.getQualifiedName(), parent);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
for (int i = 1; i < hierarchy.length; i++)
|
||||
{
|
||||
String name = ConfigCategory.getQualifiedName(hierarchy[i], parent);
|
||||
ConfigCategory child = categories.get(name);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
child = new ConfigCategory(hierarchy[i], parent);
|
||||
categories.put(name, child);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
ret = child;
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = new ConfigCategory(category);
|
||||
categories.put(category, ret);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void removeCategory(ConfigCategory category)
|
||||
{
|
||||
for (ConfigCategory child : category.getChildren())
|
||||
{
|
||||
removeCategory(child);
|
||||
}
|
||||
|
||||
if (categories.containsKey(category.getQualifiedName()))
|
||||
{
|
||||
categories.remove(category.getQualifiedName());
|
||||
if (category.parent != null)
|
||||
{
|
||||
category.parent.removeChild(category);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void addCustomCategoryComment(String category, String comment)
|
||||
{
|
||||
if (!caseSensitiveCustomCategories)
|
||||
category = category.toLowerCase(Locale.ENGLISH);
|
||||
getCategory(category).setComment(comment);
|
||||
}
|
||||
|
||||
private void setChild(String name, Configuration child)
|
||||
{
|
||||
if (!children.containsKey(name))
|
||||
{
|
||||
children.put(name, child);
|
||||
changed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration old = children.get(name);
|
||||
child.categories = old.categories;
|
||||
child.fileName = old.fileName;
|
||||
old.changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void enableGlobalConfig()
|
||||
{
|
||||
PARENT = new Configuration(new File(Loader.instance().getConfigDir(), "global.cfg"));
|
||||
PARENT.load();
|
||||
}
|
||||
|
||||
public static class UnicodeInputStreamReader extends Reader
|
||||
{
|
||||
private final InputStreamReader input;
|
||||
private final String defaultEnc;
|
||||
|
||||
public UnicodeInputStreamReader(InputStream source, String encoding) throws IOException
|
||||
{
|
||||
defaultEnc = encoding;
|
||||
String enc = encoding;
|
||||
byte[] data = new byte[4];
|
||||
|
||||
PushbackInputStream pbStream = new PushbackInputStream(source, data.length);
|
||||
int read = pbStream.read(data, 0, data.length);
|
||||
int size = 0;
|
||||
|
||||
int bom16 = (data[0] & 0xFF) << 8 | (data[1] & 0xFF);
|
||||
int bom24 = bom16 << 8 | (data[2] & 0xFF);
|
||||
int bom32 = bom24 << 8 | (data[3] & 0xFF);
|
||||
|
||||
if (bom24 == 0xEFBBBF)
|
||||
{
|
||||
enc = "UTF-8";
|
||||
size = 3;
|
||||
}
|
||||
else if (bom16 == 0xFEFF)
|
||||
{
|
||||
enc = "UTF-16BE";
|
||||
size = 2;
|
||||
}
|
||||
else if (bom16 == 0xFFFE)
|
||||
{
|
||||
enc = "UTF-16LE";
|
||||
size = 2;
|
||||
}
|
||||
else if (bom32 == 0x0000FEFF)
|
||||
{
|
||||
enc = "UTF-32BE";
|
||||
size = 4;
|
||||
}
|
||||
else if (bom32 == 0xFFFE0000) //This will never happen as it'll be caught by UTF-16LE,
|
||||
{ //but if anyone ever runs across a 32LE file, i'd like to disect it.
|
||||
enc = "UTF-32LE";
|
||||
size = 4;
|
||||
}
|
||||
|
||||
if (size < read)
|
||||
{
|
||||
pbStream.unread(data, size, read - size);
|
||||
}
|
||||
|
||||
this.input = new InputStreamReader(pbStream, enc);
|
||||
}
|
||||
|
||||
public String getEncoding()
|
||||
{
|
||||
return input.getEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException
|
||||
{
|
||||
return input.read(cbuf, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasChanged()
|
||||
{
|
||||
if (changed) return true;
|
||||
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
if (cat.hasChanged()) return true;
|
||||
}
|
||||
|
||||
for (Configuration child : children.values())
|
||||
{
|
||||
if (child.hasChanged()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void resetChangedState()
|
||||
{
|
||||
changed = false;
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
cat.resetChangedState();
|
||||
}
|
||||
|
||||
for (Configuration child : children.values())
|
||||
{
|
||||
child.resetChangedState();
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getCategoryNames()
|
||||
{
|
||||
return ImmutableSet.copyOf(categories.keySet());
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemInWorldManager;
|
||||
import net.minecraft.network.packet.Packet204ClientInfo;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.stats.StatBase;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
//Preliminary, simple Fake Player class
|
||||
public class FakePlayer extends EntityPlayerMP
|
||||
{
|
||||
public FakePlayer(World world, String name)
|
||||
{
|
||||
super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
|
||||
}
|
||||
|
||||
public void sendChatToPlayer(String s){}
|
||||
public boolean canCommandSenderUseCommand(int i, String s){ return false; }
|
||||
public ChunkCoordinates getPlayerCoordinates()
|
||||
{
|
||||
return new ChunkCoordinates(0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChatToPlayer(ChatMessageComponent chatmessagecomponent){}
|
||||
@Override
|
||||
public void addStat(StatBase par1StatBase, int par2){}
|
||||
@Override
|
||||
public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
|
||||
@Override
|
||||
public boolean isEntityInvulnerable(){ return true; }
|
||||
@Override
|
||||
public boolean canAttackPlayer(EntityPlayer player){ return false; }
|
||||
@Override
|
||||
public void onDeath(DamageSource source){ return; }
|
||||
@Override
|
||||
public void onUpdate(){ return; }
|
||||
@Override
|
||||
public void travelToDimension(int dim){ return; }
|
||||
@Override
|
||||
public void updateClientInfo(Packet204ClientInfo pkt){ return; }
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
//To be expanded for generic Mod fake players?
|
||||
public class FakePlayerFactory
|
||||
{
|
||||
// Map of all active fake player usernames to their entities
|
||||
private static java.util.Map<String, FakePlayer> fakePlayers = new java.util.HashMap<String, FakePlayer>();
|
||||
private static FakePlayer MINECRAFT_PLAYER = null;
|
||||
|
||||
public static FakePlayer getMinecraft(World world)
|
||||
{
|
||||
if (MINECRAFT_PLAYER == null)
|
||||
{
|
||||
MINECRAFT_PLAYER = FakePlayerFactory.get(world, "[Minecraft]");
|
||||
}
|
||||
return MINECRAFT_PLAYER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a fake player with a given username
|
||||
*/
|
||||
public static FakePlayer get(World world, String username)
|
||||
{
|
||||
if (!fakePlayers.containsKey(username))
|
||||
{
|
||||
FakePlayer fakePlayer = new FakePlayer(world, username);
|
||||
fakePlayers.put(username, fakePlayer);
|
||||
}
|
||||
|
||||
return fakePlayers.get(username);
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.management.PlayerInstance;
|
||||
import net.minecraft.world.storage.SaveHandler;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraftforge.classloading.FMLForgePlugin;
|
||||
import net.minecraftforge.common.network.ForgeConnectionHandler;
|
||||
import net.minecraftforge.common.network.ForgeNetworkHandler;
|
||||
import net.minecraftforge.common.network.ForgePacketHandler;
|
||||
import net.minecraftforge.common.network.ForgeTinyPacketHandler;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.server.command.ForgeCommand;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import cpw.mods.fml.client.FMLFileResourcePack;
|
||||
import cpw.mods.fml.client.FMLFolderResourcePack;
|
||||
import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.LoadController;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.WorldAccessContainer;
|
||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import static net.minecraftforge.common.ForgeVersion.*;
|
||||
import static net.minecraftforge.common.Configuration.*;
|
||||
|
||||
@NetworkMod(
|
||||
channels = "FORGE",
|
||||
connectionHandler = ForgeConnectionHandler.class,
|
||||
packetHandler = ForgePacketHandler.class,
|
||||
tinyPacketHandler = ForgeTinyPacketHandler.class
|
||||
)
|
||||
public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer
|
||||
{
|
||||
public static int clumpingThreshold = 64;
|
||||
public static boolean removeErroringEntities = false;
|
||||
public static boolean removeErroringTileEntities = false;
|
||||
public static boolean disableStitchedFileSaving = false;
|
||||
public static boolean forceDuplicateFluidBlockCrash = true;
|
||||
public static boolean fullBoundingBoxLadders = false;
|
||||
public static double zombieSummonBaseChance = 0.1;
|
||||
public static int[] blendRanges = { 20, 15, 10, 5 };
|
||||
public static float zombieBabyChance = 0.05f;
|
||||
public static boolean shouldSortRecipies = false;
|
||||
|
||||
public ForgeDummyContainer()
|
||||
{
|
||||
super(new ModMetadata());
|
||||
ModMetadata meta = getMetadata();
|
||||
meta.modId = "Forge";
|
||||
meta.name = "Minecraft Forge";
|
||||
meta.version = String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
|
||||
meta.credits = "Made possible with help from many people";
|
||||
meta.authorList = Arrays.asList("LexManos", "Eloraam", "Spacetoad");
|
||||
meta.description = "Minecraft Forge is a common open source API allowing a broad range of mods " +
|
||||
"to work cooperatively together. It allows many mods to be created without " +
|
||||
"them editing the main Minecraft code.";
|
||||
meta.url = "http://MinecraftForge.net";
|
||||
meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html";
|
||||
meta.screenshots = new String[0];
|
||||
meta.logoFile = "/forge_logo.png";
|
||||
|
||||
Configuration config = null;
|
||||
File cfgFile = new File(Loader.instance().getConfigDir(), "forge.cfg");
|
||||
try
|
||||
{
|
||||
config = new Configuration(cfgFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Error loading forge.cfg, deleting file and resetting: ");
|
||||
e.printStackTrace();
|
||||
|
||||
if (cfgFile.exists())
|
||||
cfgFile.delete();
|
||||
|
||||
config = new Configuration(cfgFile);
|
||||
}
|
||||
if (!config.isChild)
|
||||
{
|
||||
config.load();
|
||||
Property enableGlobalCfg = config.get(Configuration.CATEGORY_GENERAL, "enableGlobalConfig", false);
|
||||
if (enableGlobalCfg.getBoolean(false))
|
||||
{
|
||||
Configuration.enableGlobalConfig();
|
||||
}
|
||||
}
|
||||
Property prop;
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "clumpingThreshold", 64);
|
||||
prop.comment = "Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024";
|
||||
clumpingThreshold = prop.getInt(64);
|
||||
if (clumpingThreshold > 1024 || clumpingThreshold < 64)
|
||||
{
|
||||
clumpingThreshold = 64;
|
||||
prop.set(64);
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringEntities", false);
|
||||
prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.";
|
||||
removeErroringEntities = prop.getBoolean(false);
|
||||
|
||||
if (removeErroringEntities)
|
||||
{
|
||||
FMLLog.warning("Enabling removal of erroring Entities - USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false);
|
||||
prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.";
|
||||
removeErroringTileEntities = prop.getBoolean(false);
|
||||
|
||||
if (removeErroringTileEntities)
|
||||
{
|
||||
FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
//prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true);
|
||||
//prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true";
|
||||
//disableStitchedFileSaving = prop.getBoolean(true);
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false);
|
||||
prop.comment = "Set this to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticable differences in mechanics so default is vanilla behavior. Default: false";
|
||||
fullBoundingBoxLadders = prop.getBoolean(false);
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "forceDuplicateFluidBlockCrash", true);
|
||||
prop.comment = "Set this to force a crash if more than one block attempts to link back to the same Fluid. Enabled by default.";
|
||||
forceDuplicateFluidBlockCrash = prop.getBoolean(true);
|
||||
|
||||
if (!forceDuplicateFluidBlockCrash)
|
||||
{
|
||||
FMLLog.warning("Disabling forced crashes on duplicate Fluid Blocks - USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 20, 15, 10, 5 });
|
||||
prop.comment = "Control the range of sky blending for colored skies in biomes.";
|
||||
blendRanges = prop.getIntList();
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "zombieBaseSummonChance", 0.1);
|
||||
prop.comment = "Base zombie summoning spawn chance. Allows changing the bonus zombie summoning mechanic.";
|
||||
zombieSummonBaseChance = prop.getDouble(0.1);
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "zombieBabyChance", 0.05);
|
||||
prop.comment = "Chance that a zombie (or subclass) is a baby. Allows changing the zombie spawning mechanic.";
|
||||
zombieBabyChance = (float) prop.getDouble(0.05);
|
||||
|
||||
prop = config.get(CATEGORY_GENERAL, "sortRecipies", shouldSortRecipies);
|
||||
prop.comment = "Set to true to enable the post initlization sorting of crafting recipes using Froge's sorter. May cause desyncing on conflicting recipies. ToDo: Set to true by default in 1.7";
|
||||
shouldSortRecipies = prop.getBoolean(shouldSortRecipies);
|
||||
|
||||
if (config.hasChanged())
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerBus(EventBus bus, LoadController controller)
|
||||
{
|
||||
bus.register(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void modConstruction(FMLConstructionEvent evt)
|
||||
{
|
||||
FMLLog.info("Registering Forge Packet Handler");
|
||||
try
|
||||
{
|
||||
FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
|
||||
FMLLog.info("Succeeded registering Forge Packet Handler");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void postInit(FMLPostInitializationEvent evt)
|
||||
{
|
||||
BiomeDictionary.registerAllBiomesAndGenerateEvents();
|
||||
ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAvalible(FMLLoadCompleteEvent evt)
|
||||
{
|
||||
if (shouldSortRecipies)
|
||||
{
|
||||
RecipeSorter.sortCraftManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void serverStarting(FMLServerStartingEvent evt)
|
||||
{
|
||||
evt.registerServerCommand(new ForgeCommand(evt.getServer()));
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
|
||||
{
|
||||
NBTTagCompound forgeData = new NBTTagCompound();
|
||||
NBTTagCompound dimData = DimensionManager.saveDimensionDataMap();
|
||||
forgeData.setCompoundTag("DimensionData", dimData);
|
||||
return forgeData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
|
||||
{
|
||||
if (tag.hasKey("DimensionData"))
|
||||
{
|
||||
DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSource()
|
||||
{
|
||||
return FMLForgePlugin.forgeLocation;
|
||||
}
|
||||
@Override
|
||||
public Class<?> getCustomResourcePackClass()
|
||||
{
|
||||
if (getSource().isDirectory())
|
||||
{
|
||||
return FMLFolderResourcePack.class;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FMLFileResourcePack.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
public class ForgeVersion
|
||||
{
|
||||
//This number is incremented every time we remove deprecated code/major API changes, never reset
|
||||
public static final int majorVersion = 9;
|
||||
//This number is incremented every minecraft release, never reset
|
||||
public static final int minorVersion = 11;
|
||||
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
|
||||
public static final int revisionVersion = 1;
|
||||
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
|
||||
public static final int buildVersion = 0;
|
||||
|
||||
public static int getMajorVersion()
|
||||
{
|
||||
return majorVersion;
|
||||
}
|
||||
|
||||
public static int getMinorVersion()
|
||||
{
|
||||
return minorVersion;
|
||||
}
|
||||
|
||||
public static int getRevisionVersion()
|
||||
{
|
||||
return revisionVersion;
|
||||
}
|
||||
|
||||
public static int getBuildVersion()
|
||||
{
|
||||
return buildVersion;
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
return String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPlantable
|
||||
{
|
||||
public EnumPlantType getPlantType(World world, int x, int y, int z);
|
||||
public int getPlantID(World world, int x, int y, int z);
|
||||
public int getPlantMetadata(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.*;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeHooks.GrassEntry;
|
||||
import net.minecraftforge.common.ForgeHooks.SeedEntry;
|
||||
import net.minecraftforge.event.EventBus;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class MinecraftForge
|
||||
{
|
||||
/**
|
||||
* The core Forge EventBusses, all events for Forge will be fired on these,
|
||||
* you should use this to register all your listeners.
|
||||
* This replaces every register*Handler() function in the old version of Forge.
|
||||
* TERRAIN_GEN_BUS for terrain gen events
|
||||
* ORE_GEN_BUS for ore gen events
|
||||
* EVENT_BUS for everything else
|
||||
*/
|
||||
public static final EventBus EVENT_BUS = new EventBus();
|
||||
public static final EventBus TERRAIN_GEN_BUS = new EventBus();
|
||||
public static final EventBus ORE_GEN_BUS = new EventBus();
|
||||
|
||||
private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();
|
||||
|
||||
|
||||
/** Register a new plant to be planted when bonemeal is used on grass.
|
||||
* @param block The block to place.
|
||||
* @param metadata The metadata to set for the block when being placed.
|
||||
* @param weight The weight of the plant, where red flowers are
|
||||
* 10 and yellow flowers are 20.
|
||||
*/
|
||||
public static void addGrassPlant(Block block, int metadata, int weight)
|
||||
{
|
||||
ForgeHooks.grassList.add(new GrassEntry(block, metadata, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new seed to be dropped when breaking tall grass.
|
||||
*
|
||||
* @param seed The item to drop as a seed.
|
||||
* @param weight The relative probability of the seeds,
|
||||
* where wheat seeds are 10.
|
||||
*/
|
||||
public static void addGrassSeed(ItemStack seed, int weight)
|
||||
{
|
||||
ForgeHooks.seedList.add(new SeedEntry(seed, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Register a tool as a tool class with a given harvest level.
|
||||
*
|
||||
* @param tool The custom tool to register.
|
||||
* @param toolClass The tool class to register as. The predefined tool
|
||||
* clases are "pickaxe", "shovel", "axe". You can add
|
||||
* others for custom tools.
|
||||
* @param harvestLevel The harvest level of the tool.
|
||||
*/
|
||||
public static void setToolClass(Item tool, String toolClass, int harvestLevel)
|
||||
{
|
||||
ForgeHooks.toolClasses.put(tool, Arrays.asList(toolClass, harvestLevel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a block to be harvested by a tool class. This is the metadata
|
||||
* sensitive version, use it if your blocks are using metadata variants.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param block The block to register.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param harvestLevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
*
|
||||
* @param block The block to remove effectiveness from.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to remove the effectiveness mapping from.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block block, int metadata, String toolClass)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a block to be harvested by a tool class.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param block The block to register.
|
||||
* @param toolClass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param harvestLevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel)
|
||||
{
|
||||
for (int metadata = 0; metadata < 16; metadata++)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block harvest level for a particular tool class.
|
||||
*
|
||||
* @param block The block to check.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to check as able to remove this block.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
* @return The harvest level or -1 if no mapping exists.
|
||||
*/
|
||||
public static int getBlockHarvestLevel(Block block, int metadata, String toolClass)
|
||||
{
|
||||
ForgeHooks.initTools();
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
Integer harvestLevel = ForgeHooks.toolHarvestLevels.get(key);
|
||||
return (harvestLevel == null ? -1 : harvestLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
*
|
||||
* @param block The block to remove effectiveness from.
|
||||
* @param toolClass The tool class to remove the effectiveness mapping from.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block block, String toolClass)
|
||||
{
|
||||
for (int metadata = 0; metadata < 16; metadata++)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method invoked by FML before any other mods are loaded.
|
||||
*/
|
||||
public static void initialize()
|
||||
{
|
||||
System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion());
|
||||
FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion());
|
||||
|
||||
Block filler = new Block(0, Material.air)
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IconRegister register){}
|
||||
};
|
||||
Block.blocksList[0] = null;
|
||||
Block.opaqueCubeLookup[0] = false;
|
||||
Block.lightOpacity[0] = 0;
|
||||
filler.setUnlocalizedName("ForgeFiller");
|
||||
|
||||
for (int x = 256; x < 4096; x++)
|
||||
{
|
||||
if (Item.itemsList[x] != null)
|
||||
{
|
||||
Block.blocksList[x] = filler;
|
||||
}
|
||||
}
|
||||
|
||||
boolean[] temp = new boolean[4096];
|
||||
System.arraycopy(EntityEnderman.carriableBlocks, 0, temp, 0, EntityEnderman.carriableBlocks.length);
|
||||
EntityEnderman.carriableBlocks = temp;
|
||||
|
||||
EVENT_BUS.register(INTERNAL_HANDLER);
|
||||
OreDictionary.getOreName(0);
|
||||
|
||||
//Force these classes to be defined, Should prevent derp error hiding.
|
||||
new CrashReport("ThisIsFake", new Exception("Not real"));
|
||||
}
|
||||
|
||||
public static String getBrandingVersion()
|
||||
{
|
||||
return "Minecraft Forge "+ ForgeVersion.getVersion();
|
||||
}
|
||||
}
|
||||
@@ -1,409 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraftforge.common.Property.Type;
|
||||
|
||||
public class Property
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
STRING,
|
||||
INTEGER,
|
||||
BOOLEAN,
|
||||
DOUBLE;
|
||||
|
||||
private static Type[] values = {STRING, INTEGER, BOOLEAN, DOUBLE};
|
||||
|
||||
public static Type tryParse(char id)
|
||||
{
|
||||
for (int x = 0; x < values.length; x++)
|
||||
{
|
||||
if (values[x].getID() == id)
|
||||
{
|
||||
return values[x];
|
||||
}
|
||||
}
|
||||
|
||||
return STRING;
|
||||
}
|
||||
|
||||
public char getID()
|
||||
{
|
||||
return name().charAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
public String comment;
|
||||
private String[] values;
|
||||
|
||||
private final boolean wasRead;
|
||||
private final boolean isList;
|
||||
private final Type type;
|
||||
private boolean changed = false;
|
||||
|
||||
public Property()
|
||||
{
|
||||
wasRead = false;
|
||||
type = null;
|
||||
isList = false;
|
||||
}
|
||||
|
||||
public Property(String name, String value, Type type)
|
||||
{
|
||||
this(name, value, type, false);
|
||||
}
|
||||
|
||||
Property(String name, String value, Type type, boolean read)
|
||||
{
|
||||
setName(name);
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
wasRead = read;
|
||||
isList = false;
|
||||
}
|
||||
|
||||
public Property(String name, String[] values, Type type)
|
||||
{
|
||||
this(name, values, type, false);
|
||||
}
|
||||
|
||||
Property(String name, String[] values, Type type, boolean read)
|
||||
{
|
||||
setName(name);
|
||||
this.type = type;
|
||||
this.values = values;
|
||||
wasRead = read;
|
||||
isList = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as it's raw string.
|
||||
*
|
||||
* @return current value
|
||||
*/
|
||||
public String getString()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as an integer,
|
||||
* if the value is not a valid integer, it will return -1.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
public int getInt()
|
||||
{
|
||||
return getInt(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as an integer,
|
||||
* if the value is not a valid integer, it will return the
|
||||
* provided default.
|
||||
*
|
||||
* @param _default The default to provide if the current value is not a valid integer
|
||||
* @return The value
|
||||
*/
|
||||
public int getInt(int _default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current value stored in this property can be converted to an integer.
|
||||
* @return True if the type of the Property is an Integer
|
||||
*/
|
||||
public boolean isIntValue()
|
||||
{
|
||||
try
|
||||
{
|
||||
Integer.parseInt(value);
|
||||
return true;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as a boolean,
|
||||
* if the value is not a valid boolean, it will return the
|
||||
* provided default.
|
||||
*
|
||||
* @param _default The default to provide
|
||||
* @return The value as a boolean, or the default
|
||||
*/
|
||||
public boolean getBoolean(boolean _default)
|
||||
{
|
||||
if (isBooleanValue())
|
||||
{
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current value held by this property is a valid boolean value.
|
||||
* @return True if it is a boolean value
|
||||
*/
|
||||
public boolean isBooleanValue()
|
||||
{
|
||||
return ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current value held by this property is a valid double value.
|
||||
* @return True if the value can be converted to an double
|
||||
*/
|
||||
public boolean isDoubleValue()
|
||||
{
|
||||
try
|
||||
{
|
||||
Double.parseDouble(value);
|
||||
return true;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as a double,
|
||||
* if the value is not a valid double, it will return the
|
||||
* provided default.
|
||||
*
|
||||
* @param _default The default to provide if the current value is not a valid double
|
||||
* @return The value
|
||||
*/
|
||||
public double getDouble(double _default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Double.parseDouble(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getStringList()
|
||||
{
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the integer value of all values that can
|
||||
* be parsed in the list.
|
||||
*
|
||||
* @return Array of length 0 if none of the values could be parsed.
|
||||
*/
|
||||
public int[] getIntList()
|
||||
{
|
||||
ArrayList<Integer> nums = new ArrayList<Integer>();
|
||||
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
nums.add(Integer.parseInt(value));
|
||||
}
|
||||
catch (NumberFormatException e){}
|
||||
}
|
||||
|
||||
int[] primitives = new int[nums.size()];
|
||||
|
||||
for (int i = 0; i < nums.size(); i++)
|
||||
{
|
||||
primitives[i] = nums.get(i);
|
||||
}
|
||||
|
||||
return primitives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all of the current values stored in this property can be converted to an integer.
|
||||
* @return True if the type of the Property is an Integer List
|
||||
*/
|
||||
public boolean isIntList()
|
||||
{
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
Integer.parseInt(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boolean value of all values that can
|
||||
* be parsed in the list.
|
||||
*
|
||||
* @return Array of length 0 if none of the values could be parsed.
|
||||
*/
|
||||
public boolean[] getBooleanList()
|
||||
{
|
||||
ArrayList<Boolean> tmp = new ArrayList<Boolean>();
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
tmp.add(Boolean.parseBoolean(value));
|
||||
}
|
||||
catch (NumberFormatException e){}
|
||||
}
|
||||
|
||||
boolean[] primitives = new boolean[tmp.size()];
|
||||
|
||||
for (int i = 0; i < tmp.size(); i++)
|
||||
{
|
||||
primitives[i] = tmp.get(i);
|
||||
}
|
||||
|
||||
return primitives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all of current values stored in this property can be converted to a boolean.
|
||||
* @return True if it is a boolean value
|
||||
*/
|
||||
public boolean isBooleanList()
|
||||
{
|
||||
for (String value : values)
|
||||
{
|
||||
if (!"true".equalsIgnoreCase(value) && !"false".equalsIgnoreCase(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the double value of all values that can
|
||||
* be parsed in the list.
|
||||
*
|
||||
* @return Array of length 0 if none of the values could be parsed.
|
||||
*/
|
||||
public double[] getDoubleList()
|
||||
{
|
||||
ArrayList<Double> tmp = new ArrayList<Double>();
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
tmp.add(Double.parseDouble(value));
|
||||
}
|
||||
catch (NumberFormatException e) {}
|
||||
}
|
||||
|
||||
double[] primitives = new double[tmp.size()];
|
||||
|
||||
for (int i = 0; i < tmp.size(); i++)
|
||||
{
|
||||
primitives[i] = tmp.get(i);
|
||||
}
|
||||
|
||||
return primitives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all of the current values stored in this property can be converted to a double.
|
||||
* @return True if the type of the Property is a double List
|
||||
*/
|
||||
public boolean isDoubleList()
|
||||
{
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
Double.parseDouble(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this config value was just created, or if it was read from the config file.
|
||||
* This is useful for mods who auto-assign there blocks to determine if the ID returned is
|
||||
* a configured one, or a automatically generated one.
|
||||
*
|
||||
* @return True if this property was loaded from the config file with a value
|
||||
*/
|
||||
public boolean wasRead()
|
||||
{
|
||||
return wasRead;
|
||||
}
|
||||
|
||||
public Type getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isList()
|
||||
{
|
||||
return isList;
|
||||
}
|
||||
|
||||
public boolean hasChanged(){ return changed; }
|
||||
void resetChangedState(){ changed = false; }
|
||||
|
||||
public void set(String value)
|
||||
{
|
||||
this.value = value;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
public void set(String[] values)
|
||||
{
|
||||
this.values = values;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
public void set(int value){ set(Integer.toString(value)); }
|
||||
public void set(boolean value){ set(Boolean.toString(value)); }
|
||||
public void set(double value){ set(Double.toString(value)); }
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet1Login;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fluids.FluidIdMapPacket;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ForgeConnectionHandler implements IConnectionHandler {
|
||||
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
Packet250CustomPayload[] fluidPackets = ForgePacket.makePacketSet(new FluidIdMapPacket());
|
||||
for (int i = 0; i < fluidPackets.length; i++) {
|
||||
PacketDispatcher.sendPacketToPlayer(fluidPackets[i], player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosed(INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraftforge.common.ForgeDummyContainer;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkModHandler;
|
||||
|
||||
public class ForgeNetworkHandler extends NetworkModHandler
|
||||
{
|
||||
public ForgeNetworkHandler(ForgeDummyContainer container)
|
||||
{
|
||||
super(container,container.getClass().getAnnotation(NetworkMod.class));
|
||||
configureNetworkMod(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptVersion(String version)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||
import net.minecraftforge.fluids.FluidIdMapPacket;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.common.primitives.UnsignedBytes;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.network.FMLNetworkException;
|
||||
|
||||
public abstract class ForgePacket
|
||||
{
|
||||
public static final String CHANNEL_ID = "FORGE";
|
||||
enum Type
|
||||
{
|
||||
/**
|
||||
* Registers a dimension for a provider on client
|
||||
*/
|
||||
REGISTERDIMENSION(DimensionRegisterPacket.class),
|
||||
/**
|
||||
* The Fluid ID map to send to the client
|
||||
*/
|
||||
FLUID_IDMAP(FluidIdMapPacket.class);
|
||||
|
||||
private Class<? extends ForgePacket> packetType;
|
||||
private ConcurrentMap<INetworkManager, ForgePacket> partTracker;
|
||||
|
||||
private Type(Class<? extends ForgePacket> clazz)
|
||||
{
|
||||
this.packetType = clazz;
|
||||
}
|
||||
|
||||
ForgePacket make()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.packetType.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwables.propagateIfPossible(e);
|
||||
FMLLog.log(Level.SEVERE, e, "A bizarre critical error occured during packet encoding");
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private ForgePacket consumePart(INetworkManager network, byte[] data)
|
||||
{
|
||||
if (partTracker == null)
|
||||
{
|
||||
partTracker = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
}
|
||||
if (!partTracker.containsKey(network))
|
||||
{
|
||||
partTracker.put(network, make());
|
||||
}
|
||||
|
||||
ForgePacket pkt = partTracker.get(network);
|
||||
|
||||
ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
|
||||
int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
|
||||
int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
|
||||
int chunkLength = bdi.readInt();
|
||||
|
||||
if (pkt.partials == null)
|
||||
{
|
||||
pkt.partials = new byte[chunkTotal][];
|
||||
}
|
||||
|
||||
pkt.partials[chunkIdx] = new byte[chunkLength];
|
||||
bdi.readFully(pkt.partials[chunkIdx]);
|
||||
for (int i = 0; i < pkt.partials.length; i++)
|
||||
{
|
||||
if (pkt.partials[i] == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return pkt;
|
||||
}
|
||||
}
|
||||
|
||||
private Type type;
|
||||
private byte[][] partials;
|
||||
|
||||
public static Packet250CustomPayload[] makePacketSet(ForgePacket packet)
|
||||
{
|
||||
byte[] packetData = packet.generatePacket();
|
||||
|
||||
if (packetData.length < 32000)
|
||||
{
|
||||
return new Packet250CustomPayload[]
|
||||
{
|
||||
new Packet250CustomPayload(CHANNEL_ID,
|
||||
Bytes.concat(new byte[]
|
||||
{
|
||||
UnsignedBytes.checkedCast(0), //IsMultipart: False
|
||||
UnsignedBytes.checkedCast(packet.getID())
|
||||
},
|
||||
packetData))
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[][] chunks = new byte[packetData.length / 32000 + 1][];
|
||||
for (int i = 0; i < packetData.length / 32000 + 1; i++)
|
||||
{
|
||||
int len = Math.min(32000, packetData.length - i* 32000);
|
||||
chunks[i] = Bytes.concat(new byte[]
|
||||
{
|
||||
UnsignedBytes.checkedCast(1), //IsMultipart: True
|
||||
UnsignedBytes.checkedCast(packet.getID()), //Packet ID
|
||||
UnsignedBytes.checkedCast(i), //Part Number
|
||||
UnsignedBytes.checkedCast(chunks.length), //Total Parts
|
||||
},
|
||||
Ints.toByteArray(len), //Length
|
||||
Arrays.copyOfRange(packetData, i * 32000, len + i * 32000));
|
||||
}
|
||||
|
||||
Packet250CustomPayload[] ret = new Packet250CustomPayload[chunks.length];
|
||||
for (int i = 0; i < chunks.length; i++)
|
||||
{
|
||||
ret[i] = new Packet250CustomPayload(CHANNEL_ID, chunks[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public static ForgePacket readPacket(INetworkManager network, byte[] payload)
|
||||
{
|
||||
boolean multipart = UnsignedBytes.toInt(payload[0]) == 1;
|
||||
int type = UnsignedBytes.toInt(payload[1]);
|
||||
Type eType = Type.values()[type];
|
||||
byte[] data = Arrays.copyOfRange(payload, 2, payload.length);
|
||||
|
||||
if (multipart)
|
||||
{
|
||||
ForgePacket pkt = eType.consumePart(network, data);
|
||||
if (pkt != null)
|
||||
{
|
||||
return pkt.consumePacket(Bytes.concat(pkt.partials));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return eType.make().consumePacket(data);
|
||||
}
|
||||
}
|
||||
|
||||
public ForgePacket()
|
||||
{
|
||||
for (Type t : Type.values())
|
||||
{
|
||||
if (t.packetType == getClass())
|
||||
{
|
||||
type = t;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new RuntimeException("ForgePacket constructor called on ungregistered type.");
|
||||
}
|
||||
}
|
||||
|
||||
public byte getID()
|
||||
{
|
||||
return UnsignedBytes.checkedCast(type.ordinal());
|
||||
}
|
||||
|
||||
public abstract byte[] generatePacket();
|
||||
|
||||
public abstract ForgePacket consumePacket(byte[] data);
|
||||
|
||||
public abstract void execute(INetworkManager network, EntityPlayer player);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.FMLPacket;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ForgePacketHandler implements IPacketHandler {
|
||||
|
||||
@Override
|
||||
public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player)
|
||||
{
|
||||
ForgePacket pkt = ForgePacket.readPacket(network, packet.data);
|
||||
// Part of an incomplete multipart packet
|
||||
if (pkt == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pkt.execute(network, (EntityPlayer)player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet131MapData;
|
||||
import cpw.mods.fml.common.network.ITinyPacketHandler;
|
||||
|
||||
public class ForgeTinyPacketHandler implements ITinyPacketHandler {
|
||||
|
||||
@Override
|
||||
public void handle(NetHandler handler, Packet131MapData mapData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.network.packet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.network.ForgePacket;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
/**
|
||||
* This class offers the ability for servers to register dimensions on client.
|
||||
*/
|
||||
public class DimensionRegisterPacket extends ForgePacket
|
||||
{
|
||||
|
||||
/** The dimension ID to register on client */
|
||||
public int dimensionId;
|
||||
/** The provider ID to register with dimension on client */
|
||||
public int providerId;
|
||||
|
||||
// nullary constructor required by ForgePacket.make()
|
||||
public DimensionRegisterPacket() {}
|
||||
|
||||
public DimensionRegisterPacket(int dimensionId, int providerId)
|
||||
{
|
||||
this.dimensionId = dimensionId;
|
||||
this.providerId = providerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket()
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
dat.writeInt(this.dimensionId);
|
||||
dat.writeInt(this.providerId);
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgePacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
dimensionId = dat.readInt();
|
||||
providerId = dat.readInt();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, EntityPlayer player)
|
||||
{
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
{
|
||||
if (!DimensionManager.isDimensionRegistered(dimensionId))
|
||||
{
|
||||
DimensionManager.registerDimension(dimensionId, providerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
||||
public class ASMEventHandler implements IEventListener
|
||||
{
|
||||
private static int IDs = 0;
|
||||
private static final String HANDLER_DESC = Type.getInternalName(IEventListener.class);
|
||||
private static final String HANDLER_FUNC_DESC = Type.getMethodDescriptor(IEventListener.class.getDeclaredMethods()[0]);
|
||||
private static final ASMClassLoader LOADER = new ASMClassLoader();
|
||||
private static final HashMap<Method, Class<?>> cache = Maps.newHashMap();
|
||||
|
||||
private final IEventListener handler;
|
||||
private final ForgeSubscribe subInfo;
|
||||
public ASMEventHandler(Object target, Method method) throws Exception
|
||||
{
|
||||
handler = (IEventListener)createWrapper(method).getConstructor(Object.class).newInstance(target);
|
||||
subInfo = method.getAnnotation(ForgeSubscribe.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(Event event)
|
||||
{
|
||||
if (handler != null)
|
||||
{
|
||||
if (!event.isCancelable() || !event.isCanceled() || subInfo.receiveCanceled())
|
||||
{
|
||||
handler.invoke(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EventPriority getPriority()
|
||||
{
|
||||
return subInfo.priority();
|
||||
}
|
||||
|
||||
public Class<?> createWrapper(Method callback)
|
||||
{
|
||||
if (cache.containsKey(callback))
|
||||
{
|
||||
return cache.get(callback);
|
||||
}
|
||||
|
||||
ClassWriter cw = new ClassWriter(0);
|
||||
MethodVisitor mv;
|
||||
|
||||
String name = getUniqueName(callback);
|
||||
String desc = name.replace('.', '/');
|
||||
String instType = Type.getInternalName(callback.getDeclaringClass());
|
||||
String eventType = Type.getInternalName(callback.getParameterTypes()[0]);
|
||||
|
||||
/*
|
||||
System.out.println("Name: " + name);
|
||||
System.out.println("Desc: " + desc);
|
||||
System.out.println("InstType: " + instType);
|
||||
System.out.println("Callback: " + callback.getName() + Type.getMethodDescriptor(callback));
|
||||
System.out.println("Event: " + eventType);
|
||||
*/
|
||||
|
||||
cw.visit(V1_6, ACC_PUBLIC | ACC_SUPER, desc, null, "java/lang/Object", new String[]{ HANDLER_DESC });
|
||||
|
||||
cw.visitSource(".dynamic", null);
|
||||
{
|
||||
cw.visitField(ACC_PUBLIC, "instance", "Ljava/lang/Object;", null, null).visitEnd();
|
||||
}
|
||||
{
|
||||
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/Object;)V", null, null);
|
||||
mv.visitCode();
|
||||
mv.visitVarInsn(ALOAD, 0);
|
||||
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
|
||||
mv.visitVarInsn(ALOAD, 0);
|
||||
mv.visitVarInsn(ALOAD, 1);
|
||||
mv.visitFieldInsn(PUTFIELD, desc, "instance", "Ljava/lang/Object;");
|
||||
mv.visitInsn(RETURN);
|
||||
mv.visitMaxs(2, 2);
|
||||
mv.visitEnd();
|
||||
}
|
||||
{
|
||||
mv = cw.visitMethod(ACC_PUBLIC, "invoke", HANDLER_FUNC_DESC, null, null);
|
||||
mv.visitCode();
|
||||
mv.visitVarInsn(ALOAD, 0);
|
||||
mv.visitFieldInsn(GETFIELD, desc, "instance", "Ljava/lang/Object;");
|
||||
mv.visitTypeInsn(CHECKCAST, instType);
|
||||
mv.visitVarInsn(ALOAD, 1);
|
||||
mv.visitTypeInsn(CHECKCAST, eventType);
|
||||
mv.visitMethodInsn(INVOKEVIRTUAL, instType, callback.getName(), Type.getMethodDescriptor(callback));
|
||||
mv.visitInsn(RETURN);
|
||||
mv.visitMaxs(2, 2);
|
||||
mv.visitEnd();
|
||||
}
|
||||
cw.visitEnd();
|
||||
Class<?> ret = LOADER.define(name, cw.toByteArray());
|
||||
cache.put(callback, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private String getUniqueName(Method callback)
|
||||
{
|
||||
return String.format("%s_%d_%s_%s_%s", getClass().getName(), IDs++,
|
||||
callback.getDeclaringClass().getSimpleName(),
|
||||
callback.getName(),
|
||||
callback.getParameterTypes()[0].getSimpleName());
|
||||
}
|
||||
|
||||
private static class ASMClassLoader extends ClassLoader
|
||||
{
|
||||
private ASMClassLoader()
|
||||
{
|
||||
super(ASMClassLoader.class.getClassLoader());
|
||||
}
|
||||
|
||||
public Class<?> define(String name, byte[] data)
|
||||
{
|
||||
return defineClass(name, data, 0, data.length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = TYPE)
|
||||
public @interface Cancelable{}
|
||||
@@ -1,155 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Base Event class that all other events are derived from
|
||||
*/
|
||||
public class Event
|
||||
{
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = TYPE)
|
||||
public @interface HasResult{}
|
||||
|
||||
public enum Result
|
||||
{
|
||||
DENY,
|
||||
DEFAULT,
|
||||
ALLOW
|
||||
}
|
||||
|
||||
private boolean isCanceled = false;
|
||||
private final boolean isCancelable;
|
||||
private Result result = Result.DEFAULT;
|
||||
private final boolean hasResult;
|
||||
private static ListenerList listeners = new ListenerList();
|
||||
|
||||
private static final Map<Class, Map<Class, Boolean>> annotationMap = new ConcurrentHashMap<Class, Map<Class, Boolean>>();
|
||||
|
||||
public Event()
|
||||
{
|
||||
setup();
|
||||
isCancelable = hasAnnotation(Cancelable.class);
|
||||
hasResult = hasAnnotation(HasResult.class);
|
||||
}
|
||||
|
||||
private boolean hasAnnotation(Class annotation)
|
||||
{
|
||||
Class me = this.getClass();
|
||||
Map<Class, Boolean> list = annotationMap.get(me);
|
||||
if (list == null)
|
||||
{
|
||||
list = new ConcurrentHashMap<Class, Boolean>();
|
||||
annotationMap.put(me, list);
|
||||
}
|
||||
|
||||
Boolean cached = list.get(annotation);
|
||||
if (cached != null)
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
|
||||
Class cls = me;
|
||||
while (cls != Event.class)
|
||||
{
|
||||
if (cls.isAnnotationPresent(annotation))
|
||||
{
|
||||
list.put(annotation, true);
|
||||
return true;
|
||||
}
|
||||
cls = cls.getSuperclass();
|
||||
}
|
||||
|
||||
list.put(annotation, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this function is cancelable at all.
|
||||
* @return If access to setCanceled should be allowed
|
||||
*/
|
||||
public boolean isCancelable()
|
||||
{
|
||||
return isCancelable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this event is canceled and should stop executing.
|
||||
* @return The current canceled state
|
||||
*/
|
||||
public boolean isCanceled()
|
||||
{
|
||||
return isCanceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state of this event, not all events are cancelable, and any attempt to
|
||||
* cancel a event that can't be will result in a IllegalArgumentException.
|
||||
*
|
||||
* The functionality of setting the canceled state is defined on a per-event bases.
|
||||
*
|
||||
* @param cancel The new canceled value
|
||||
*/
|
||||
public void setCanceled(boolean cancel)
|
||||
{
|
||||
if (!isCancelable())
|
||||
{
|
||||
throw new IllegalArgumentException("Attempted to cancel a uncancelable event");
|
||||
}
|
||||
isCanceled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this event expects a significant result value.
|
||||
*/
|
||||
public boolean hasResult()
|
||||
{
|
||||
return hasResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value set as the result of this event
|
||||
*/
|
||||
public Result getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the result value for this event, not all events can have a result set, and any attempt to
|
||||
* set a result for a event that isn't expecting it will result in a IllegalArgumentException.
|
||||
*
|
||||
* The functionality of setting the result is defined on a per-event bases.
|
||||
*
|
||||
* @param value The new result
|
||||
*/
|
||||
public void setResult(Result value)
|
||||
{
|
||||
result = value;
|
||||
}
|
||||
/**
|
||||
* Called by the base constructor, this is used by ASM generated
|
||||
* event classes to setup various functionality such as the listener's list.
|
||||
*/
|
||||
protected void setup()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ListenerList object that contains all listeners
|
||||
* that are registered to this event.
|
||||
*
|
||||
* @return Listener List
|
||||
*/
|
||||
public ListenerList getListenerList()
|
||||
{
|
||||
return listeners;
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
public class EventBus
|
||||
{
|
||||
private static int maxID = 0;
|
||||
|
||||
private ConcurrentHashMap<Object, ArrayList<IEventListener>> listeners = new ConcurrentHashMap<Object, ArrayList<IEventListener>>();
|
||||
private final int busID = maxID++;
|
||||
|
||||
public EventBus()
|
||||
{
|
||||
ListenerList.resize(busID + 1);
|
||||
}
|
||||
|
||||
public void register(Object target)
|
||||
{
|
||||
if (listeners.containsKey(target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Set<? extends Class<?>> supers = TypeToken.of(target.getClass()).getTypes().rawTypes();
|
||||
for (Method method : target.getClass().getMethods())
|
||||
{
|
||||
for (Class<?> cls : supers)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method real = cls.getDeclaredMethod(method.getName(), method.getParameterTypes());
|
||||
if (real.isAnnotationPresent(ForgeSubscribe.class))
|
||||
{
|
||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||
if (parameterTypes.length != 1)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"Method " + method + " has @ForgeSubscribe annotation, but requires " + parameterTypes.length +
|
||||
" arguments. Event handler methods must require a single argument."
|
||||
);
|
||||
}
|
||||
|
||||
Class<?> eventType = parameterTypes[0];
|
||||
|
||||
if (!Event.class.isAssignableFrom(eventType))
|
||||
{
|
||||
throw new IllegalArgumentException("Method " + method + " has @ForgeSubscribe annotation, but takes a argument that is not a Event " + eventType);
|
||||
}
|
||||
|
||||
register(eventType, target, method);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void register(Class<?> eventType, Object target, Method method)
|
||||
{
|
||||
try
|
||||
{
|
||||
Constructor<?> ctr = eventType.getConstructor();
|
||||
ctr.setAccessible(true);
|
||||
Event event = (Event)ctr.newInstance();
|
||||
ASMEventHandler listener = new ASMEventHandler(target, method);
|
||||
event.getListenerList().register(busID, listener.getPriority(), listener);
|
||||
|
||||
ArrayList<IEventListener> others = listeners.get(target);
|
||||
if (others == null)
|
||||
{
|
||||
others = new ArrayList<IEventListener>();
|
||||
listeners.put(target, others);
|
||||
}
|
||||
others.add(listener);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister(Object object)
|
||||
{
|
||||
ArrayList<IEventListener> list = listeners.remove(object);
|
||||
for (IEventListener listener : list)
|
||||
{
|
||||
ListenerList.unregiterAll(busID, listener);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean post(Event event)
|
||||
{
|
||||
IEventListener[] listeners = event.getListenerList().getListeners(busID);
|
||||
for (IEventListener listener : listeners)
|
||||
{
|
||||
listener.invoke(event);
|
||||
}
|
||||
return (event.isCancelable() ? event.isCanceled() : false);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
public enum EventPriority
|
||||
{
|
||||
/*Priority of event listeners, listeners will be sorted with respect to this priority level.
|
||||
*
|
||||
* Note:
|
||||
* Due to using a ArrayList in the ListenerList,
|
||||
* these need to stay in a contiguous index starting at 0. {Default ordinal}
|
||||
*/
|
||||
HIGHEST, //First to execute
|
||||
HIGH,
|
||||
NORMAL,
|
||||
LOW,
|
||||
LOWEST //Last to execute
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = METHOD)
|
||||
public @interface ForgeSubscribe
|
||||
{
|
||||
public EventPriority priority() default EventPriority.NORMAL;
|
||||
public boolean receiveCanceled() default false;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
|
||||
|
||||
public interface IEventListener
|
||||
{
|
||||
public void invoke(Event event);
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class ListenerList
|
||||
{
|
||||
private static ArrayList<ListenerList> allLists = new ArrayList<ListenerList>();
|
||||
private static int maxSize = 0;
|
||||
|
||||
private ListenerList parent;
|
||||
private ListenerListInst[] lists = new ListenerListInst[0];
|
||||
|
||||
public ListenerList()
|
||||
{
|
||||
allLists.add(this);
|
||||
resizeLists(maxSize);
|
||||
}
|
||||
|
||||
public ListenerList(ListenerList parent)
|
||||
{
|
||||
allLists.add(this);
|
||||
this.parent = parent;
|
||||
resizeLists(maxSize);
|
||||
}
|
||||
|
||||
public static void resize(int max)
|
||||
{
|
||||
if (max <= maxSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (ListenerList list : allLists)
|
||||
{
|
||||
list.resizeLists(max);
|
||||
}
|
||||
maxSize = max;
|
||||
}
|
||||
|
||||
public void resizeLists(int max)
|
||||
{
|
||||
if (parent != null)
|
||||
{
|
||||
parent.resizeLists(max);
|
||||
}
|
||||
|
||||
if (lists.length >= max)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ListenerListInst[] newList = new ListenerListInst[max];
|
||||
int x = 0;
|
||||
for (; x < lists.length; x++)
|
||||
{
|
||||
newList[x] = lists[x];
|
||||
}
|
||||
for(; x < max; x++)
|
||||
{
|
||||
if (parent != null)
|
||||
{
|
||||
newList[x] = new ListenerListInst(parent.getInstance(x));
|
||||
}
|
||||
else
|
||||
{
|
||||
newList[x] = new ListenerListInst();
|
||||
}
|
||||
}
|
||||
lists = newList;
|
||||
}
|
||||
|
||||
public static void clearBusID(int id)
|
||||
{
|
||||
for (ListenerList list : allLists)
|
||||
{
|
||||
list.lists[id].dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected ListenerListInst getInstance(int id)
|
||||
{
|
||||
return lists[id];
|
||||
}
|
||||
|
||||
public IEventListener[] getListeners(int id)
|
||||
{
|
||||
return lists[id].getListeners();
|
||||
}
|
||||
|
||||
public void register(int id, EventPriority priority, IEventListener listener)
|
||||
{
|
||||
lists[id].register(priority, listener);
|
||||
}
|
||||
|
||||
public void unregister(int id, IEventListener listener)
|
||||
{
|
||||
lists[id].unregister(listener);
|
||||
}
|
||||
|
||||
public static void unregiterAll(int id, IEventListener listener)
|
||||
{
|
||||
for (ListenerList list : allLists)
|
||||
{
|
||||
list.unregister(id, listener);
|
||||
}
|
||||
}
|
||||
|
||||
private class ListenerListInst
|
||||
{
|
||||
private boolean rebuild = true;
|
||||
private IEventListener[] listeners;
|
||||
private ArrayList<ArrayList<IEventListener>> priorities;
|
||||
private ListenerListInst parent;
|
||||
|
||||
private ListenerListInst()
|
||||
{
|
||||
int count = EventPriority.values().length;
|
||||
priorities = new ArrayList<ArrayList<IEventListener>>(count);
|
||||
|
||||
for (int x = 0; x < count; x++)
|
||||
{
|
||||
priorities.add(new ArrayList<IEventListener>());
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
for (ArrayList<IEventListener> listeners : priorities)
|
||||
{
|
||||
listeners.clear();
|
||||
}
|
||||
priorities.clear();
|
||||
parent = null;
|
||||
listeners = null;
|
||||
}
|
||||
|
||||
private ListenerListInst(ListenerListInst parent)
|
||||
{
|
||||
this();
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ArrayList containing all listeners for this event,
|
||||
* and all parent events for the specified priority.
|
||||
*
|
||||
* The list is returned with the listeners for the children events first.
|
||||
*
|
||||
* @param priority The Priority to get
|
||||
* @return ArrayList containing listeners
|
||||
*/
|
||||
public ArrayList<IEventListener> getListeners(EventPriority priority)
|
||||
{
|
||||
ArrayList<IEventListener> ret = new ArrayList<IEventListener>(priorities.get(priority.ordinal()));
|
||||
if (parent != null)
|
||||
{
|
||||
ret.addAll(parent.getListeners(priority));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a full list of all listeners for all priority levels.
|
||||
* Including all parent listeners.
|
||||
*
|
||||
* List is returned in proper priority order.
|
||||
*
|
||||
* Automatically rebuilds the internal Array cache if its information is out of date.
|
||||
*
|
||||
* @return Array containing listeners
|
||||
*/
|
||||
public IEventListener[] getListeners()
|
||||
{
|
||||
if (shouldRebuild()) buildCache();
|
||||
return listeners;
|
||||
}
|
||||
|
||||
protected boolean shouldRebuild()
|
||||
{
|
||||
return rebuild || (parent != null && parent.shouldRebuild());
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild the local Array of listeners, returns early if there is no work to do.
|
||||
*/
|
||||
private void buildCache()
|
||||
{
|
||||
if(parent != null && parent.shouldRebuild())
|
||||
{
|
||||
parent.buildCache();
|
||||
}
|
||||
|
||||
ArrayList<IEventListener> ret = new ArrayList<IEventListener>();
|
||||
for (EventPriority value : EventPriority.values())
|
||||
{
|
||||
ret.addAll(getListeners(value));
|
||||
}
|
||||
listeners = ret.toArray(new IEventListener[ret.size()]);
|
||||
rebuild = false;
|
||||
}
|
||||
|
||||
public void register(EventPriority priority, IEventListener listener)
|
||||
{
|
||||
priorities.get(priority.ordinal()).add(listener);
|
||||
rebuild = true;
|
||||
}
|
||||
|
||||
public void unregister(IEventListener listener)
|
||||
{
|
||||
for(ArrayList<IEventListener> list : priorities)
|
||||
{
|
||||
if (list.remove(listener))
|
||||
{
|
||||
rebuild = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
public class PlayerEvent extends LivingEvent
|
||||
{
|
||||
public final EntityPlayer entityPlayer;
|
||||
public PlayerEvent(EntityPlayer player)
|
||||
{
|
||||
super(player);
|
||||
entityPlayer = player;
|
||||
}
|
||||
|
||||
public static class HarvestCheck extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public boolean success;
|
||||
|
||||
public HarvestCheck(EntityPlayer player, Block block, boolean success)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.success = success;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class BreakSpeed extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public final int metadata;
|
||||
public final float originalSpeed;
|
||||
public float newSpeed = 0.0f;
|
||||
|
||||
public BreakSpeed(EntityPlayer player, Block block, int metadata, float original)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
this.originalSpeed = original;
|
||||
this.newSpeed = original;
|
||||
}
|
||||
}
|
||||
|
||||
public static class NameFormat extends PlayerEvent
|
||||
{
|
||||
public final String username;
|
||||
public String displayname;
|
||||
|
||||
public NameFormat(EntityPlayer player, String username) {
|
||||
super(player);
|
||||
this.username = username;
|
||||
this.displayname = username;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
package net.minecraftforge.fluids;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraftforge.common.network.ForgePacket;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
public class FluidIdMapPacket extends ForgePacket
|
||||
{
|
||||
private BiMap<String, Integer> fluidIds = HashBiMap.create();
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket()
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
|
||||
dat.writeInt(FluidRegistry.maxID);
|
||||
for (Map.Entry<String, Integer> entry : FluidRegistry.fluidIDs.entrySet())
|
||||
{
|
||||
dat.writeUTF(entry.getKey());
|
||||
dat.writeInt(entry.getValue());
|
||||
}
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgePacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
int listSize = dat.readInt();
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
String fluidName = dat.readUTF();
|
||||
int fluidId = dat.readInt();
|
||||
fluidIds.put(fluidName, fluidId);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, EntityPlayer player)
|
||||
{
|
||||
FluidRegistry.initFluidIDs(fluidIds);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Implementors of this interface are a liquid which may receive a block implementation and can be placed in the world.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public interface IBlockLiquid extends ILiquid {
|
||||
/**
|
||||
* Controls the type of block that is generated by this IBlockLiquid
|
||||
*
|
||||
*/
|
||||
public enum BlockType {
|
||||
/**
|
||||
* No block. Completeness really.
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* Vanilla style block, up to 8 flowing states. May be able to generate new sources.
|
||||
*/
|
||||
VANILLA,
|
||||
/**
|
||||
* Finite liquid style, uses cellular automata to model flowing behaviour.
|
||||
*/
|
||||
FINITE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid.
|
||||
* @return if this liquid will generate new sources
|
||||
*/
|
||||
public boolean willGenerateSources();
|
||||
|
||||
/**
|
||||
* @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types.
|
||||
*/
|
||||
public int getFlowDistance();
|
||||
|
||||
/**
|
||||
* @return the RGB rendering for this liquid
|
||||
*/
|
||||
public byte[] getLiquidRGB();
|
||||
|
||||
/**
|
||||
* Get the texture file for rendering the liquid
|
||||
* @return the texture file for this liquid
|
||||
*/
|
||||
public String getLiquidBlockTextureFile();
|
||||
/**
|
||||
* Custom properties of the liquid.
|
||||
* @return a compound tag of custom liquid properties
|
||||
*/
|
||||
public NBTTagCompound getLiquidProperties();
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
/**
|
||||
* Liquids implement this interface
|
||||
*
|
||||
*/
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public interface ILiquid {
|
||||
|
||||
/**
|
||||
* The itemId of the liquid item
|
||||
* @return the itemId
|
||||
*/
|
||||
public int stillLiquidId();
|
||||
|
||||
/**
|
||||
* Is this liquid a metadata based liquid
|
||||
* @return if this is a metadata liquid
|
||||
*/
|
||||
public boolean isMetaSensitive();
|
||||
|
||||
/**
|
||||
* The item metadata of the liquid
|
||||
* @return the metadata of the liquid
|
||||
*/
|
||||
public int stillLiquidMeta();
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
/**
|
||||
* A tank is the unit of interaction with liquid inventories.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public interface ILiquidTank {
|
||||
|
||||
/**
|
||||
* @return LiquidStack representing the liquid contained in the tank, null if empty.
|
||||
*/
|
||||
LiquidStack getLiquid();
|
||||
|
||||
/**
|
||||
* @return capacity of this tank
|
||||
*/
|
||||
int getCapacity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource
|
||||
* @param doFill
|
||||
* @return Amount of liquid used for filling.
|
||||
*/
|
||||
int fill(LiquidStack resource, boolean doFill);
|
||||
/**
|
||||
*
|
||||
* @param maxDrain
|
||||
* @param doDrain
|
||||
* @return Null if nothing was drained, otherwise a LiquidStack containing the drained.
|
||||
*/
|
||||
LiquidStack drain(int maxDrain, boolean doDrain);
|
||||
|
||||
/**
|
||||
* Positive values indicate a positive liquid pressure (liquid wants to leave this tank)
|
||||
* Negative values indicate a negative liquid pressure (liquid wants to fill this tank)
|
||||
* Zero indicates no pressure
|
||||
*
|
||||
* @return a number indicating tank pressure
|
||||
*/
|
||||
public int getTankPressure();
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public interface ITankContainer {
|
||||
|
||||
/**
|
||||
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
|
||||
* @param from Orientation the liquid is pumped in from.
|
||||
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
|
||||
* @param doFill If false filling will only be simulated.
|
||||
* @return Amount of resource that was filled into internal tanks.
|
||||
*/
|
||||
int fill(ForgeDirection from, LiquidStack resource, boolean doFill);
|
||||
/**
|
||||
* Fills liquid into the specified internal tank.
|
||||
* @param tankIndex the index of the tank to fill
|
||||
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
|
||||
* @param doFill If false filling will only be simulated.
|
||||
* @return Amount of resource that was filled into internal tanks.
|
||||
*/
|
||||
int fill(int tankIndex, LiquidStack resource, boolean doFill);
|
||||
|
||||
/**
|
||||
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
|
||||
* @param from Orientation the liquid is drained to.
|
||||
* @param maxDrain Maximum amount of liquid to drain.
|
||||
* @param doDrain If false draining will only be simulated.
|
||||
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
|
||||
*/
|
||||
LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
|
||||
/**
|
||||
* Drains liquid out of the specified internal tank.
|
||||
* @param tankIndex the index of the tank to drain
|
||||
* @param maxDrain Maximum amount of liquid to drain.
|
||||
* @param doDrain If false draining will only be simulated.
|
||||
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
|
||||
*/
|
||||
LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain);
|
||||
|
||||
/**
|
||||
* @param direction tank side: UNKNOWN for default tank set
|
||||
* @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction
|
||||
*/
|
||||
ILiquidTank[] getTanks(ForgeDirection direction);
|
||||
|
||||
/**
|
||||
* Return the tank that this tank container desired to be used for the specified liquid type from the specified direction
|
||||
*
|
||||
* @param direction the direction
|
||||
* @param type the liquid type, null is always an acceptable value
|
||||
* @return a tank or null for no such tank
|
||||
*/
|
||||
ILiquidTank getTank(ForgeDirection direction, LiquidStack type);
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public class LiquidContainerData {
|
||||
|
||||
public final LiquidStack stillLiquid;
|
||||
public final ItemStack filled;
|
||||
public final ItemStack container;
|
||||
|
||||
|
||||
public LiquidContainerData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) {
|
||||
this.stillLiquid = stillLiquid;
|
||||
this.filled = filled;
|
||||
this.container = container;
|
||||
|
||||
if(stillLiquid == null || filled == null || container == null)
|
||||
throw new RuntimeException("stillLiquid, filled, or container is null, this is an error");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public class LiquidContainerRegistry
|
||||
{
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty);
|
||||
|
||||
private static Map<List, LiquidContainerData> mapFilledItemFromLiquid = new HashMap();
|
||||
private static Map<List, LiquidContainerData> mapLiquidFromFilledItem = new HashMap();
|
||||
private static Set<List> setContainerValidation = new HashSet();
|
||||
private static Set<List> setLiquidValidation = new HashSet();
|
||||
private static ArrayList<LiquidContainerData> liquids = new ArrayList();
|
||||
|
||||
/**
|
||||
* Default registrations
|
||||
*/
|
||||
static
|
||||
{
|
||||
registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketWater), new ItemStack(Item.bucketEmpty)));
|
||||
registerLiquid(new LiquidContainerData(new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketLava), new ItemStack(Item.bucketEmpty)));
|
||||
registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.potion), new ItemStack(Item.glassBottle)));
|
||||
// registerLiquid(new LiquidContainerData(new LiquidStack(Item.bucketMilk, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)));
|
||||
}
|
||||
|
||||
/**
|
||||
* To register a container with a non-bucket size, the LiquidContainerData entry simply needs to use a size other than LiquidManager.BUCKET_VOLUME
|
||||
*/
|
||||
public static void registerLiquid(LiquidContainerData data)
|
||||
{
|
||||
mapFilledItemFromLiquid.put(Arrays.asList(data.container.itemID, data.container.getItemDamage(), data.stillLiquid.itemID, data.stillLiquid.itemMeta), data);
|
||||
mapLiquidFromFilledItem.put(Arrays.asList(data.filled.itemID, data.filled.getItemDamage()), data);
|
||||
setContainerValidation.add(Arrays.asList(data.container.itemID, data.container.getItemDamage()));
|
||||
setLiquidValidation.add(Arrays.asList(data.stillLiquid.itemID, data.stillLiquid.itemMeta));
|
||||
|
||||
liquids.add(data);
|
||||
}
|
||||
|
||||
public static LiquidStack getLiquidForFilledItem(ItemStack filledContainer)
|
||||
{
|
||||
if (filledContainer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage()));
|
||||
return ret == null ? null : ret.stillLiquid.copy();
|
||||
}
|
||||
|
||||
public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer)
|
||||
{
|
||||
if (emptyContainer == null || liquid == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
LiquidContainerData ret = mapFilledItemFromLiquid.get(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage(), liquid.itemID, liquid.itemMeta));
|
||||
|
||||
if (ret != null && liquid.amount >= ret.stillLiquid.amount)
|
||||
{
|
||||
return ret.filled.copy();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean containsLiquid(ItemStack filledContainer, LiquidStack liquid)
|
||||
{
|
||||
if (filledContainer == null || liquid == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage()));
|
||||
|
||||
return ret != null && ret.stillLiquid.isLiquidEqual(liquid);
|
||||
}
|
||||
|
||||
public static boolean isBucket(ItemStack container)
|
||||
{
|
||||
if (container == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (container.isItemEqual(EMPTY_BUCKET))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(container.itemID, container.getItemDamage()));
|
||||
return ret != null && ret.container.isItemEqual(EMPTY_BUCKET);
|
||||
}
|
||||
|
||||
public static boolean isContainer(ItemStack container)
|
||||
{
|
||||
return isEmptyContainer(container) || isFilledContainer(container);
|
||||
}
|
||||
|
||||
public static boolean isEmptyContainer(ItemStack emptyContainer)
|
||||
{
|
||||
return emptyContainer != null && setContainerValidation.contains(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage()));
|
||||
}
|
||||
|
||||
public static boolean isFilledContainer(ItemStack filledContainer)
|
||||
{
|
||||
return filledContainer != null && getLiquidForFilledItem(filledContainer) != null;
|
||||
}
|
||||
|
||||
public static boolean isLiquid(ItemStack item)
|
||||
{
|
||||
return item != null && setLiquidValidation.contains(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
}
|
||||
|
||||
public static LiquidContainerData[] getRegisteredLiquidContainerData()
|
||||
{
|
||||
return liquids.toArray(new LiquidContainerData[liquids.size()]);
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* When creating liquids you should register them with this class.
|
||||
*
|
||||
* @author CovertJaguar <railcraft.wikispaces.com>
|
||||
*/
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public abstract class LiquidDictionary
|
||||
{
|
||||
|
||||
private static BiMap<String, LiquidStack> liquids = HashBiMap.create();
|
||||
|
||||
/**
|
||||
* When creating liquids you should call this function.
|
||||
*
|
||||
* Upon passing it a name and liquid item it will return either
|
||||
* a preexisting implementation of that liquid or the liquid passed in.
|
||||
*
|
||||
*
|
||||
* @param name the name of the liquid
|
||||
* @param liquid the liquid to use if one doesn't exist
|
||||
* @return the matching liquid stack
|
||||
*/
|
||||
public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid)
|
||||
{
|
||||
if (liquid == null)
|
||||
{
|
||||
throw new NullPointerException("You cannot register a null LiquidStack");
|
||||
}
|
||||
LiquidStack existing = liquids.get(name);
|
||||
if(existing != null) {
|
||||
return existing.copy();
|
||||
}
|
||||
liquids.put(name, liquid.copy());
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new LiquidRegisterEvent(name, liquid));
|
||||
return liquid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the liquid matching the name,
|
||||
* if such a liquid exists.
|
||||
*
|
||||
* Can return null.
|
||||
*
|
||||
* @param name the name of the liquid
|
||||
* @param amount the amout of liquid
|
||||
* @return a liquidstack for the requested liquid
|
||||
*/
|
||||
public static LiquidStack getLiquid(String name, int amount)
|
||||
{
|
||||
LiquidStack liquid = liquids.get(name);
|
||||
if(liquid == null)
|
||||
return null;
|
||||
|
||||
liquid = liquid.copy();
|
||||
liquid.amount = amount;
|
||||
return liquid;
|
||||
}
|
||||
|
||||
public static LiquidStack getCanonicalLiquid(String name)
|
||||
{
|
||||
return liquids.get(name);
|
||||
}
|
||||
/**
|
||||
* Get an immutable list of the liquids defined
|
||||
*
|
||||
* @return the defined liquids
|
||||
*/
|
||||
public static Map<String, LiquidStack> getLiquids()
|
||||
{
|
||||
return ImmutableMap.copyOf(liquids);
|
||||
}
|
||||
/**
|
||||
* Fired when a new liquid is created
|
||||
*
|
||||
*/
|
||||
public static class LiquidRegisterEvent extends Event
|
||||
{
|
||||
public final String Name;
|
||||
public final LiquidStack Liquid;
|
||||
|
||||
public LiquidRegisterEvent(String name, LiquidStack liquid)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Liquid = liquid.copy();
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME));
|
||||
getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
public static String findLiquidName(LiquidStack reference)
|
||||
{
|
||||
if (reference != null)
|
||||
{
|
||||
return liquids.inverse().get(reference);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static LiquidStack getCanonicalLiquid(LiquidStack liquidStack)
|
||||
{
|
||||
return liquids.get(liquids.inverse().get(liquidStack));
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event;
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public class LiquidEvent extends Event {
|
||||
public final LiquidStack liquid;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final World world;
|
||||
|
||||
public LiquidEvent(LiquidStack liquid, World world, int x, int y, int z)
|
||||
{
|
||||
this.liquid = liquid;
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mods should fire this event when they move liquids around (pipe networks etc)
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public static class LiquidMotionEvent extends LiquidEvent
|
||||
{
|
||||
public LiquidMotionEvent(LiquidStack liquid, World world, int x, int y, int z)
|
||||
{
|
||||
super(liquid, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mods should fire this event when a liquid is {@link ILiquidTank#fill(LiquidStack, boolean)} their tank implementation.
|
||||
* {@link LiquidTank} does.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public static class LiquidFillingEvent extends LiquidEvent
|
||||
{
|
||||
public final ILiquidTank tank;
|
||||
|
||||
public LiquidFillingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank)
|
||||
{
|
||||
super(liquid, world, x, y, z);
|
||||
this.tank = tank;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mods should fire this event when a liquid is {@link ILiquidTank#drain(int, boolean)} from their tank.
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public static class LiquidDrainingEvent extends LiquidEvent
|
||||
{
|
||||
public final ILiquidTank tank;
|
||||
|
||||
public LiquidDrainingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank)
|
||||
{
|
||||
super(liquid, world, x, y, z);
|
||||
this.tank = tank;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mods should fire this event when a liquid "spills", for example, if a block containing liquid is broken.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public static class LiquidSpilledEvent extends LiquidEvent
|
||||
{
|
||||
public LiquidSpilledEvent(LiquidStack liquid, World world, int x, int y, int z)
|
||||
{
|
||||
super(liquid, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A handy shortcut for firing the various liquid events
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public static final void fireEvent(LiquidEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import static cpw.mods.fml.relauncher.Side.CLIENT;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
/**
|
||||
* ItemStack substitute for liquids
|
||||
* Things of note: they are equal if their items are equal. Amount does NOT matter for java equals() testing
|
||||
* <br/>
|
||||
* The canonical liquidstack is probably the only one that has a lot of the rendering data on it. Use {@link #canonical()}
|
||||
* to get it.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public class LiquidStack
|
||||
{
|
||||
public final int itemID;
|
||||
public int amount;
|
||||
public final int itemMeta;
|
||||
public NBTTagCompound extra;
|
||||
|
||||
public LiquidStack(int itemID, int amount) { this(itemID, amount, 0); }
|
||||
public LiquidStack(Item item, int amount) { this(item.itemID, amount, 0); }
|
||||
public LiquidStack(Block block, int amount) { this(block.blockID, amount, 0); }
|
||||
|
||||
public LiquidStack(int itemID, int amount, int itemDamage)
|
||||
{
|
||||
this.itemID = itemID;
|
||||
this.amount = amount;
|
||||
this.itemMeta = itemDamage;
|
||||
}
|
||||
|
||||
public LiquidStack(int itemID, int amount, int itemDamage, NBTTagCompound nbt)
|
||||
{
|
||||
this(itemID, amount, itemDamage);
|
||||
if (nbt != null)
|
||||
{
|
||||
extra = (NBTTagCompound)nbt.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setInteger("Amount", amount);
|
||||
nbt.setShort("Id", (short)itemID);
|
||||
nbt.setShort("Meta", (short)itemMeta);
|
||||
String name = LiquidDictionary.findLiquidName(this);
|
||||
if(name != null)
|
||||
{
|
||||
nbt.setString("LiquidName", name);
|
||||
}
|
||||
if (extra != null)
|
||||
{
|
||||
nbt.setTag("extra", extra);
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A copy of this LiquidStack
|
||||
*/
|
||||
public LiquidStack copy()
|
||||
{
|
||||
return new LiquidStack(itemID, amount, itemMeta, extra);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
* @return true if this LiquidStack contains the same liquid as the one passed in.
|
||||
*/
|
||||
public boolean isLiquidEqual(LiquidStack other)
|
||||
{
|
||||
return other != null && itemID == other.itemID && itemMeta == other.itemMeta && (extra == null ? other.extra == null : extra.equals(other.extra));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
* @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount).
|
||||
*/
|
||||
public boolean containsLiquid(LiquidStack other)
|
||||
{
|
||||
return isLiquidEqual(other) && amount >= other.amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other ItemStack containing liquids.
|
||||
* @return true if this LiquidStack contains the same liquid as the one passed in.
|
||||
*/
|
||||
public boolean isLiquidEqual(ItemStack other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemID == other.itemID && itemMeta == other.getItemDamage())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return isLiquidEqual(LiquidContainerRegistry.getLiquidForFilledItem(other));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ItemStack representation of this LiquidStack
|
||||
*/
|
||||
public ItemStack asItemStack()
|
||||
{
|
||||
ItemStack stack = new ItemStack(itemID, 1, itemMeta);
|
||||
if (extra != null)
|
||||
{
|
||||
stack.stackTagCompound = (NBTTagCompound)extra.copy();
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a liquid stack from the passed nbttagcompound and returns it.
|
||||
*
|
||||
* @param nbt
|
||||
* @return the liquid stack
|
||||
*/
|
||||
public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
if (nbt == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String liquidName = nbt.getString("LiquidName");
|
||||
int itemID = nbt.getShort("Id");
|
||||
int itemMeta = nbt.getShort("Meta");
|
||||
LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName);
|
||||
if(liquid != null) {
|
||||
itemID = liquid.itemID;
|
||||
itemMeta = liquid.itemMeta;
|
||||
}
|
||||
// if the item is not existent, and no liquid dictionary is found, null returns
|
||||
else if (Item.itemsList[itemID] == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int amount = nbt.getInteger("Amount");
|
||||
LiquidStack liquidstack = new LiquidStack(itemID, amount, itemMeta);
|
||||
if (nbt.hasKey("extra"))
|
||||
{
|
||||
liquidstack.extra = nbt.getCompoundTag("extra");
|
||||
}
|
||||
return liquidstack.itemID == 0 ? null : liquidstack;
|
||||
}
|
||||
|
||||
private String textureSheet = "/terrain.png";
|
||||
|
||||
/**
|
||||
* Return the textureSheet used for this liquid stack's texture Icon
|
||||
* Defaults to '/terrain.png'
|
||||
*
|
||||
* See {@link #getRenderingIcon()} for the actual icon
|
||||
*
|
||||
* @return The texture sheet
|
||||
*/
|
||||
public String getTextureSheet()
|
||||
{
|
||||
return textureSheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the texture sheet for this icon (usually /terrain.png or /gui/items.png)
|
||||
*
|
||||
* See also the {@link #setRenderingIcon(Icon)} for the icon itself
|
||||
*
|
||||
* @param textureSheet
|
||||
* @return the liquid stack
|
||||
*/
|
||||
public LiquidStack setTextureSheet(String textureSheet)
|
||||
{
|
||||
this.textureSheet = textureSheet;
|
||||
return this;
|
||||
}
|
||||
@SideOnly(CLIENT)
|
||||
private Icon renderingIcon;
|
||||
|
||||
/**
|
||||
* Get the rendering icon for this liquid stack, for presentation in the world or in GUIs.
|
||||
* Defaults to handling water and lava, and returns the set rendering icon otherwise.
|
||||
*
|
||||
* See {@link #getTextureSheet()} to get the texture sheet this icon is associated with
|
||||
*
|
||||
* @return The icon for rendering this liquid
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public Icon getRenderingIcon()
|
||||
{
|
||||
if (itemID == Block.waterStill.blockID)
|
||||
{
|
||||
return BlockFluid.getFluidIcon("water");
|
||||
}
|
||||
else if (itemID == Block.lavaStill.blockID)
|
||||
{
|
||||
return BlockFluid.getFluidIcon("lava");
|
||||
}
|
||||
return renderingIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the icon for rendering this liquid
|
||||
* It should be refreshed whenever textures are refreshed.
|
||||
*
|
||||
* See also {@link #setTextureSheet(String)} for setting the sheet this icon is associated with
|
||||
*
|
||||
* @param icon The icon to render
|
||||
* @return The liquid stack
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public LiquidStack setRenderingIcon(Icon icon)
|
||||
{
|
||||
this.renderingIcon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode()
|
||||
{
|
||||
return 31 * itemMeta + itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object ob)
|
||||
{
|
||||
if (ob instanceof LiquidStack)
|
||||
{
|
||||
LiquidStack ls = (LiquidStack)ob;
|
||||
return ls.itemID == itemID && ls.itemMeta == itemMeta && (extra == null ? ls.extra == null : extra.equals(ls.extra));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the canonical version of this liquid stack (will contain things like icons and texturesheets)
|
||||
* @return The canonical liquidstack
|
||||
*/
|
||||
public LiquidStack canonical()
|
||||
{
|
||||
return LiquidDictionary.getCanonicalLiquid(this);
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Reference implementation of ILiquidTank. Use this or implement your own.
|
||||
*/
|
||||
@Deprecated //See new net.minecraftforge.fluids
|
||||
public class LiquidTank implements ILiquidTank {
|
||||
private LiquidStack liquid;
|
||||
private int capacity;
|
||||
private int tankPressure;
|
||||
private TileEntity tile;
|
||||
|
||||
public LiquidTank(int capacity)
|
||||
{
|
||||
this(null, capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(int liquidId, int quantity, int capacity)
|
||||
{
|
||||
this(new LiquidStack(liquidId, quantity), capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile)
|
||||
{
|
||||
this(liquidId, quantity, capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public LiquidTank(LiquidStack liquid, int capacity)
|
||||
{
|
||||
this.liquid = liquid;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public LiquidTank(LiquidStack liquid, int capacity, TileEntity tile)
|
||||
{
|
||||
this(liquid, capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack getLiquid()
|
||||
{
|
||||
return this.liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
public void setLiquid(LiquidStack liquid)
|
||||
{
|
||||
this.liquid = liquid;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity)
|
||||
{
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || resource.itemID <= 0) return 0;
|
||||
|
||||
if (liquid == null || liquid.itemID <= 0)
|
||||
{
|
||||
if (resource.amount <= capacity)
|
||||
{
|
||||
if (doFill) this.liquid = resource.copy();
|
||||
return resource.amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
this.liquid = resource.copy();
|
||||
this.liquid.amount = capacity;
|
||||
if (tile != null)
|
||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidFillingEvent(liquid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
if (!liquid.isLiquidEqual(resource)) return 0;
|
||||
|
||||
int space = capacity - liquid.amount;
|
||||
if (resource.amount <= space)
|
||||
{
|
||||
if (doFill) this.liquid.amount += resource.amount;
|
||||
return resource.amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (doFill) this.liquid.amount = capacity;
|
||||
return space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidStack drain(int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (liquid == null || liquid.itemID <= 0) return null;
|
||||
if (liquid.amount <= 0) return null;
|
||||
|
||||
int used = maxDrain;
|
||||
if (liquid.amount < used) used = liquid.amount;
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
liquid.amount -= used;
|
||||
}
|
||||
|
||||
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
|
||||
|
||||
// Reset liquid if emptied
|
||||
if (liquid.amount <= 0) liquid = null;
|
||||
|
||||
if (doDrain && tile != null)
|
||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTankPressure()
|
||||
{
|
||||
return tankPressure;
|
||||
}
|
||||
|
||||
public void setTankPressure(int pressure)
|
||||
{
|
||||
this.tankPressure = pressure;
|
||||
}
|
||||
|
||||
|
||||
public String getLiquidName()
|
||||
{
|
||||
return liquid!= null ? LiquidDictionary.findLiquidName(liquid) : null;
|
||||
}
|
||||
|
||||
public boolean containsValidLiquid()
|
||||
{
|
||||
return LiquidDictionary.findLiquidName(liquid) != null;
|
||||
}
|
||||
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
if (containsValidLiquid())
|
||||
{
|
||||
liquid.writeToNBT(nbt);
|
||||
}
|
||||
else
|
||||
{
|
||||
nbt.setString("emptyTank", "");
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public LiquidTank readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
if (!nbt.hasKey("emptyTank"))
|
||||
{
|
||||
LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt);
|
||||
if (liquid != null)
|
||||
{
|
||||
setLiquid(liquid);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
package net.minecraftforge.oredict;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class OreDictionary
|
||||
{
|
||||
private static boolean hasInit = false;
|
||||
private static int maxID = 0;
|
||||
private static HashMap<String, Integer> oreIDs = new HashMap<String, Integer>();
|
||||
private static HashMap<Integer, ArrayList<ItemStack>> oreStacks = new HashMap<Integer, ArrayList<ItemStack>>();
|
||||
|
||||
|
||||
/**
|
||||
* Minecraft changed from -1 to Short.MAX_VALUE in 1.5 release for the "block wildcard". Use this in case it
|
||||
* changes again.
|
||||
*/
|
||||
public static final int WILDCARD_VALUE = Short.MAX_VALUE;
|
||||
|
||||
static {
|
||||
initVanillaEntries();
|
||||
}
|
||||
|
||||
public static void initVanillaEntries()
|
||||
{
|
||||
if (!hasInit)
|
||||
{
|
||||
registerOre("logWood", new ItemStack(Block.wood, 1, WILDCARD_VALUE));
|
||||
registerOre("plankWood", new ItemStack(Block.planks, 1, WILDCARD_VALUE));
|
||||
registerOre("slabWood", new ItemStack(Block.woodSingleSlab, 1, WILDCARD_VALUE));
|
||||
registerOre("stairWood", Block.stairsWoodOak);
|
||||
registerOre("stairWood", Block.stairsWoodBirch);
|
||||
registerOre("stairWood", Block.stairsWoodJungle);
|
||||
registerOre("stairWood", Block.stairsWoodSpruce);
|
||||
registerOre("stickWood", Item.stick);
|
||||
registerOre("treeSapling", new ItemStack(Block.sapling, 1, WILDCARD_VALUE));
|
||||
registerOre("treeLeaves", new ItemStack(Block.leaves, 1, WILDCARD_VALUE));
|
||||
registerOre("oreGold", Block.oreGold);
|
||||
registerOre("oreIron", Block.oreIron);
|
||||
registerOre("oreLapis", Block.oreLapis);
|
||||
registerOre("oreDiamond", Block.oreDiamond);
|
||||
registerOre("oreRedstone", Block.oreRedstone);
|
||||
registerOre("oreEmerald", Block.oreEmerald);
|
||||
registerOre("oreQuartz", Block.oreNetherQuartz);
|
||||
registerOre("stone", Block.stone);
|
||||
registerOre("cobblestone", Block.cobblestone);
|
||||
registerOre("record", Item.record13);
|
||||
registerOre("record", Item.recordCat);
|
||||
registerOre("record", Item.recordBlocks);
|
||||
registerOre("record", Item.recordChirp);
|
||||
registerOre("record", Item.recordFar);
|
||||
registerOre("record", Item.recordMall);
|
||||
registerOre("record", Item.recordMellohi);
|
||||
registerOre("record", Item.recordStal);
|
||||
registerOre("record", Item.recordStrad);
|
||||
registerOre("record", Item.recordWard);
|
||||
registerOre("record", Item.record11);
|
||||
registerOre("record", Item.recordWait);
|
||||
}
|
||||
|
||||
// Build our list of items to replace with ore tags
|
||||
Map<ItemStack, String> replacements = new HashMap<ItemStack, String>();
|
||||
replacements.put(new ItemStack(Item.stick), "stickWood");
|
||||
replacements.put(new ItemStack(Block.planks), "plankWood");
|
||||
replacements.put(new ItemStack(Block.planks, 1, WILDCARD_VALUE), "plankWood");
|
||||
replacements.put(new ItemStack(Block.stone), "stone");
|
||||
replacements.put(new ItemStack(Block.stone, 1, WILDCARD_VALUE), "stone");
|
||||
replacements.put(new ItemStack(Block.cobblestone), "cobblestone");
|
||||
replacements.put(new ItemStack(Block.cobblestone, 1, WILDCARD_VALUE), "cobblestone");
|
||||
|
||||
// Register dyes
|
||||
String[] dyes =
|
||||
{
|
||||
"dyeBlack",
|
||||
"dyeRed",
|
||||
"dyeGreen",
|
||||
"dyeBrown",
|
||||
"dyeBlue",
|
||||
"dyePurple",
|
||||
"dyeCyan",
|
||||
"dyeLightGray",
|
||||
"dyeGray",
|
||||
"dyePink",
|
||||
"dyeLime",
|
||||
"dyeYellow",
|
||||
"dyeLightBlue",
|
||||
"dyeMagenta",
|
||||
"dyeOrange",
|
||||
"dyeWhite"
|
||||
};
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
ItemStack dye = new ItemStack(Item.dyePowder, 1, i);
|
||||
if (!hasInit)
|
||||
{
|
||||
registerOre(dyes[i], dye);
|
||||
}
|
||||
replacements.put(dye, dyes[i]);
|
||||
}
|
||||
hasInit = true;
|
||||
|
||||
ItemStack[] replaceStacks = replacements.keySet().toArray(new ItemStack[replacements.keySet().size()]);
|
||||
|
||||
// Ignore recipes for the following items
|
||||
ItemStack[] exclusions = new ItemStack[]
|
||||
{
|
||||
new ItemStack(Block.blockLapis),
|
||||
new ItemStack(Item.cookie),
|
||||
new ItemStack(Block.stoneBrick),
|
||||
new ItemStack(Block.stoneSingleSlab),
|
||||
new ItemStack(Block.stairsCobblestone),
|
||||
new ItemStack(Block.cobblestoneWall)
|
||||
};
|
||||
|
||||
List recipes = CraftingManager.getInstance().getRecipeList();
|
||||
List<IRecipe> recipesToRemove = new ArrayList<IRecipe>();
|
||||
List<IRecipe> recipesToAdd = new ArrayList<IRecipe>();
|
||||
|
||||
// Search vanilla recipes for recipes to replace
|
||||
for(Object obj : recipes)
|
||||
{
|
||||
if(obj instanceof ShapedRecipes)
|
||||
{
|
||||
ShapedRecipes recipe = (ShapedRecipes)obj;
|
||||
ItemStack output = recipe.getRecipeOutput();
|
||||
if (output != null && containsMatch(false, exclusions, output))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(containsMatch(true, recipe.recipeItems, replaceStacks))
|
||||
{
|
||||
recipesToRemove.add(recipe);
|
||||
recipesToAdd.add(new ShapedOreRecipe(recipe, replacements));
|
||||
}
|
||||
}
|
||||
else if(obj instanceof ShapelessRecipes)
|
||||
{
|
||||
ShapelessRecipes recipe = (ShapelessRecipes)obj;
|
||||
ItemStack output = recipe.getRecipeOutput();
|
||||
if (output != null && containsMatch(false, exclusions, output))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(containsMatch(true, (ItemStack[])recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks))
|
||||
{
|
||||
recipesToRemove.add((IRecipe)obj);
|
||||
IRecipe newRecipe = new ShapelessOreRecipe(recipe, replacements);
|
||||
recipesToAdd.add(newRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recipes.removeAll(recipesToRemove);
|
||||
recipes.addAll(recipesToAdd);
|
||||
if (recipesToRemove.size() > 0)
|
||||
{
|
||||
System.out.println("Replaced " + recipesToRemove.size() + " ore recipies");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the integer ID for the specified ore name.
|
||||
* If the name does not have a ID it assigns it a new one.
|
||||
*
|
||||
* @param name The unique name for this ore 'oreIron', 'ingotIron', etc..
|
||||
* @return A number representing the ID for this ore type
|
||||
*/
|
||||
public static int getOreID(String name)
|
||||
{
|
||||
Integer val = oreIDs.get(name);
|
||||
if (val == null)
|
||||
{
|
||||
val = maxID++;
|
||||
oreIDs.put(name, val);
|
||||
oreStacks.put(val, new ArrayList<ItemStack>());
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse of getOreID, will not create new entries.
|
||||
*
|
||||
* @param id The ID to translate to a string
|
||||
* @return The String name, or "Unknown" if not found.
|
||||
*/
|
||||
public static String getOreName(int id)
|
||||
{
|
||||
for (Map.Entry<String, Integer> entry : oreIDs.entrySet())
|
||||
{
|
||||
if (id == entry.getValue())
|
||||
{
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the integer ID for the specified item stack.
|
||||
* If the item stack is not linked to any ore, this will return -1 and no new entry will be created.
|
||||
*
|
||||
* @param itemStack The item stack of the ore.
|
||||
* @return A number representing the ID for this ore type, or -1 if couldn't find it.
|
||||
*/
|
||||
public static int getOreID(ItemStack itemStack)
|
||||
{
|
||||
if (itemStack == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(Entry<Integer, ArrayList<ItemStack>> ore : oreStacks.entrySet())
|
||||
{
|
||||
for(ItemStack target : ore.getValue())
|
||||
{
|
||||
if(itemStack.itemID == target.itemID && (target.getItemDamage() == WILDCARD_VALUE || itemStack.getItemDamage() == target.getItemDamage()))
|
||||
{
|
||||
return ore.getKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1; // didn't find it.
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the ArrayList of items that are registered to this ore type.
|
||||
* Creates the list as empty if it did not exist.
|
||||
*
|
||||
* @param name The ore name, directly calls getOreID
|
||||
* @return An arrayList containing ItemStacks registered for this ore
|
||||
*/
|
||||
public static ArrayList<ItemStack> getOres(String name)
|
||||
{
|
||||
return getOres(getOreID(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of all unique ore names that are already registered.
|
||||
*
|
||||
* @return All unique ore names that are currently registered.
|
||||
*/
|
||||
public static String[] getOreNames()
|
||||
{
|
||||
return oreIDs.keySet().toArray(new String[oreIDs.keySet().size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the ArrayList of items that are registered to this ore type.
|
||||
* Creates the list as empty if it did not exist.
|
||||
*
|
||||
* @param id The ore ID, see getOreID
|
||||
* @return An arrayList containing ItemStacks registered for this ore
|
||||
*/
|
||||
public static ArrayList<ItemStack> getOres(Integer id)
|
||||
{
|
||||
ArrayList<ItemStack> val = oreStacks.get(id);
|
||||
if (val == null)
|
||||
{
|
||||
val = new ArrayList<ItemStack>();
|
||||
oreStacks.put(id, val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
private static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
|
||||
{
|
||||
for (ItemStack input : inputs)
|
||||
{
|
||||
for (ItemStack target : targets)
|
||||
{
|
||||
if (itemMatches(target, input, strict))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
|
||||
{
|
||||
if (input == null && target != null || input != null && target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (target.itemID == input.itemID && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
|
||||
}
|
||||
|
||||
//Convenience functions that make for cleaner code mod side. They all drill down to registerOre(String, int, ItemStack)
|
||||
public static void registerOre(String name, Item ore){ registerOre(name, new ItemStack(ore)); }
|
||||
public static void registerOre(String name, Block ore){ registerOre(name, new ItemStack(ore)); }
|
||||
public static void registerOre(String name, ItemStack ore){ registerOre(name, getOreID(name), ore); }
|
||||
public static void registerOre(int id, Item ore){ registerOre(id, new ItemStack(ore)); }
|
||||
public static void registerOre(int id, Block ore){ registerOre(id, new ItemStack(ore)); }
|
||||
public static void registerOre(int id, ItemStack ore){ registerOre(getOreName(id), id, ore); }
|
||||
|
||||
/**
|
||||
* Registers a ore item into the dictionary.
|
||||
* Raises the registerOre function in all registered handlers.
|
||||
*
|
||||
* @param name The name of the ore
|
||||
* @param id The ID of the ore
|
||||
* @param ore The ore's ItemStack
|
||||
*/
|
||||
private static void registerOre(String name, int id, ItemStack ore)
|
||||
{
|
||||
ArrayList<ItemStack> ores = getOres(id);
|
||||
ore = ore.copy();
|
||||
ores.add(ore);
|
||||
MinecraftForge.EVENT_BUS.post(new OreRegisterEvent(name, ore));
|
||||
}
|
||||
|
||||
public static class OreRegisterEvent extends Event
|
||||
{
|
||||
public final String Name;
|
||||
public final ItemStack Ore;
|
||||
|
||||
public OreRegisterEvent(String name, ItemStack ore)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Ore = ore;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
package net.minecraftforge.transformers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import net.minecraftforge.event.Event;
|
||||
import net.minecraftforge.event.ListenerList;
|
||||
|
||||
import org.objectweb.asm.*;
|
||||
import org.objectweb.asm.tree.*;
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
import static org.objectweb.asm.Type.*;
|
||||
import static org.objectweb.asm.ClassWriter.*;
|
||||
|
||||
public class EventTransformer implements IClassTransformer
|
||||
{
|
||||
public EventTransformer()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] bytes)
|
||||
{
|
||||
if (bytes == null || name.equals("net.minecraftforge.event.Event") || name.startsWith("net.minecraft.") || name.indexOf('.') == -1)
|
||||
{
|
||||
return bytes;
|
||||
}
|
||||
ClassReader cr = new ClassReader(bytes);
|
||||
ClassNode classNode = new ClassNode();
|
||||
cr.accept(classNode, 0);
|
||||
|
||||
try
|
||||
{
|
||||
if (buildEvents(classNode))
|
||||
{
|
||||
ClassWriter cw = new ClassWriter(COMPUTE_MAXS | COMPUTE_FRAMES);
|
||||
classNode.accept(cw);
|
||||
return cw.toByteArray();
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
// Discard silently- it's just noise
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean buildEvents(ClassNode classNode) throws Exception
|
||||
{
|
||||
Class<?> parent = this.getClass().getClassLoader().loadClass(classNode.superName.replace('/', '.'));
|
||||
if (!Event.class.isAssignableFrom(parent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasSetup = false;
|
||||
boolean hasGetListenerList = false;
|
||||
boolean hasDefaultCtr = false;
|
||||
|
||||
Class<?> listenerListClazz = Class.forName("net.minecraftforge.event.ListenerList", false, getClass().getClassLoader());
|
||||
Type tList = Type.getType(listenerListClazz);
|
||||
|
||||
for (MethodNode method : (List<MethodNode>)classNode.methods)
|
||||
{
|
||||
if (method.name.equals("setup") &&
|
||||
method.desc.equals(Type.getMethodDescriptor(VOID_TYPE)) &&
|
||||
(method.access & ACC_PROTECTED) == ACC_PROTECTED)
|
||||
{
|
||||
hasSetup = true;
|
||||
}
|
||||
if (method.name.equals("getListenerList") &&
|
||||
method.desc.equals(Type.getMethodDescriptor(tList)) &&
|
||||
(method.access & ACC_PUBLIC) == ACC_PUBLIC)
|
||||
{
|
||||
hasGetListenerList = true;
|
||||
}
|
||||
if (method.name.equals("<init>") &&
|
||||
method.desc.equals(Type.getMethodDescriptor(VOID_TYPE)))
|
||||
{
|
||||
hasDefaultCtr = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSetup)
|
||||
{
|
||||
if (!hasGetListenerList)
|
||||
{
|
||||
throw new RuntimeException("Event class defines setup() but does not define getListenerList! " + classNode.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Type tSuper = Type.getType(classNode.superName);
|
||||
|
||||
//Add private static ListenerList LISTENER_LIST
|
||||
classNode.fields.add(new FieldNode(ACC_PRIVATE | ACC_STATIC, "LISTENER_LIST", tList.getDescriptor(), null, null));
|
||||
|
||||
/*Add:
|
||||
* public <init>()
|
||||
* {
|
||||
* super();
|
||||
* }
|
||||
*/
|
||||
MethodNode method = new MethodNode(ASM4, ACC_PUBLIC, "<init>", getMethodDescriptor(VOID_TYPE), null, null);
|
||||
method.instructions.add(new VarInsnNode(ALOAD, 0));
|
||||
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "<init>", getMethodDescriptor(VOID_TYPE)));
|
||||
method.instructions.add(new InsnNode(RETURN));
|
||||
if (!hasDefaultCtr)
|
||||
{
|
||||
classNode.methods.add(method);
|
||||
}
|
||||
|
||||
/*Add:
|
||||
* protected void setup()
|
||||
* {
|
||||
* super.setup();
|
||||
* if (LISTENER_LIST != NULL)
|
||||
* {
|
||||
* return;
|
||||
* }
|
||||
* LISTENER_LIST = new ListenerList(super.getListenerList());
|
||||
* }
|
||||
*/
|
||||
method = new MethodNode(ASM4, ACC_PROTECTED, "setup", getMethodDescriptor(VOID_TYPE), null, null);
|
||||
method.instructions.add(new VarInsnNode(ALOAD, 0));
|
||||
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "setup", getMethodDescriptor(VOID_TYPE)));
|
||||
method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor()));
|
||||
LabelNode initLisitener = new LabelNode();
|
||||
method.instructions.add(new JumpInsnNode(IFNULL, initLisitener));
|
||||
method.instructions.add(new InsnNode(RETURN));
|
||||
method.instructions.add(initLisitener);
|
||||
method.instructions.add(new FrameNode(F_SAME, 0, null, 0, null));
|
||||
method.instructions.add(new TypeInsnNode(NEW, tList.getInternalName()));
|
||||
method.instructions.add(new InsnNode(DUP));
|
||||
method.instructions.add(new VarInsnNode(ALOAD, 0));
|
||||
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "getListenerList", getMethodDescriptor(tList)));
|
||||
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tList.getInternalName(), "<init>", getMethodDescriptor(VOID_TYPE, tList)));
|
||||
method.instructions.add(new FieldInsnNode(PUTSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor()));
|
||||
method.instructions.add(new InsnNode(RETURN));
|
||||
classNode.methods.add(method);
|
||||
|
||||
/*Add:
|
||||
* public ListenerList getListenerList()
|
||||
* {
|
||||
* return this.LISTENER_LIST;
|
||||
* }
|
||||
*/
|
||||
method = new MethodNode(ASM4, ACC_PUBLIC, "getListenerList", getMethodDescriptor(tList), null, null);
|
||||
method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor()));
|
||||
method.instructions.add(new InsnNode(ARETURN));
|
||||
classNode.methods.add(method);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
+1
-1
Submodule fml updated: 23baf3a8ce...7eb36a1481.
@@ -1,139 +0,0 @@
|
||||
import os, os.path, sys
|
||||
import urllib, zipfile
|
||||
import shutil, glob, fnmatch
|
||||
import subprocess, logging, re
|
||||
import csv, shutil
|
||||
import pprint
|
||||
|
||||
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
def reset_logger():
|
||||
log = logging.getLogger()
|
||||
while len(log.handlers) > 0:
|
||||
log.removeHandler(log.handlers[0])
|
||||
|
||||
version_reg = re.compile(r'(([a-z]+)Version[\s]+=[\s]+)(\d+);')
|
||||
def load_version(build=0):
|
||||
info = {'major' : -1,
|
||||
'minor' : -1,
|
||||
'revision' : -1,
|
||||
'build' : -1
|
||||
}
|
||||
hook_file = os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep))
|
||||
with open(hook_file, 'r') as fh:
|
||||
buf = fh.read()
|
||||
|
||||
def proc(match):
|
||||
try:
|
||||
info[match.group(2)] = int(match.group(3))
|
||||
except:
|
||||
pass
|
||||
return match.group(0)
|
||||
|
||||
buf = version_reg.sub(proc, buf)
|
||||
info['build'] = build
|
||||
return info
|
||||
|
||||
def inject_version(src_file, build=0):
|
||||
version = load_version(build)
|
||||
|
||||
tmp_file = src_file + '.tmp'
|
||||
with open(src_file, 'r') as fh:
|
||||
buf = fh.read()
|
||||
|
||||
def mapname(match):
|
||||
try:
|
||||
return '%s%s;' % (match.group(1), version[match.group(2)])
|
||||
except KeyError:
|
||||
pass
|
||||
return match.group(0)
|
||||
|
||||
buf = version_reg.sub(mapname, buf).replace('\r\n', '\n')
|
||||
|
||||
with open(tmp_file, 'wb') as fh:
|
||||
fh.write(buf)
|
||||
shutil.move(tmp_file, src_file)
|
||||
|
||||
def zip_folder(path, key, zip):
|
||||
import pprint
|
||||
files = os.listdir(path)
|
||||
for file in files:
|
||||
file_path = os.path.join(path, file)
|
||||
file_key = os.path.join(key, file)
|
||||
if os.path.isdir(file_path):
|
||||
zip_folder(file_path, file_key, zip)
|
||||
else:
|
||||
if not file_key.replace(os.sep, '/') in zip.NameToInfo:
|
||||
print ' ' + file_key
|
||||
zip.write(file_path, file_key)
|
||||
|
||||
def zip_create(path, key, zip_name):
|
||||
zip = zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED)
|
||||
if os.path.isdir(path):
|
||||
zip_folder(path, key, zip)
|
||||
else:
|
||||
zip.write(path, key)
|
||||
zip.close()
|
||||
|
||||
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
|
||||
sys.path.append(fml_dir)
|
||||
sys.path.append(os.path.join(fml_dir, 'install'))
|
||||
from fml import copytree, apply_patches
|
||||
|
||||
#patch files
|
||||
print 'Applying Minecraft Forge patches'
|
||||
sys.stdout.flush()
|
||||
|
||||
if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')):
|
||||
apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
|
||||
|
||||
if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')):
|
||||
copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'))
|
||||
if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')):
|
||||
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'))
|
||||
|
||||
def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0):
|
||||
version = load_version(build_num)
|
||||
print '=================================== Build %d.%d.%d.%d Start =================================' % (version['major'], version['minor'], version['revision'], version['build'])
|
||||
|
||||
src_dir = os.path.join(mcp_dir, 'src')
|
||||
if os.path.isdir(src_dir):
|
||||
shutil.rmtree(src_dir)
|
||||
|
||||
sys.path.append(fml_dir)
|
||||
sys.path.append(os.path.join(fml_dir, 'install'))
|
||||
from fml import copytree
|
||||
|
||||
print 'src_work -> src'
|
||||
copytree(os.path.join(mcp_dir, 'src_work'), src_dir)
|
||||
print '\nCopying Client Code'
|
||||
copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'), -1)
|
||||
print '\nCopying Common Code'
|
||||
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'), -1)
|
||||
print
|
||||
inject_version(os.path.join(src_dir, 'minecraft/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num)
|
||||
|
||||
error_level = 0
|
||||
try:
|
||||
sys.path.append(mcp_dir)
|
||||
from runtime.commands import Commands, CLIENT, SERVER, CalledProcessError
|
||||
from runtime.mcp import recompile_side
|
||||
|
||||
os.chdir(mcp_dir)
|
||||
reset_logger()
|
||||
|
||||
commands = Commands(None, verify=True)
|
||||
try:
|
||||
recompile_side(commands, CLIENT)
|
||||
except CalledProcessError as e:
|
||||
error_level = 1
|
||||
pass
|
||||
reset_logger()
|
||||
os.chdir(forge_dir)
|
||||
except SystemExit, e:
|
||||
if not e.code == 0:
|
||||
print 'Recompile Exception: %d ' % e.code
|
||||
error_level = e.code
|
||||
|
||||
print '=================================== Build Finished %d =================================' % error_level
|
||||
return error_level
|
||||
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# 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
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# 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\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/fml/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" ] ; 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"`
|
||||
|
||||
# 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
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
@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
|
||||
|
||||
@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=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@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 Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_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=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\fml\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
|
||||
@@ -1,30 +0,0 @@
|
||||
*** HOW TO INSTALL ***
|
||||
For Mod Users:
|
||||
|
||||
Copy all files from this zip to your minecraft.jar, thats it.
|
||||
Thats it, you're done, during first run FML will download all needed libraries for you.
|
||||
|
||||
For Mod Devs:
|
||||
|
||||
The install scripts should take care of everything for you, you do NOT need to
|
||||
have MCP installed before running install.cmd/sh as Forge will download it for you.
|
||||
|
||||
Just start the install.cmd/.sh, MCForge will install itself into the proper
|
||||
locations and copy all needed files, as well as modifying the needed baseclasses.
|
||||
|
||||
Forge also includes a snapshot of the MCP mapings, this may not be the current
|
||||
version of the mapings. But you must use the provided mapings in order for the
|
||||
patch files to work together.
|
||||
|
||||
|
||||
Requirements:
|
||||
You must ahve a JDK installed and accessible, there is a big in java 1.6_21 that
|
||||
causes compile errors, just update your jdk to fix them.
|
||||
|
||||
For Mac users:
|
||||
It should automatically set the execution bits on mcp/runtime/bin/astyle-osx,
|
||||
if it does not, please do so manually: chmod +x mcp/runtime/bin/astyle-osx
|
||||
|
||||
For Linux users:
|
||||
Astyle is required for the patches to apply properly, so either install wine, or astyle
|
||||
Instalation instructions are distro specific, so I can not give them here.
|
||||
@@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
.\fml\python\python_fml install.py %*
|
||||
pause
|
||||
@@ -1,78 +0,0 @@
|
||||
import os, os.path, sys
|
||||
import urllib, zipfile
|
||||
import shutil, glob, fnmatch
|
||||
import subprocess, logging
|
||||
from optparse import OptionParser
|
||||
|
||||
def fml_main(fml_dir, mcp_dir, gen_conf=True, disable_patches=False, disable_at=False, disable_merge=False, enable_server=False,
|
||||
disable_client=False, disable_rename=False, disable_assets=False, decompile=False):
|
||||
sys.path.append(fml_dir)
|
||||
from fml import download_mcp, setup_mcp, decompile_minecraft, apply_fml_patches, finish_setup_fml
|
||||
print '================ Forge ModLoader Setup Start ==================='
|
||||
download_mcp(fml_dir, mcp_dir)
|
||||
setup_mcp(fml_dir, mcp_dir, gen_conf)
|
||||
if decompile:
|
||||
decompile_minecraft(fml_dir, mcp_dir, disable_at=disable_at, disable_merge=disable_merge,
|
||||
enable_server=enable_server, disable_client=disable_client,
|
||||
disable_assets=disable_assets)
|
||||
if disable_patches:
|
||||
print 'Patching disabled'
|
||||
else:
|
||||
apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src'))
|
||||
finish_setup_fml(fml_dir, mcp_dir, enable_server=enable_server, disable_client=disable_client, disable_rename=disable_rename)
|
||||
else:
|
||||
print 'Decompile free install is on the to-do!'
|
||||
print '================ Forge ModLoader Setup End ==================='
|
||||
|
||||
def forge_main(forge_dir, fml_dir, mcp_dir):
|
||||
sys.path.append(mcp_dir)
|
||||
sys.path.append(fml_dir)
|
||||
from runtime.updatenames import updatenames
|
||||
from runtime.updatemd5 import updatemd5
|
||||
from forge import apply_forge_patches
|
||||
from fml import reset_logger
|
||||
|
||||
print '=============================== Minecraft Forge Setup Start ====================================='
|
||||
print 'Applying forge patches'
|
||||
apply_forge_patches(fml_dir, mcp_dir, forge_dir, os.path.join(mcp_dir, 'src'), True)
|
||||
os.chdir(mcp_dir)
|
||||
updatenames(None, True, True, False)
|
||||
reset_logger()
|
||||
updatemd5(None, True, True, False)
|
||||
reset_logger()
|
||||
os.chdir(forge_dir)
|
||||
print '=============================== Minecraft Forge Setup Finished ================================='
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser()
|
||||
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None )
|
||||
parser.add_option('-p', '--no-patch', action="store_true", dest='no_patch', help='Disable application of FML patches', default=False)
|
||||
parser.add_option('-a', '--no-access', action="store_true", dest='no_access', help='Disable access transformers', default=False)
|
||||
parser.add_option('-s', '--server', action="store_true", dest='enable_server', help='Enable decompilation of server', default=False)
|
||||
parser.add_option('-c', '--no-client', action="store_true", dest='no_client', help='Disable decompilation of server', default=False)
|
||||
parser.add_option('-e', '--no-merge', action="store_true", dest='no_merge', help='Disable merging server code into client', default=False)
|
||||
parser.add_option('-n', '--no-rename', action="store_true", dest='no_rename', help='Disable running updatenames', default=False)
|
||||
parser.add_option( '--no-assets', action="store_true", dest='no_assets', help='Disable downloading of assets folder', default=False)
|
||||
parser.add_option('-d', '--decompile', action="store_true", dest='decompile', help='Decompile minecraft and apply patches', default=True)
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
fml_dir = os.path.abspath('fml')
|
||||
mcp_dir = os.path.abspath('mcp')
|
||||
|
||||
if not options.mcp_dir is None:
|
||||
mcp_dir = os.path.abspath(options.mcp_dir)
|
||||
|
||||
if options.no_client:
|
||||
options.no_patch = True
|
||||
|
||||
if options.no_merge:
|
||||
options.no_patch = True
|
||||
|
||||
fml_main(fml_dir, mcp_dir, disable_patches=options.no_patch,
|
||||
disable_at=options.no_access, disable_merge=options.no_merge,
|
||||
enable_server=options.enable_server, disable_client=options.no_client,
|
||||
disable_rename=options.no_rename, disable_assets=options.no_assets,
|
||||
decompile=options.decompile, gen_conf=False)
|
||||
|
||||
forge_main(forge_dir, fml_dir, mcp_dir)
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
python install.py "$@"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,70 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockBaseRailLogic.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockBaseRailLogic.java
|
||||
@@ -16,6 +16,8 @@
|
||||
/** The chunk position the rail is at. */
|
||||
private List railChunkPosition;
|
||||
|
||||
+ private final boolean canMakeSlopes;
|
||||
+
|
||||
final BlockRailBase theRail;
|
||||
|
||||
public BlockBaseRailLogic(BlockRailBase par1BlockRailBase, World par2World, int par3, int par4, int par5)
|
||||
@@ -27,17 +29,11 @@
|
||||
this.railY = par4;
|
||||
this.railZ = par5;
|
||||
int l = par2World.getBlockId(par3, par4, par5);
|
||||
- int i1 = par2World.getBlockMetadata(par3, par4, par5);
|
||||
-
|
||||
- if (((BlockRailBase)Block.blocksList[l]).isPowered)
|
||||
- {
|
||||
- this.isStraightRail = true;
|
||||
- i1 &= -9;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- this.isStraightRail = false;
|
||||
- }
|
||||
+
|
||||
+ BlockRailBase target = (BlockRailBase)Block.blocksList[l];
|
||||
+ int i1 = target.getBasicRailMetadata(par2World, null, par3, par4, par5);
|
||||
+ isStraightRail = !target.isFlexibleRail(par2World, par3, par4, par5);
|
||||
+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5);
|
||||
|
||||
this.setBasicRail(i1);
|
||||
}
|
||||
@@ -232,7 +228,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (b0 == 0)
|
||||
+ if (b0 == 0 && canMakeSlopes)
|
||||
{
|
||||
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1))
|
||||
{
|
||||
@@ -245,7 +241,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (b0 == 1)
|
||||
+ if (b0 == 1 && canMakeSlopes)
|
||||
{
|
||||
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ))
|
||||
{
|
||||
@@ -390,7 +386,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (b0 == 0)
|
||||
+ if (b0 == 0 && canMakeSlopes)
|
||||
{
|
||||
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1))
|
||||
{
|
||||
@@ -403,7 +399,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (b0 == 1)
|
||||
+ if (b0 == 1 && canMakeSlopes)
|
||||
{
|
||||
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ))
|
||||
{
|
||||
@@ -0,0 +1,73 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
|
||||
@@ -6,8 +6,13 @@
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraft.world.IBlockAccess;
|
||||
+import net.minecraftforge.common.EnumPlantType;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import net.minecraftforge.common.IPlantable;
|
||||
+import static net.minecraftforge.common.EnumPlantType.*;
|
||||
|
||||
-public class BlockBush extends Block
|
||||
+public class BlockBush extends Block implements IPlantable
|
||||
{
|
||||
private static final String __OBFID = "CL_00000208";
|
||||
|
||||
@@ -27,7 +32,7 @@
|
||||
|
||||
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
{
|
||||
- return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149854_a(p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_));
|
||||
+ return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149718_j(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);
|
||||
}
|
||||
|
||||
protected boolean func_149854_a(Block p_149854_1_)
|
||||
@@ -57,7 +62,7 @@
|
||||
|
||||
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
|
||||
{
|
||||
- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_));
|
||||
+ return p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
|
||||
}
|
||||
|
||||
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
@@ -79,4 +84,37 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ if (this == Blocks.field_150464_aj) return Crop;
|
||||
+ if (this == Blocks.field_150459_bM) return Crop;
|
||||
+ if (this == Blocks.field_150469_bN) return Crop;
|
||||
+ if (this == Blocks.field_150394_bc) return Crop;
|
||||
+ if (this == Blocks.field_150393_bb) return Crop;
|
||||
+ if (this == Blocks.field_150330_I) return Desert;
|
||||
+ if (this == Blocks.field_150392_bi) return Water;
|
||||
+ if (this == Blocks.field_150337_Q) return Cave;
|
||||
+ if (this == Blocks.field_150338_P) return Cave;
|
||||
+ if (this == Blocks.field_150388_bm) return Nether;
|
||||
+ if (this == Blocks.field_150345_g) return Plains;
|
||||
+ if (this == Blocks.field_150329_H) return Plains;
|
||||
+ if (this == Blocks.field_150398_cm) return Plains;
|
||||
+ if (this == Blocks.field_150328_O) return Plains;
|
||||
+ if (this == Blocks.field_150327_N) return Plains;
|
||||
+ return Plains;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return world.func_72805_g(x, y, z);
|
||||
+ }
|
||||
}
|
||||
@@ -1,104 +1,100 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockButton.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockButton.java
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
|
||||
@@ -14,6 +14,9 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import static net.minecraftforge.common.ForgeDirection.*;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
+
|
||||
public abstract class BlockButton extends Block
|
||||
{
|
||||
/** Whether this button is sensible to arrows, used by wooden buttons. */
|
||||
@@ -66,7 +69,11 @@
|
||||
*/
|
||||
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
|
||||
private final boolean field_150047_a;
|
||||
@@ -49,12 +52,19 @@
|
||||
|
||||
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
|
||||
{
|
||||
- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)));
|
||||
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
|
||||
+ return (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
|
||||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
|
||||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) ||
|
||||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST));
|
||||
- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()));
|
||||
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
|
||||
+ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
|
||||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
|
||||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST)) ||
|
||||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +81,10 @@
|
||||
*/
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
{
|
||||
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
|
||||
+ return (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) ||
|
||||
+ (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) ||
|
||||
+ (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
|
||||
+ (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH));
|
||||
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
|
||||
+ return (p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST)) ||
|
||||
+ (p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST)) ||
|
||||
+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH)) ||
|
||||
+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,19 +96,22 @@
|
||||
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
@@ -63,19 +73,21 @@
|
||||
int k1 = j1 & 8;
|
||||
j1 &= 7;
|
||||
|
||||
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
|
||||
- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
|
||||
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149660_5_);
|
||||
+
|
||||
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
|
||||
+
|
||||
+ if (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
|
||||
+ if (dir == NORTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
|
||||
{
|
||||
j1 = 4;
|
||||
}
|
||||
- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
|
||||
+ else if (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
|
||||
- else if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
|
||||
+ else if (dir == SOUTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
|
||||
{
|
||||
j1 = 3;
|
||||
}
|
||||
- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
|
||||
+ else if (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
|
||||
- else if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
|
||||
+ else if (dir == WEST && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
|
||||
{
|
||||
j1 = 2;
|
||||
}
|
||||
- else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
|
||||
+ else if (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
|
||||
- else if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
|
||||
+ else if (dir == EAST && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
|
||||
{
|
||||
j1 = 1;
|
||||
}
|
||||
@@ -115,7 +128,11 @@
|
||||
*/
|
||||
private int getOrientation(World par1World, int par2, int par3, int par4)
|
||||
@@ -89,7 +101,11 @@
|
||||
|
||||
private int func_150045_e(World p_150045_1_, int p_150045_2_, int p_150045_3_, int p_150045_4_)
|
||||
{
|
||||
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? 1 : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? 2 : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? 3 : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 4 : 1)));
|
||||
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) return 1;
|
||||
+ if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) return 2;
|
||||
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) return 3;
|
||||
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) return 4;
|
||||
- return p_150045_1_.func_147439_a(p_150045_2_ - 1, p_150045_3_, p_150045_4_).func_149721_r() ? 1 : (p_150045_1_.func_147439_a(p_150045_2_ + 1, p_150045_3_, p_150045_4_).func_149721_r() ? 2 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ - 1).func_149721_r() ? 3 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ + 1).func_149721_r() ? 4 : 1)));
|
||||
+ if (p_150045_1_.isSideSolid(p_150045_2_ - 1, p_150045_3_, p_150045_4_, EAST)) return 1;
|
||||
+ if (p_150045_1_.isSideSolid(p_150045_2_ + 1, p_150045_3_, p_150045_4_, WEST)) return 2;
|
||||
+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ - 1, SOUTH)) return 3;
|
||||
+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ + 1, NORTH)) return 4;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,22 +146,22 @@
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
|
||||
public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
|
||||
@@ -99,22 +115,22 @@
|
||||
int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1)
|
||||
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1)
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2)
|
||||
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2)
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3)
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3)
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4)
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4)
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -1,46 +1,48 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockCactus.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockCactus.java
|
||||
@@ -12,7 +12,11 @@
|
||||
import net.minecraft.util.Icon;
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
|
||||
@@ -11,9 +11,13 @@
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
+import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.EnumPlantType;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import net.minecraftforge.common.IPlantable;
|
||||
|
||||
-public class BlockCactus extends Block
|
||||
+import net.minecraftforge.common.EnumPlantType;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.IPlantable;
|
||||
+
|
||||
+public class BlockCactus extends Block implements IPlantable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon cactusTopIcon;
|
||||
@@ -158,7 +162,7 @@
|
||||
private IIcon field_150041_a;
|
||||
@@ -125,7 +129,7 @@
|
||||
else
|
||||
{
|
||||
int l = par1World.getBlockId(par2, par3 - 1, par4);
|
||||
- return l == Block.cactus.blockID || l == Block.sand.blockID;
|
||||
+ return blocksList[l] != null && blocksList[l].canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this);
|
||||
Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
|
||||
- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m;
|
||||
+ return block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,4 +186,22 @@
|
||||
this.cactusTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top");
|
||||
this.cactusBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_bottom");
|
||||
@@ -141,4 +145,22 @@
|
||||
this.field_150041_a = p_149651_1_.func_94245_a(this.func_149641_N() + "_top");
|
||||
this.field_150040_b = p_149651_1_.func_94245_a(this.func_149641_N() + "_bottom");
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
|
||||
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return EnumPlantType.Desert;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getPlantID(World world, int x, int y, int z)
|
||||
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return blockID;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getPlantMetadata(World world, int x, int y, int z)
|
||||
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
@@ -1,53 +1,44 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockChest.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockChest.java
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
|
||||
@@ -23,6 +23,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import static net.minecraftforge.common.ForgeDirection.*;
|
||||
+import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
+
|
||||
public class BlockChest extends BlockContainer
|
||||
{
|
||||
private final Random random = new Random();
|
||||
@@ -446,7 +448,7 @@
|
||||
private final Random field_149955_b = new Random();
|
||||
@@ -407,7 +409,7 @@
|
||||
{
|
||||
return null;
|
||||
}
|
||||
- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4))
|
||||
+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
|
||||
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_).func_149721_r())
|
||||
+ else if (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_, DOWN))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -454,19 +456,19 @@
|
||||
@@ -415,19 +417,19 @@
|
||||
{
|
||||
return null;
|
||||
}
|
||||
- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
|
||||
- {
|
||||
- return null;
|
||||
- }
|
||||
- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
|
||||
- {
|
||||
- return null;
|
||||
- }
|
||||
- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
|
||||
- {
|
||||
- return null;
|
||||
- }
|
||||
- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
|
||||
+ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
|
||||
- else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_)))
|
||||
+ else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
- else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_)))
|
||||
+ else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1)))
|
||||
+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1)))
|
||||
+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1,50 +1,46 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
@@ -2,6 +2,8 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
@@ -201,7 +203,14 @@
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -160,6 +161,13 @@
|
||||
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
- int j1 = func_72219_c(par5);
|
||||
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
|
||||
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int p_149690_5_, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> dropped = super.getBlockDropped(world, x, y, z, metadata, fortune);
|
||||
+ int j1 = func_72219_c(metadata);
|
||||
+ ArrayList<ItemStack> dropped = super.getDrops(world, x, y, z, p_149690_5_, fortune);
|
||||
int j1 = func_149987_c(p_149690_5_);
|
||||
byte b0 = 1;
|
||||
|
||||
if (j1 >= 2)
|
||||
@@ -211,8 +220,9 @@
|
||||
@@ -170,8 +178,9 @@
|
||||
|
||||
for (int k1 = 0; k1 < b0; ++k1)
|
||||
{
|
||||
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3));
|
||||
- }
|
||||
+ dropped.add(new ItemStack(Item.dyePowder, 1, 3));
|
||||
+ }
|
||||
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.field_151100_aR, 1, 3));
|
||||
+ dropped.add(new ItemStack(Items.field_151100_aR, 1, 3));
|
||||
}
|
||||
+ return dropped;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -248,4 +258,10 @@
|
||||
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i);
|
||||
}
|
||||
@@ -216,4 +225,10 @@
|
||||
++j1;
|
||||
p_149853_1_.func_72921_c(p_149853_3_, p_149853_4_, p_149853_5_, j1 << 2 | i1, 2);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public int idDropped(int par1, Random par2Random, int par3)
|
||||
+ public Item func_149650_a(int par1, Random par2Random, int par3)
|
||||
+ {
|
||||
+ return 0;
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockComparator.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockComparator.java
|
||||
@@ -268,4 +268,17 @@
|
||||
{
|
||||
return new TileEntityComparator();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ)
|
||||
+ {
|
||||
+ if(y == tileY)
|
||||
+ onNeighborBlockChange(world, x, y, z, world.getBlockId(tileX, tileY, tileZ));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean weakTileChanges()
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
@@ -1,70 +1,79 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockCrops.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockCrops.java
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -10,6 +11,7 @@
|
||||
import net.minecraft.util.Icon;
|
||||
@@ -12,6 +13,7 @@
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockCrops extends BlockFlower
|
||||
public class BlockCrops extends BlockBush implements IGrowable
|
||||
{
|
||||
@@ -103,11 +105,11 @@
|
||||
int j3 = par1World.getBlockId(l2, par3 - 1, i3);
|
||||
@@ -89,11 +91,11 @@
|
||||
{
|
||||
float f1 = 0.0F;
|
||||
|
||||
- if (j3 == Block.tilledField.blockID)
|
||||
+ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this))
|
||||
- if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1) == Blocks.field_150458_ak)
|
||||
+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).canSustainPlant(p_149864_1_, l, p_149864_3_ - 1, i1, ForgeDirection.UP, this))
|
||||
{
|
||||
f1 = 1.0F;
|
||||
|
||||
- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0)
|
||||
+ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3))
|
||||
- if (p_149864_1_.func_72805_g(l, p_149864_3_ - 1, i1) > 0)
|
||||
+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).isFertile(p_149864_1_, l, p_149864_3_ - 1, i1))
|
||||
{
|
||||
f1 = 3.0F;
|
||||
}
|
||||
@@ -175,22 +177,25 @@
|
||||
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
|
||||
@@ -145,22 +147,6 @@
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
|
||||
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0);
|
||||
-
|
||||
- if (!par1World.isRemote)
|
||||
- if (!p_149690_1_.field_72995_K)
|
||||
- {
|
||||
- if (par5 >= 7)
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = super.getBlockDropped(world, x, y, z, metadata, fortune);
|
||||
+
|
||||
+ if (metadata >= 7)
|
||||
+ {
|
||||
+ for (int n = 0; n < 3 + fortune; n++)
|
||||
{
|
||||
- int j1 = 3 + par7;
|
||||
- if (p_149690_5_ >= 7)
|
||||
- {
|
||||
- int j1 = 3 + p_149690_7_;
|
||||
-
|
||||
- for (int k1 = 0; k1 < j1; ++k1)
|
||||
- {
|
||||
- if (par1World.rand.nextInt(15) <= par5)
|
||||
- if (p_149690_1_.field_73012_v.nextInt(15) <= p_149690_5_)
|
||||
- {
|
||||
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(this.getSeedItem(), 1, 0));
|
||||
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(this.func_149866_i(), 1, 0));
|
||||
- }
|
||||
+ if (world.rand.nextInt(15) <= metadata)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(this.getSeedItem(), 1, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ return ret;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
}
|
||||
|
||||
/**
|
||||
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
@@ -204,4 +190,23 @@
|
||||
{
|
||||
this.func_149863_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
+
|
||||
+ if (metadata >= 7)
|
||||
+ {
|
||||
+ for (int i = 0; i < 3 + fortune; ++i)
|
||||
+ {
|
||||
+ if (world.field_73012_v.nextInt(15) <= metadata)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(this.func_149866_i(), 1, 0));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.block;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -8,9 +10,11 @@
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
+import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.IShearable;
|
||||
|
||||
-public class BlockDeadBush extends BlockBush
|
||||
+public class BlockDeadBush extends BlockBush implements IShearable
|
||||
{
|
||||
private static final String __OBFID = "CL_00000224";
|
||||
|
||||
@@ -33,14 +37,15 @@
|
||||
|
||||
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
|
||||
{
|
||||
- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
|
||||
{
|
||||
- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
|
||||
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.field_150330_I, 1, p_149636_6_));
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) { return true; }
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
+ {
|
||||
+ return new ArrayList<ItemStack>(Arrays.asList(new ItemStack(Blocks.field_150330_I, 1, world.func_72805_g(x, y, z))));
|
||||
+ }
|
||||
}
|
||||
@@ -1,11 +1,20 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockDoor.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockDoor.java
|
||||
@@ -290,7 +290,7 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
|
||||
@@ -249,7 +249,7 @@
|
||||
{
|
||||
if (this.blockMaterial == Material.iron)
|
||||
if (this.field_149764_J == Material.field_151573_f)
|
||||
{
|
||||
- return true;
|
||||
+ return false; //Allow items to interact with the door
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -367,7 +367,7 @@
|
||||
|
||||
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
{
|
||||
- return p_149742_3_ >= 255 ? false : World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_);
|
||||
+ return p_149742_3_ >= p_149742_1_.func_72800_K() - 1 ? false : World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_);
|
||||
}
|
||||
|
||||
public int func_149656_h()
|
||||
@@ -0,0 +1,52 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -18,8 +19,9 @@
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.IShearable;
|
||||
|
||||
-public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||
+public class BlockDoublePlant extends BlockBush implements IGrowable, IShearable
|
||||
{
|
||||
public static final String[] field_149892_a = new String[] {"sunflower", "syringa", "grass", "fern", "rose", "paeonia"};
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -81,6 +83,7 @@
|
||||
|
||||
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
|
||||
{
|
||||
+ if (p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_, p_149718_4_) != this) return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); //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.
|
||||
int l = p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_, p_149718_4_);
|
||||
return func_149887_c(l) ? p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == this : p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ + 1, p_149718_4_) == this && super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_);
|
||||
}
|
||||
@@ -262,4 +265,22 @@
|
||||
int l = this.func_149885_e(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_);
|
||||
this.func_149642_a(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, new ItemStack(this, 1, l));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ int metadata = world.func_72805_g(x, y, z);
|
||||
+ int type = func_149890_d(metadata);
|
||||
+ return func_149887_c(metadata) && (type == 3 || type == 4);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ int type = func_149890_d(world.func_72805_g(x, y, z));
|
||||
+ if (type == 3 || type == 2)
|
||||
+ ret.add(new ItemStack(Blocks.field_150329_H, 2, type == 3 ? 2 : 1));
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
|
||||
@@ -84,7 +84,7 @@
|
||||
{
|
||||
Block block = p_149831_0_.func_147439_a(p_149831_1_, p_149831_2_, p_149831_3_);
|
||||
|
||||
- if (block.field_149764_J == Material.field_151579_a)
|
||||
+ if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -94,6 +94,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ //TODO: King, take a look here when doing liquids!
|
||||
Material material = block.field_149764_J;
|
||||
return material == Material.field_151586_h ? true : material == Material.field_151587_i;
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockFarmland.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockFarmland.java
|
||||
@@ -10,6 +10,9 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
|
||||
@@ -12,6 +12,8 @@
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
+
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.IPlantable;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockFarmland extends Block
|
||||
{
|
||||
@@ -115,7 +118,8 @@
|
||||
@@ -94,7 +96,7 @@
|
||||
{
|
||||
int j1 = par1World.getBlockId(l, par3 + 1, i1);
|
||||
Block block = p_149822_1_.func_147439_a(l, p_149822_3_ + 1, i1);
|
||||
|
||||
- if (j1 == Block.crops.blockID || j1 == Block.melonStem.blockID || j1 == Block.pumpkinStem.blockID || j1 == Block.potato.blockID || j1 == Block.carrot.blockID)
|
||||
+ Block plant = blocksList[j1];
|
||||
+ if (plant instanceof IPlantable && canSustainPlant(par1World, par2, par3, par4, ForgeDirection.UP, (IPlantable)plant))
|
||||
- if (block == Blocks.field_150464_aj || block == Blocks.field_150394_bc || block == Blocks.field_150393_bb || block == Blocks.field_150469_bN || block == Blocks.field_150459_bM)
|
||||
+ if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1,216 +1,279 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockFire.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockFire.java
|
||||
@@ -11,6 +11,9 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+import java.util.IdentityHashMap;
|
||||
+import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
+import com.google.common.collect.Maps;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -12,11 +15,15 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProviderEnd;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import static net.minecraftforge.common.ForgeDirection.*;
|
||||
+
|
||||
public class BlockFire extends Block
|
||||
{
|
||||
/** The chance this block will encourage nearby blocks to catch on fire */
|
||||
@@ -36,6 +39,8 @@
|
||||
*/
|
||||
public void initializeBlock()
|
||||
{
|
||||
+ abilityToCatchFire = Block.blockFlammability;
|
||||
+ chanceToEncourageFire = Block.blockFireSpreadSpeed;
|
||||
this.setBurnRate(Block.planks.blockID, 5, 20);
|
||||
this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
|
||||
this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
|
||||
@@ -62,8 +67,7 @@
|
||||
*/
|
||||
private void setBurnRate(int par1, int par2, int par3)
|
||||
{
|
||||
- this.chanceToEncourageFire[par1] = par2;
|
||||
- this.abilityToCatchFire[par1] = par3;
|
||||
+ Block.setBurnProperties(par1, par2, par3);
|
||||
- private int[] field_149849_a = new int[256];
|
||||
- private int[] field_149848_b = new int[256];
|
||||
+ @Deprecated
|
||||
+ private int[] field_149849_a = new int[4096];
|
||||
+ @Deprecated
|
||||
+ private int[] field_149848_b = new int[4096];
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] field_149850_M;
|
||||
private static final String __OBFID = "CL_00000245";
|
||||
@@ -54,10 +61,10 @@
|
||||
Blocks.field_150480_ab.func_149842_a(func_149682_b(Blocks.field_150404_cg), 60, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,12 +127,8 @@
|
||||
+ @Deprecated // Use setFireInfo
|
||||
public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_)
|
||||
{
|
||||
if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
|
||||
- this.field_149849_a[p_149842_1_] = p_149842_2_;
|
||||
- this.field_149848_b[p_149842_1_] = p_149842_3_;
|
||||
+ this.setFireInfo((Block)Block.field_149771_c.func_148754_a(p_149842_1_), p_149842_2_, p_149842_3_);
|
||||
}
|
||||
|
||||
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
|
||||
@@ -94,13 +101,8 @@
|
||||
{
|
||||
if (p_149674_1_.func_82736_K().func_82766_b("doFireTick"))
|
||||
{
|
||||
- boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID;
|
||||
-
|
||||
- if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID)
|
||||
- boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.field_150424_aL;
|
||||
+ boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP);
|
||||
|
||||
- if (p_149674_1_.field_73011_w instanceof WorldProviderEnd && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.field_150357_h)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
+ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
||||
+ boolean flag = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP));
|
||||
|
||||
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
|
||||
-
|
||||
if (!this.func_149742_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
|
||||
{
|
||||
@@ -157,7 +157,7 @@
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
@@ -128,7 +130,7 @@
|
||||
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
}
|
||||
}
|
||||
- else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && l == 15 && par5Random.nextInt(4) == 0)
|
||||
+ else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && l == 15 && par5Random.nextInt(4) == 0)
|
||||
- else if (!flag && !this.func_149844_e(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) && l == 15 && p_149674_5_.nextInt(4) == 0)
|
||||
+ else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
|
||||
{
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
}
|
||||
@@ -171,12 +171,12 @@
|
||||
@@ -142,12 +144,12 @@
|
||||
b0 = -50;
|
||||
}
|
||||
|
||||
- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l);
|
||||
- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l);
|
||||
- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l);
|
||||
- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l);
|
||||
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l);
|
||||
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l);
|
||||
+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, WEST );
|
||||
+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, EAST );
|
||||
+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, UP );
|
||||
+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, DOWN );
|
||||
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, SOUTH);
|
||||
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, NORTH);
|
||||
- this.func_149841_a(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l);
|
||||
- this.func_149841_a(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l);
|
||||
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l);
|
||||
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l);
|
||||
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l);
|
||||
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l);
|
||||
+ this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST );
|
||||
+ this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST );
|
||||
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP );
|
||||
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN );
|
||||
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH);
|
||||
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH);
|
||||
|
||||
for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1)
|
||||
for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1)
|
||||
{
|
||||
@@ -230,9 +230,20 @@
|
||||
@@ -201,10 +203,16 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ @Deprecated
|
||||
private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
|
||||
private void func_149841_a(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_)
|
||||
{
|
||||
- int j1 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)];
|
||||
+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP);
|
||||
- int j1 = this.field_149848_b[Block.func_149682_b(p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_))];
|
||||
+ this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP);
|
||||
+ }
|
||||
+
|
||||
+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face)
|
||||
+ {
|
||||
+ int j1 = 0;
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
|
||||
+ if (block != null)
|
||||
+ {
|
||||
+ j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
|
||||
+ }
|
||||
|
||||
if (par6Random.nextInt(par5) < j1)
|
||||
+ private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face)
|
||||
+ {
|
||||
+ int j1 = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face);
|
||||
+
|
||||
if (p_149841_6_.nextInt(p_149841_5_) < j1)
|
||||
{
|
||||
@@ -266,7 +277,12 @@
|
||||
*/
|
||||
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
|
||||
boolean flag = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.field_150335_W;
|
||||
@@ -234,7 +242,12 @@
|
||||
|
||||
private boolean func_149847_e(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_)
|
||||
{
|
||||
- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1)))));
|
||||
+ return canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST ) ||
|
||||
+ canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST ) ||
|
||||
+ canBlockCatchFire(par1World, par2, par3 - 1, par4, UP ) ||
|
||||
+ canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN ) ||
|
||||
+ canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH) ||
|
||||
+ canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH);
|
||||
- return this.func_149844_e(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1) ? true : this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1)))));
|
||||
+ return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) ||
|
||||
+ this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) ||
|
||||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) ||
|
||||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) ||
|
||||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) ||
|
||||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,12 +298,12 @@
|
||||
private int func_149845_m(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_)
|
||||
@@ -247,12 +260,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0);
|
||||
- l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l);
|
||||
- l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l);
|
||||
- l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l);
|
||||
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l);
|
||||
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l);
|
||||
+ int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, WEST);
|
||||
+ l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, EAST);
|
||||
+ l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, UP);
|
||||
+ l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, DOWN);
|
||||
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, SOUTH);
|
||||
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, NORTH);
|
||||
- int l = this.func_149846_a(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, b0);
|
||||
- l = this.func_149846_a(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l);
|
||||
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l);
|
||||
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l);
|
||||
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l);
|
||||
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l);
|
||||
+ int l = b0;
|
||||
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST );
|
||||
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST );
|
||||
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP );
|
||||
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN );
|
||||
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH);
|
||||
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
@@ -302,21 +318,24 @@
|
||||
|
||||
/**
|
||||
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
|
||||
- */
|
||||
+ * Deprecated for a side-sensitive version
|
||||
+ */
|
||||
+ @Deprecated
|
||||
public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0;
|
||||
+ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, UP);
|
||||
@@ -262,15 +276,16 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the
|
||||
* current number passed in it will return its number instead of the passed in one. Args: world, x, y, z,
|
||||
* curChanceToEncourageFire
|
||||
- */
|
||||
+ * Deprecated for a side-sensitive version
|
||||
+ */
|
||||
+ @Deprecated
|
||||
public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5)
|
||||
public boolean func_149844_e(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_)
|
||||
{
|
||||
- int i1 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)];
|
||||
- return i1 > par5 ? i1 : par5;
|
||||
+ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP);
|
||||
- return this.field_149849_a[Block.func_149682_b(p_149844_1_.func_147439_a(p_149844_2_, p_149844_3_, p_149844_4_))] > 0;
|
||||
+ return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,9 +393,9 @@
|
||||
+ @Deprecated
|
||||
public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_)
|
||||
{
|
||||
- int i1 = this.field_149849_a[Block.func_149682_b(p_149846_1_.func_147439_a(p_149846_2_, p_149846_3_, p_149846_4_))];
|
||||
- return i1 > p_149846_5_ ? i1 : p_149846_5_;
|
||||
+ return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP);
|
||||
}
|
||||
|
||||
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
@@ -314,9 +329,9 @@
|
||||
float f1;
|
||||
float f2;
|
||||
|
||||
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4))
|
||||
- {
|
||||
- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4))
|
||||
+ if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP))
|
||||
+ {
|
||||
+ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST))
|
||||
- if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_))
|
||||
+ if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP))
|
||||
{
|
||||
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_))
|
||||
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST))
|
||||
{
|
||||
for (l = 0; l < 2; ++l)
|
||||
{
|
||||
@@ -387,7 +406,7 @@
|
||||
@@ -327,7 +342,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4))
|
||||
+ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST))
|
||||
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_))
|
||||
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST))
|
||||
{
|
||||
for (l = 0; l < 2; ++l)
|
||||
{
|
||||
@@ -398,7 +417,7 @@
|
||||
@@ -338,7 +353,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1))
|
||||
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH))
|
||||
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1))
|
||||
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH))
|
||||
{
|
||||
for (l = 0; l < 2; ++l)
|
||||
{
|
||||
@@ -409,7 +428,7 @@
|
||||
@@ -349,7 +364,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1))
|
||||
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH))
|
||||
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1))
|
||||
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH))
|
||||
{
|
||||
for (l = 0; l < 2; ++l)
|
||||
{
|
||||
@@ -420,7 +439,7 @@
|
||||
@@ -360,7 +375,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4))
|
||||
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN))
|
||||
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_))
|
||||
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN))
|
||||
{
|
||||
for (l = 0; l < 2; ++l)
|
||||
{
|
||||
@@ -469,4 +488,46 @@
|
||||
@@ -405,4 +420,101 @@
|
||||
{
|
||||
return this.iconArray[0];
|
||||
return MapColor.field_151656_f;
|
||||
}
|
||||
+
|
||||
+
|
||||
+ /*================================= Forge Start ======================================*/
|
||||
+ private static class FireInfo
|
||||
+ {
|
||||
+ private int encouragement = 0;
|
||||
+ private int flammibility = 0;
|
||||
+ }
|
||||
+ private IdentityHashMap<Block, FireInfo> blockInfo = Maps.newIdentityHashMap();
|
||||
+
|
||||
+ public void setFireInfo(Block block, int encouragement, int flammibility)
|
||||
+ {
|
||||
+ if (block == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
|
||||
+ int id = Block.func_149682_b(block);
|
||||
+ this.field_149849_a[id] = encouragement;
|
||||
+ this.field_149848_b[id] = flammibility;
|
||||
+
|
||||
+ FireInfo info = getInfo(block, true);
|
||||
+ info.encouragement = encouragement;
|
||||
+ info.flammibility = flammibility;
|
||||
+ }
|
||||
+
|
||||
+ private FireInfo getInfo(Block block, boolean garentee)
|
||||
+ {
|
||||
+ FireInfo ret = blockInfo.get(block);
|
||||
+ if (ret == null && garentee)
|
||||
+ {
|
||||
+ ret = new FireInfo();
|
||||
+ blockInfo.put(block, ret);
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ public void rebuildFireInfo()
|
||||
+ {
|
||||
+ for (int x = 0; x < 4096; x++)
|
||||
+ {
|
||||
+ //If we care.. we could detect changes in here and make sure we keep them, however
|
||||
+ //it's my thinking that anyone who hacks into the private variables should DIAF and we don't care about them.
|
||||
+ field_149849_a[x] = 0;
|
||||
+ field_149848_b[x] = 0;
|
||||
+ }
|
||||
+
|
||||
+ for (Entry<Block, FireInfo> e : blockInfo.entrySet())
|
||||
+ {
|
||||
+ int id = Block.func_149682_b(e.getKey());
|
||||
+ if (id >= 0 && id < 4096)
|
||||
+ {
|
||||
+ field_149849_a[id] = e.getValue().encouragement;
|
||||
+ field_149848_b[id] = e.getValue().flammibility;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public int getFlammability(Block block)
|
||||
+ {
|
||||
+ int id = Block.func_149682_b(block);
|
||||
+ return id >= 0 && id < 4096 ? field_149848_b[id] : 0;
|
||||
+ }
|
||||
+
|
||||
+ public int getEncouragement(Block block)
|
||||
+ {
|
||||
+ int id = Block.func_149682_b(block);
|
||||
+ return id >= 0 && id < 4096 ? field_149849_a[id] : 0;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Side sensitive version that calls the block function.
|
||||
+ *
|
||||
@@ -221,14 +284,9 @@
|
||||
+ * @param face The side the fire is coming from
|
||||
+ * @return True if the face can catch fire.
|
||||
+ */
|
||||
+ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
+ public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
+ {
|
||||
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
+ if (block != null)
|
||||
+ {
|
||||
+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
|
||||
+ }
|
||||
+ return false;
|
||||
+ return world.func_147439_a(x, y, z).isFlammable(world, x, y, z, face);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -242,14 +300,10 @@
|
||||
+ * @param face The side the fire is coming from
|
||||
+ * @return The chance of the block catching fire, or oldChance if it is higher
|
||||
+ */
|
||||
+ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, ForgeDirection face)
|
||||
+ public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face)
|
||||
+ {
|
||||
+ int newChance = 0;
|
||||
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
+ if (block != null)
|
||||
+ {
|
||||
+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
|
||||
+ }
|
||||
+ int newChance = world.func_147439_a(x, y, z).getFireSpreadSpeed(world, x, y, z, face);
|
||||
+ return (newChance > oldChance ? newChance : oldChance);
|
||||
+ }
|
||||
+ /*================================= Forge Start ======================================*/
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockFlower.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockFlower.java
|
||||
@@ -6,7 +6,12 @@
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class BlockFlower extends Block
|
||||
+import net.minecraftforge.common.EnumPlantType;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.IPlantable;
|
||||
+import static net.minecraftforge.common.EnumPlantType.*;
|
||||
+
|
||||
+public class BlockFlower extends Block implements IPlantable
|
||||
{
|
||||
protected BlockFlower(int par1, Material par2Material)
|
||||
{
|
||||
@@ -27,7 +32,7 @@
|
||||
*/
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
- return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
|
||||
+ return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +76,9 @@
|
||||
*/
|
||||
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
- return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
|
||||
+ Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
||||
+ return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
||||
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,4 +114,32 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
|
||||
+ {
|
||||
+ if (blockID == crops.blockID ) return Crop;
|
||||
+ if (blockID == deadBush.blockID ) return Desert;
|
||||
+ if (blockID == waterlily.blockID ) return Water;
|
||||
+ if (blockID == mushroomRed.blockID ) return Cave;
|
||||
+ if (blockID == mushroomBrown.blockID) return Cave;
|
||||
+ if (blockID == netherStalk.blockID ) return Nether;
|
||||
+ if (blockID == sapling.blockID ) return Plains;
|
||||
+ if (blockID == melonStem.blockID ) return Crop;
|
||||
+ if (blockID == pumpkinStem.blockID ) return Crop;
|
||||
+ if (blockID == tallGrass.blockID ) return Plains;
|
||||
+ return Plains;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getPlantID(World world, int x, int y, int z)
|
||||
+ {
|
||||
+ return blockID;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getPlantMetadata(World world, int x, int y, int z)
|
||||
+ {
|
||||
+ return world.getBlockMetadata(x, y, z);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -139,12 +140,6 @@
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
|
||||
- TileEntityFlowerPot tileentityflowerpot = this.func_149929_e(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_);
|
||||
-
|
||||
- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null)
|
||||
- {
|
||||
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b()));
|
||||
- }
|
||||
}
|
||||
|
||||
public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
@@ -242,4 +237,14 @@
|
||||
|
||||
return new TileEntityFlowerPot(Item.func_150898_a((Block)object), b0);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
+ TileEntityFlowerPot te = this.func_149929_e(world, x, y, z);
|
||||
+ if (te != null && te.func_145965_a() != null)
|
||||
+ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b()));
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockFlowing.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockFlowing.java
|
||||
@@ -206,7 +206,7 @@
|
||||
{
|
||||
this.triggerLavaMixEffects(par1World, par2, par3, par4);
|
||||
}
|
||||
- else
|
||||
+ else if (i1 != Block.snow.blockID)//Forge: Damn snow.
|
||||
{
|
||||
Block.blocksList[i1].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockFluid.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockFluid.java
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
for (int l1 = -1; l1 <= 1; ++l1)
|
||||
{
|
||||
- int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).waterColorMultiplier;
|
||||
+ int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).getWaterColorMultiplier();
|
||||
l += (i2 & 16711680) >> 16;
|
||||
i1 += (i2 & 65280) >> 8;
|
||||
j1 += i2 & 255;
|
||||
@@ -81,6 +81,13 @@
|
||||
}
|
||||
|
||||
return (float)(par0 + 1) / 9.0F;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Deprecated //Implemented here for compatibility, need to change this when we make vanilla fluids use our fluid methods.
|
||||
+ public float getFilledPercentage(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return 1 - BlockFluid.getFluidHeightPercent(world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -1,20 +1,37 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockGrass.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockGrass.java
|
||||
@@ -44,7 +44,7 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
|
||||
@@ -43,7 +43,7 @@
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
if (!p_149674_1_.field_72995_K)
|
||||
{
|
||||
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
|
||||
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
|
||||
- if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2)
|
||||
+ if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
|
||||
{
|
||||
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
|
||||
p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.field_150346_d);
|
||||
}
|
||||
@@ -57,7 +57,7 @@
|
||||
int k1 = par4 + par5Random.nextInt(3) - 1;
|
||||
int l1 = par1World.getBlockId(i1, j1 + 1, k1);
|
||||
@@ -56,7 +56,7 @@
|
||||
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
|
||||
Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1);
|
||||
|
||||
- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
|
||||
+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2)
|
||||
+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
{
|
||||
par1World.setBlock(i1, j1, k1, Block.grass.blockID);
|
||||
p_149674_1_.func_147449_b(i1, j1, k1, Blocks.field_150349_c);
|
||||
}
|
||||
@@ -184,15 +184,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- String s = p_149853_1_.func_72807_a(i1, k1).func_150572_a(p_149853_2_, i1, j1, k1);
|
||||
- field_149992_a.debug("Flower in " + p_149853_1_.func_72807_a(i1, k1).field_76791_y + ": " + s);
|
||||
- BlockFlower blockflower = BlockFlower.func_149857_e(s);
|
||||
-
|
||||
- if (blockflower != null && blockflower.func_149718_j(p_149853_1_, i1, j1, k1))
|
||||
- {
|
||||
- int i2 = BlockFlower.func_149856_f(s);
|
||||
- p_149853_1_.func_147465_d(i1, j1, k1, blockflower, i2, 3);
|
||||
- }
|
||||
+ p_149853_1_.func_72807_a(i1, k1).plantFlower(p_149853_1_, p_149853_2_, i1, j1, k1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -13,6 +14,7 @@
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
public class BlockIce extends BlockBreakable
|
||||
{
|
||||
@@ -43,14 +45,16 @@
|
||||
p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
|
||||
p_149636_2_.func_71020_j(0.025F);
|
||||
|
||||
- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_149636_2_))
|
||||
+ if (this.canSilkHarvest(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_) && EnchantmentHelper.func_77502_d(p_149636_2_))
|
||||
{
|
||||
+ ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
ItemStack itemstack = this.func_149644_j(p_149636_6_);
|
||||
|
||||
- if (itemstack != null)
|
||||
- {
|
||||
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, itemstack);
|
||||
- }
|
||||
+ if (itemstack != null) items.add(itemstack);
|
||||
+
|
||||
+ ForgeEventFactory.fireBlockHarvesting(items, p_149636_1_, this, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, 0, 1.0f, true, p_149636_2_);
|
||||
+ for (ItemStack is : items)
|
||||
+ this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, is);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -61,7 +65,9 @@
|
||||
}
|
||||
|
||||
int i1 = EnchantmentHelper.func_77517_e(p_149636_2_);
|
||||
+ harvesters.set(p_149636_2_);
|
||||
this.func_149697_b(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, i1);
|
||||
+ harvesters.set(null);
|
||||
Material material = p_149636_1_.func_147439_a(p_149636_3_, p_149636_4_ - 1, p_149636_5_).func_149688_o();
|
||||
|
||||
if (material.func_76230_c() || material.func_76224_d())
|
||||
@@ -1,6 +1,6 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockLadder.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockLadder.java
|
||||
@@ -5,9 +5,13 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
|
||||
@@ -5,10 +5,14 @@
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -8,85 +8,85 @@
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import static net.minecraftforge.common.ForgeDirection.*;
|
||||
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
+
|
||||
public class BlockLadder extends Block
|
||||
{
|
||||
@@ -104,7 +108,10 @@
|
||||
*/
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
private static final String __OBFID = "CL_00000262";
|
||||
@@ -79,29 +83,32 @@
|
||||
|
||||
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
{
|
||||
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
|
||||
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
|
||||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
|
||||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
|
||||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH);
|
||||
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
|
||||
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,22 +121,22 @@
|
||||
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
{
|
||||
int j1 = par9;
|
||||
int j1 = p_149660_9_;
|
||||
|
||||
- if ((par9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1))
|
||||
+ if ((j1 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
|
||||
- if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
|
||||
+ if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
|
||||
{
|
||||
j1 = 2;
|
||||
}
|
||||
|
||||
- if ((j1 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1))
|
||||
+ if ((j1 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
|
||||
- if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
|
||||
+ if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
|
||||
{
|
||||
j1 = 3;
|
||||
}
|
||||
|
||||
- if ((j1 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4))
|
||||
+ if ((j1 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
|
||||
- if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
|
||||
+ if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
|
||||
{
|
||||
j1 = 4;
|
||||
}
|
||||
|
||||
- if ((j1 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4))
|
||||
+ if ((j1 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
|
||||
- if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
|
||||
+ if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
|
||||
{
|
||||
j1 = 5;
|
||||
}
|
||||
@@ -146,22 +153,22 @@
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4);
|
||||
@@ -114,22 +121,22 @@
|
||||
int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
boolean flag = false;
|
||||
|
||||
- if (i1 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
|
||||
+ if (i1 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
|
||||
- if (l == 2 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r())
|
||||
+ if (l == 2 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
|
||||
+ if (i1 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
|
||||
- if (l == 3 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r())
|
||||
+ if (l == 3 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
|
||||
+ if (i1 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
|
||||
- if (l == 4 && p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r())
|
||||
+ if (l == 4 && p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
|
||||
+ if (i1 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
|
||||
- if (l == 5 && p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r())
|
||||
+ if (l == 5 && p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -182,4 +189,10 @@
|
||||
@@ -147,4 +154,10 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity)
|
||||
+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
@@ -1,99 +1,171 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockLeaves.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockLeaves.java
|
||||
@@ -2,6 +2,8 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -16,7 +18,9 @@
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -15,8 +16,9 @@
|
||||
import net.minecraft.world.ColorizerFoliage;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class BlockLeaves extends BlockLeavesBase
|
||||
+import net.minecraftforge.common.IShearable;
|
||||
+
|
||||
+public class BlockLeaves extends BlockLeavesBase implements IShearable
|
||||
{
|
||||
public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
|
||||
public static final String[][] field_94396_b = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
|
||||
@@ -111,10 +115,9 @@
|
||||
{
|
||||
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
|
||||
|
||||
- if (j2 == Block.leaves.blockID)
|
||||
+ if (Block.blocksList[j2] != null)
|
||||
-public abstract class BlockLeaves extends BlockLeavesBase
|
||||
+public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
|
||||
{
|
||||
int[] field_150128_a;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -82,10 +84,10 @@
|
||||
{
|
||||
for (int l1 = -b0; l1 <= b0; ++l1)
|
||||
{
|
||||
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
|
||||
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
||||
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
|
||||
{
|
||||
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
|
||||
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
|
||||
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
|
||||
- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
||||
- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
|
||||
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,11 +163,13 @@
|
||||
@@ -127,9 +129,9 @@
|
||||
{
|
||||
k2 = par1World.getBlockId(par2 + l1, par3 + i2, par4 + j2);
|
||||
Block block = p_149674_1_.func_147439_a(p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2);
|
||||
|
||||
- if (k2 == Block.wood.blockID)
|
||||
+ Block block = Block.blocksList[k2];
|
||||
+
|
||||
+ if (block != null && block.canSustainLeaves(par1World, par2 + l1, par3 + i2, par4 + j2))
|
||||
- if (block != Blocks.field_150364_r && block != Blocks.field_150363_s)
|
||||
+ if (!block.canSustainLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
}
|
||||
- else if (k2 == Block.leaves.blockID)
|
||||
+ else if (block != null && block.isLeaves(par1World, par2 + l1, par3 + i2, par4 + j2))
|
||||
{
|
||||
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
}
|
||||
@@ -329,15 +334,7 @@
|
||||
*/
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
- if (block.func_149688_o() == Material.field_151584_j)
|
||||
+ if (block.isLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
|
||||
{
|
||||
this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
}
|
||||
@@ -236,40 +238,7 @@
|
||||
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID)
|
||||
- if (!p_149690_1_.field_72995_K)
|
||||
- {
|
||||
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
|
||||
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3));
|
||||
- int j1 = this.func_150123_b(p_149690_5_);
|
||||
-
|
||||
- if (p_149690_7_ > 0)
|
||||
- {
|
||||
- j1 -= 2 << p_149690_7_;
|
||||
-
|
||||
- if (j1 < 10)
|
||||
- {
|
||||
- j1 = 10;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (p_149690_1_.field_73012_v.nextInt(j1) == 0)
|
||||
- {
|
||||
- Item item = this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_);
|
||||
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.func_149692_a(p_149690_5_)));
|
||||
- }
|
||||
-
|
||||
- j1 = 200;
|
||||
-
|
||||
- if (p_149690_7_ > 0)
|
||||
- {
|
||||
- j1 -= 10 << p_149690_7_;
|
||||
-
|
||||
- if (j1 < 40)
|
||||
- {
|
||||
- j1 = 40;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- this.func_150124_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, j1);
|
||||
- }
|
||||
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, 1.0f, p_149690_7_);
|
||||
}
|
||||
|
||||
protected void func_150124_c(World p_150124_1_, int p_150124_2_, int p_150124_3_, int p_150124_4_, int p_150124_5_, int p_150124_6_) {}
|
||||
@@ -281,13 +250,7 @@
|
||||
|
||||
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
|
||||
{
|
||||
- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
|
||||
{
|
||||
- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
|
||||
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Item.func_150898_a(this), 1, p_149636_6_ & 3));
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
- }
|
||||
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -418,4 +415,30 @@
|
||||
}
|
||||
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
|
||||
}
|
||||
}
|
||||
@@ -318,4 +281,67 @@
|
||||
}
|
||||
|
||||
public abstract String[] func_150125_e();
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
|
||||
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
|
||||
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
|
||||
+ ret.add(new ItemStack(this, 1, world.func_72805_g(x, y, z) & 3));
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void beginLeavesDecay(World world, int x, int y, int z)
|
||||
+ {
|
||||
+ world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
|
||||
+
|
||||
+ int i2 = world.func_72805_g(x, y, z);
|
||||
+
|
||||
+ if ((i2 & 8) == 0)
|
||||
+ {
|
||||
+ world.func_72921_c(x, y, z, i2 | 8, 4);
|
||||
+ }
|
||||
+ world.func_72921_c(x, y, z, world.func_72805_g(x, y, z) | 8, 4);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLeaves(World world, int x, int y, int z)
|
||||
+ public boolean isLeaves(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ int chance = this.func_150123_b(metadata);
|
||||
+
|
||||
+ if (fortune > 0)
|
||||
+ {
|
||||
+ chance -= 2 << fortune;
|
||||
+ if (chance < 10) chance = 10;
|
||||
+ }
|
||||
+
|
||||
+ if (world.field_73012_v.nextInt(chance) == 0)
|
||||
+ ret.add(new ItemStack(this.func_149650_a(metadata, world.field_73012_v, fortune), 1, this.func_149692_a(metadata)));
|
||||
+
|
||||
+ chance = 200;
|
||||
+ if (fortune > 0)
|
||||
+ {
|
||||
+ chance -= 10 << fortune;
|
||||
+ if (chance < 40) chance = 40;
|
||||
+ }
|
||||
+
|
||||
+ this.captureDrops(true);
|
||||
+ this.func_150124_c(world, x, y, z, metadata, chance); // Dammet mojang
|
||||
+ ret.addAll(this.captureDrops(false));
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
@@ -1,159 +1,128 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockLever.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockLever.java
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
|
||||
@@ -10,6 +10,9 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import static net.minecraftforge.common.ForgeDirection.*;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
+
|
||||
public class BlockLever extends Block
|
||||
{
|
||||
protected BlockLever(int par1)
|
||||
@@ -57,7 +60,13 @@
|
||||
*/
|
||||
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
|
||||
private static final String __OBFID = "CL_00000264";
|
||||
@@ -42,12 +45,23 @@
|
||||
|
||||
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
|
||||
{
|
||||
- return par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4) ? true : (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)))));
|
||||
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
|
||||
+ return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN )) ||
|
||||
+ (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP )) ||
|
||||
+ (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
|
||||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
|
||||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) ||
|
||||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ));
|
||||
- return p_149707_5_ == 0 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_ + 1, p_149707_4_).func_149721_r() ? true : (p_149707_5_ == 1 && World.func_147466_a(p_149707_1_, p_149707_2_, p_149707_3_ - 1, p_149707_4_) ? true : (p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()))));
|
||||
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
|
||||
+ return (dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) ||
|
||||
+ (dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) ||
|
||||
+ (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
|
||||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
|
||||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) ||
|
||||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST ));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +74,12 @@
|
||||
*/
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
|
||||
{
|
||||
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : par1World.isBlockNormalCube(par2, par3 + 1, par4)))));
|
||||
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
|
||||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
|
||||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
|
||||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) ||
|
||||
+ par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) ||
|
||||
+ par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN );
|
||||
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r() ? true : (World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ + 1, p_149742_4_).func_149721_r()))));
|
||||
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) ||
|
||||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,32 +91,32 @@
|
||||
int k1 = par9 & 7;
|
||||
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
|
||||
@@ -56,32 +70,32 @@
|
||||
int j1 = p_149660_9_ & 7;
|
||||
byte b0 = -1;
|
||||
|
||||
- if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4))
|
||||
+ if (par5 == 0 && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
|
||||
- if (p_149660_5_ == 0 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_ + 1, p_149660_4_).func_149721_r())
|
||||
+ if (p_149660_5_ == 0 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ + 1, p_149660_4_, DOWN))
|
||||
{
|
||||
b0 = 0;
|
||||
}
|
||||
|
||||
- if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
|
||||
+ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
|
||||
- if (p_149660_5_ == 1 && World.func_147466_a(p_149660_1_, p_149660_2_, p_149660_3_ - 1, p_149660_4_))
|
||||
+ if (p_149660_5_ == 1 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ - 1, p_149660_4_, UP))
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
|
||||
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
|
||||
- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
|
||||
+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
|
||||
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
|
||||
- if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
|
||||
+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
|
||||
- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
|
||||
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
|
||||
- if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
|
||||
+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
|
||||
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
|
||||
- if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
|
||||
+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
|
||||
{
|
||||
b0 = 1;
|
||||
}
|
||||
@@ -178,42 +192,42 @@
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
|
||||
@@ -147,42 +161,42 @@
|
||||
int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 5)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 6)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 0)
|
||||
- {
|
||||
- flag = true;
|
||||
- }
|
||||
-
|
||||
- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 7)
|
||||
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 5)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 6)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 0)
|
||||
+ {
|
||||
+ flag = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 7)
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 5)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 5)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 6)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 6)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 0)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 0)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 7)
|
||||
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 7)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLiquid.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLiquid.java
|
||||
@@ -67,7 +67,7 @@
|
||||
{
|
||||
for (int l1 = -1; l1 <= 1; ++l1)
|
||||
{
|
||||
- int i2 = p_149720_1_.func_72807_a(p_149720_2_ + l1, p_149720_4_ + k1).field_76759_H;
|
||||
+ int i2 = p_149720_1_.func_72807_a(p_149720_2_ + l1, p_149720_4_ + k1).getWaterColorMultiplier();
|
||||
l += (i2 & 16711680) >> 16;
|
||||
i1 += (i2 & 65280) >> 8;
|
||||
j1 += i2 & 255;
|
||||
@@ -1,35 +1,44 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockLog.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockLog.java
|
||||
@@ -62,14 +62,9 @@
|
||||
{
|
||||
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLog.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java
|
||||
@@ -7,6 +7,7 @@
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
+import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
- if (j2 == Block.leaves.blockID)
|
||||
+ if (Block.blocksList[j2] != null)
|
||||
public abstract class BlockLog extends BlockRotatedPillar
|
||||
@@ -53,14 +54,10 @@
|
||||
{
|
||||
for (int l1 = -b0; l1 <= b0; ++l1)
|
||||
{
|
||||
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
|
||||
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
||||
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
|
||||
{
|
||||
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
|
||||
- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
||||
-
|
||||
- if ((k2 & 8) == 0)
|
||||
- if ((i2 & 8) == 0)
|
||||
- {
|
||||
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
|
||||
- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
|
||||
- }
|
||||
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
|
||||
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,4 +130,16 @@
|
||||
this.tree_top[i] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[i] + "_top");
|
||||
}
|
||||
@@ -79,4 +76,16 @@
|
||||
{
|
||||
return this.field_150166_b[p_150161_1_ % this.field_150166_b.length];
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canSustainLeaves(World world, int x, int y, int z)
|
||||
+ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isWood(World world, int x, int y, int z)
|
||||
+ public boolean isWood(IBlockAccess world, int x, int y, int z)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockMobSpawner.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockMobSpawner.java
|
||||
@@ -45,8 +45,12 @@
|
||||
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java
|
||||
@@ -7,6 +7,7 @@
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
+import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMobSpawner extends BlockContainer
|
||||
@@ -36,10 +37,15 @@
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
|
||||
- int j1 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15);
|
||||
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getExpDrop(World world, int data, int enchantmentLevel)
|
||||
+ {
|
||||
+ return 15 + world.rand.nextInt(15) + world.rand.nextInt(15);
|
||||
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
|
||||
- int j1 = 15 + p_149690_1_.field_73012_v.nextInt(15) + p_149690_1_.field_73012_v.nextInt(15);
|
||||
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
|
||||
}
|
||||
|
||||
/**
|
||||
+ private Random rand = new Random();
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockAccess world, int metadata, int fortune)
|
||||
+ {
|
||||
+ return 15 + rand.nextInt(15) + rand.nextInt(15);
|
||||
+ }
|
||||
+
|
||||
public boolean func_149662_c()
|
||||
{
|
||||
return false;
|
||||
@@ -1,22 +1,19 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockMushroom.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockMushroom.java
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.Random;
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
|
||||
@@ -4,6 +4,7 @@
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
+
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockMushroom extends BlockFlower
|
||||
public class BlockMushroom extends BlockBush implements IGrowable
|
||||
{
|
||||
@@ -96,7 +98,9 @@
|
||||
if (par3 >= 0 && par3 < 256)
|
||||
@@ -85,7 +86,7 @@
|
||||
if (p_149718_3_ >= 0 && p_149718_3_ < 256)
|
||||
{
|
||||
int l = par1World.getBlockId(par2, par3 - 1, par4);
|
||||
- return l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(l);
|
||||
+ Block soil = Block.blocksList[l];
|
||||
+ return (l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13) &&
|
||||
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
||||
Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
|
||||
- return block == Blocks.field_150391_bh || block == Blocks.field_150346_d && p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.func_72883_k(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && this.func_149854_a(block);
|
||||
+ return block == Blocks.field_150391_bh || block == Blocks.field_150346_d && p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.func_72883_k(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1,20 +1,20 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockMycelium.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockMycelium.java
|
||||
@@ -41,7 +41,7 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
|
||||
@@ -37,7 +37,7 @@
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
if (!p_149674_1_.field_72995_K)
|
||||
{
|
||||
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
|
||||
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
|
||||
- if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2)
|
||||
+ if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
|
||||
{
|
||||
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
|
||||
p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.field_150346_d);
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
int k1 = par4 + par5Random.nextInt(3) - 1;
|
||||
int l1 = par1World.getBlockId(i1, j1 + 1, k1);
|
||||
@@ -50,7 +50,7 @@
|
||||
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
|
||||
Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1);
|
||||
|
||||
- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
|
||||
+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2)
|
||||
+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
{
|
||||
par1World.setBlock(i1, j1, k1, this.blockID);
|
||||
p_149674_1_.func_147449_b(i1, j1, k1, this);
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockNetherStalk.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockNetherStalk.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -9,6 +11,7 @@
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BlockNetherStalk extends BlockFlower
|
||||
{
|
||||
@@ -38,7 +41,8 @@
|
||||
*/
|
||||
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
- return this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
||||
+ return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,25 +84,7 @@
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
|
||||
{
|
||||
- if (!par1World.isRemote)
|
||||
- {
|
||||
- int j1 = 1;
|
||||
-
|
||||
- if (par5 >= 3)
|
||||
- {
|
||||
- j1 = 2 + par1World.rand.nextInt(3);
|
||||
-
|
||||
- if (par7 > 0)
|
||||
- {
|
||||
- j1 += par1World.rand.nextInt(par7 + 1);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- for (int k1 = 0; k1 < j1; ++k1)
|
||||
- {
|
||||
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds));
|
||||
- }
|
||||
- }
|
||||
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,4 +128,23 @@
|
||||
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ int count = 1;
|
||||
+
|
||||
+ if (metadata >= 3)
|
||||
+ {
|
||||
+ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0);
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < count; i++)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(Item.netherStalkSeeds));
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -11,6 +12,7 @@
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockNetherWart extends BlockBush
|
||||
{
|
||||
@@ -33,7 +35,7 @@
|
||||
|
||||
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
|
||||
{
|
||||
- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_));
|
||||
+ return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_);
|
||||
}
|
||||
|
||||
public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
|
||||
@@ -60,9 +62,12 @@
|
||||
return 6;
|
||||
}
|
||||
|
||||
+ @SuppressWarnings("unused")
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
- if (!p_149690_1_.field_72995_K)
|
||||
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
|
||||
+
|
||||
+ if (false && !p_149690_1_.field_72995_K)
|
||||
{
|
||||
int j1 = 1;
|
||||
|
||||
@@ -109,4 +114,23 @@
|
||||
this.field_149883_a[i] = p_149651_1_.func_94245_a(this.func_149641_N() + "_stage_" + i);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ int count = 1;
|
||||
+
|
||||
+ if (metadata >= 3)
|
||||
+ {
|
||||
+ count = 2 + world.field_73012_v.nextInt(3) + (fortune > 0 ? world.field_73012_v.nextInt(fortune + 1) : 0);
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < count; i++)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(Items.field_151075_bm));
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockNote.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java
|
||||
@@ -45,7 +45,9 @@
|
||||
|
||||
if (tileentitynote != null)
|
||||
{
|
||||
+ int old = tileentitynote.field_145879_a;
|
||||
tileentitynote.func_145877_a();
|
||||
+ if (old == tileentitynote.field_145879_a) return false;
|
||||
tileentitynote.func_145878_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
}
|
||||
|
||||
@@ -73,6 +75,11 @@
|
||||
|
||||
public boolean func_149696_a(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_)
|
||||
{
|
||||
+ int meta = p_149696_1_.func_72805_g(p_149696_2_, p_149696_3_, p_149696_4_);
|
||||
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, meta, p_149696_6_, p_149696_5_);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
|
||||
+ p_149696_5_ = e.instrument.ordinal();
|
||||
+ p_149696_6_ = e.getVanillaNoteId();
|
||||
float f = (float)Math.pow(2.0D, (double)(p_149696_6_ - 12) / 12.0D);
|
||||
String s = "harp";
|
||||
|
||||
@@ -1,27 +1,58 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockOre.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockOre.java
|
||||
@@ -60,6 +60,11 @@
|
||||
{
|
||||
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
|
||||
@@ -7,6 +7,7 @@
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.MathHelper;
|
||||
+import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockOre extends Block
|
||||
@@ -51,34 +52,40 @@
|
||||
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
|
||||
+ }
|
||||
+
|
||||
|
||||
- if (this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_) != Item.func_150898_a(this))
|
||||
+ private Random rand = new Random();
|
||||
+ @Override
|
||||
+ public int getExpDrop(World par1World, int par5, int par7)
|
||||
+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
|
||||
+ {
|
||||
if (this.idDropped(par5, par1World.rand, par7) != this.blockID)
|
||||
+ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this))
|
||||
{
|
||||
int j1 = 0;
|
||||
@@ -84,9 +89,10 @@
|
||||
{
|
||||
j1 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5);
|
||||
}
|
||||
+ return j1;
|
||||
+ }
|
||||
|
||||
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
|
||||
- }
|
||||
if (this == Blocks.field_150365_q)
|
||||
{
|
||||
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 0, 2);
|
||||
+ j1 = MathHelper.func_76136_a(rand, 0, 2);
|
||||
}
|
||||
else if (this == Blocks.field_150482_ag)
|
||||
{
|
||||
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 3, 7);
|
||||
+ j1 = MathHelper.func_76136_a(rand, 3, 7);
|
||||
}
|
||||
else if (this == Blocks.field_150412_bA)
|
||||
{
|
||||
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 3, 7);
|
||||
+ j1 = MathHelper.func_76136_a(rand, 3, 7);
|
||||
}
|
||||
else if (this == Blocks.field_150369_x)
|
||||
{
|
||||
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 2, 5);
|
||||
+ j1 = MathHelper.func_76136_a(rand, 2, 5);
|
||||
}
|
||||
else if (this == Blocks.field_150449_bY)
|
||||
{
|
||||
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 2, 5);
|
||||
+ j1 = MathHelper.func_76136_a(rand, 2, 5);
|
||||
}
|
||||
|
||||
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
|
||||
+ return j1;
|
||||
}
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
public int func_149692_a(int p_149692_1_)
|
||||
@@ -1,51 +1,52 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockPane.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockPane.java
|
||||
@@ -13,6 +13,7 @@
|
||||
import net.minecraft.util.Icon;
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
|
||||
@@ -15,6 +15,8 @@
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.util.ForgeDirection;
|
||||
+import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
public class BlockPane extends Block
|
||||
{
|
||||
@@ -90,10 +91,10 @@
|
||||
*/
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
@@ -62,10 +64,10 @@
|
||||
|
||||
public void func_149743_a(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
|
||||
{
|
||||
- boolean flag = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 - 1));
|
||||
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 + 1));
|
||||
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 - 1, par3, par4));
|
||||
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 + 1, par3, par4));
|
||||
+ boolean flag = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.NORTH);
|
||||
+ boolean flag1 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.SOUTH);
|
||||
+ boolean flag2 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.WEST);
|
||||
+ boolean flag3 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.EAST);
|
||||
- boolean flag = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ - 1));
|
||||
- boolean flag1 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ + 1));
|
||||
- boolean flag2 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ - 1, p_149743_3_, p_149743_4_));
|
||||
- boolean flag3 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ + 1, p_149743_3_, p_149743_4_));
|
||||
+ boolean flag = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ - 1, NORTH);
|
||||
+ boolean flag1 = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ + 1, SOUTH);
|
||||
+ boolean flag2 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ - 1, p_149743_3_, p_149743_4_, WEST );
|
||||
+ boolean flag3 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ + 1, p_149743_3_, p_149743_4_, EAST );
|
||||
|
||||
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
|
||||
{
|
||||
@@ -151,10 +152,10 @@
|
||||
@@ -117,10 +119,10 @@
|
||||
float f1 = 0.5625F;
|
||||
float f2 = 0.4375F;
|
||||
float f3 = 0.5625F;
|
||||
- boolean flag = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 - 1));
|
||||
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 + 1));
|
||||
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 - 1, par3, par4));
|
||||
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 + 1, par3, par4));
|
||||
+ boolean flag = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.NORTH);
|
||||
+ boolean flag1 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.SOUTH);
|
||||
+ boolean flag2 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.WEST);
|
||||
+ boolean flag3 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.EAST);
|
||||
- boolean flag = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ - 1));
|
||||
- boolean flag1 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ + 1));
|
||||
- boolean flag2 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ - 1, p_149719_3_, p_149719_4_));
|
||||
- boolean flag3 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ + 1, p_149719_3_, p_149719_4_));
|
||||
+ boolean flag = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ - 1, NORTH);
|
||||
+ boolean flag1 = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ + 1, SOUTH);
|
||||
+ boolean flag2 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ - 1, p_149719_3_, p_149719_4_, WEST );
|
||||
+ boolean flag3 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ + 1, p_149719_3_, p_149719_4_, EAST );
|
||||
|
||||
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
|
||||
{
|
||||
@@ -240,4 +241,10 @@
|
||||
this.blockIcon = par1IconRegister.registerIcon(this.field_94402_c);
|
||||
this.theIcon = par1IconRegister.registerIcon(this.sideTextureIndex);
|
||||
@@ -186,4 +188,10 @@
|
||||
this.field_149761_L = p_149651_1_.func_94245_a(this.field_150101_M);
|
||||
this.field_150102_N = p_149651_1_.func_94245_a(this.field_150100_a);
|
||||
}
|
||||
+
|
||||
+ // FORGE START
|
||||
+ public boolean canPaneConnectTo(IBlockAccess access, int x, int y, int z, ForgeDirection dir)
|
||||
+ public boolean canPaneConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir)
|
||||
+ {
|
||||
+ return canThisPaneConnectToThisBlockID(access.getBlockId(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ)) || access.isBlockSolidOnSide(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.getOpposite(), false);
|
||||
+ return func_150098_a(world.func_147439_a(x, y, z)) ||
|
||||
+ world.isSideSolid(x, y, z, dir.getOpposite(), false);
|
||||
+ }
|
||||
}
|
||||
@@ -1,56 +1,65 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockPistonBase.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockPistonBase.java
|
||||
@@ -439,7 +439,7 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
|
||||
@@ -11,6 +11,7 @@
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
+import net.minecraft.server.management.PlayerManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityPiston;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -360,7 +361,8 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- return !(Block.blocksList[par0] instanceof ITileEntityProvider);
|
||||
+ return !par1World.blockHasTileEntity(par2, par3, par4);
|
||||
- return !(p_150080_0_ instanceof ITileEntityProvider);
|
||||
+ return !(p_150080_1_.func_147439_a(p_150080_2_, p_150080_3_, p_150080_4_).hasTileEntity(p_150080_1_.func_72805_g(p_150080_2_, p_150080_3_, p_150080_4_)));
|
||||
+
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,14 +457,14 @@
|
||||
@@ -375,14 +377,14 @@
|
||||
{
|
||||
if (l1 < 13)
|
||||
{
|
||||
- if (j1 <= 0 || j1 >= 255)
|
||||
+ if (j1 <= 0 || j1 >= par0World.getHeight() - 1)
|
||||
+ if (j1 <= 0 || j1 >= p_150077_0_.func_72800_K())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int i2 = par0World.getBlockId(i1, j1, k1);
|
||||
Block block = p_150077_0_.func_147439_a(i1, j1, k1);
|
||||
|
||||
- if (i2 != 0)
|
||||
+ if (!par0World.isAirBlock(i1, j1, k1))
|
||||
- if (block.func_149688_o() != Material.field_151579_a)
|
||||
+ if (!block.isAir(p_150077_0_, i1, j1, k1))
|
||||
{
|
||||
if (!canPushBlock(i2, par0World, i1, j1, k1, true))
|
||||
if (!func_150080_a(block, p_150077_0_, i1, j1, k1, true))
|
||||
{
|
||||
@@ -507,14 +507,14 @@
|
||||
|
||||
@@ -420,14 +422,14 @@
|
||||
{
|
||||
if (l1 < 13)
|
||||
{
|
||||
- if (j1 <= 0 || j1 >= 255)
|
||||
+ if (j1 <= 0 || j1 >= par1World.getHeight() - 1)
|
||||
+ if (j1 <= 0 || j1 >= p_150079_1_.func_72800_K())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
i2 = par1World.getBlockId(i1, j1, k1);
|
||||
Block block = p_150079_1_.func_147439_a(i1, j1, k1);
|
||||
|
||||
- if (i2 != 0)
|
||||
+ if (!par1World.isAirBlock(i1, j1, k1))
|
||||
- if (block.func_149688_o() != Material.field_151579_a)
|
||||
+ if (!block.isAir(p_150079_1_, i1, j1, k1))
|
||||
{
|
||||
if (!canPushBlock(i2, par1World, i1, j1, k1, true))
|
||||
if (!func_150080_a(block, p_150079_1_, i1, j1, k1, true))
|
||||
{
|
||||
@@ -535,7 +535,9 @@
|
||||
@@ -448,7 +450,9 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
- Block.blocksList[i2].dropBlockAsItem(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), 0);
|
||||
- block.func_149697_b(p_150079_1_, i1, j1, k1, p_150079_1_.func_72805_g(i1, j1, k1), 0);
|
||||
+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
|
||||
+ float chance = (Block.blocksList[i2] instanceof BlockSnow ? -1.0f : 1.0f);
|
||||
+ Block.blocksList[i2].dropBlockAsItemWithChance(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), chance, 0);
|
||||
par1World.setBlockToAir(i1, j1, k1);
|
||||
+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f;
|
||||
+ block.func_149690_a(p_150079_1_, i1, j1, k1, p_150079_1_.func_72805_g(i1, j1, k1), chance, 0);
|
||||
p_150079_1_.func_147468_f(i1, j1, k1);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 536 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user