mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 09:05:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4caf46cb9 | ||
|
|
7b866e7e43 | ||
|
|
c2b79dd6ad | ||
|
|
b290cc6477 | ||
|
|
16127a61c7 | ||
|
|
0965ebae09 | ||
|
|
b06fb810ca | ||
|
|
261313a682 | ||
|
|
da96dd3514 | ||
|
|
201be84b9c | ||
|
|
03d7eaae23 | ||
|
|
1be1bb59c5 | ||
|
|
fb44ba2e6d | ||
|
|
b16994717f | ||
|
|
b2964a1ae7 | ||
|
|
6f361dafa8 | ||
|
|
376f172990 | ||
|
|
9fe6385e1f | ||
|
|
b0ae0be80e | ||
|
|
b109baf7d6 | ||
|
|
7065cb36bf | ||
|
|
a6b9fdf8c4 | ||
|
|
6e8dd77bbe | ||
|
|
a4983be979 | ||
|
|
62cc9f2e63 | ||
|
|
49ec3d1b93 | ||
|
|
cf26f4acbe | ||
|
|
882e0e3bf2 | ||
|
|
2cb99f0e74 | ||
|
|
be73ec3d5e | ||
|
|
0348760a77 | ||
|
|
2f802b6d71 | ||
|
|
6b52023a5c | ||
|
|
5bea8218d2 | ||
|
|
b24eb9af3c | ||
|
|
d48985fafa | ||
|
|
c416f38461 | ||
|
|
0a5ef64d6e |
No files matched your search
+8
-6
@@ -34,7 +34,7 @@ minecraft {
|
||||
versionJson = "jsons/${minecraft.version}-dev.json"
|
||||
buildUserdev = true
|
||||
buildInstaller = true
|
||||
installerVersion = "1.4"
|
||||
installerVersion = "1.5"
|
||||
|
||||
def common = {
|
||||
patchPrefixOriginal "../src-base/minecraft"
|
||||
@@ -84,8 +84,6 @@ task changelog(type: JenkinsChangelog) {
|
||||
// skip if there is no forge jenkins pass
|
||||
onlyIf {
|
||||
project.hasProperty('forgeJenkinsPass')
|
||||
// Not sure what abrar was trying to do here...
|
||||
//project.file("build/distributions/${project.name}-${project.version}-changelog.txt").text = ""
|
||||
}
|
||||
|
||||
outputs.upToDateWhen { false } // never up to date
|
||||
@@ -108,13 +106,14 @@ task crowdin(type: CrowdinDownload) {
|
||||
}
|
||||
|
||||
def extraTxts = [
|
||||
changelog, // yeah we can do thi, because gradle and groovy are awesome
|
||||
"CREDITS-fml.txt",
|
||||
"LICENSE-new.txt",
|
||||
"MinecraftForge-Credits.txt",
|
||||
"Paulscode SoundSystem CodecIBXM License.txt",
|
||||
"Paulscode IBXM Library License.txt"
|
||||
]
|
||||
if (project.hasProperty('forgeJenkinsPass'))
|
||||
extraTxts += changelog
|
||||
|
||||
outputJar {
|
||||
classifier = 'universal'
|
||||
@@ -135,6 +134,7 @@ installer {
|
||||
classifier = 'installer'
|
||||
from extraTxts
|
||||
from "src/main/resources/forge_logo.png"
|
||||
from "src/main/resources/url.png"
|
||||
rename "forge_logo\\.png", "big_logo.png"
|
||||
}
|
||||
|
||||
@@ -177,7 +177,8 @@ task makeMdk(type: Zip) {
|
||||
into ('eclipse') {
|
||||
from 'mdk/eclipse'
|
||||
}
|
||||
from changelog.output
|
||||
if (project.hasProperty('forgeJenkinsPass'))
|
||||
from changelog.output
|
||||
from ('mdk') {
|
||||
filter(ReplaceTokens, tokens: [
|
||||
VERSION: project.version,
|
||||
@@ -211,7 +212,8 @@ tasks.build.dependsOn 'launch4j'
|
||||
// MAVEN
|
||||
|
||||
artifacts {
|
||||
archives changelog.output
|
||||
if (project.hasProperty('forgeJenkinsPass'))
|
||||
archives changelog.output
|
||||
archives file("build/distributions/${project.name}-${project.version}-installer-win.exe")
|
||||
archives makeMdk
|
||||
}
|
||||
|
||||
+16
-2
@@ -8,7 +8,8 @@
|
||||
"welcome":"Welcome to the simple @project@ installer.",
|
||||
"minecraft":"@minecraft_version@",
|
||||
"mirrorList" : "http://files.minecraftforge.net/mirror-brand.list",
|
||||
"logo":"/big_logo.png"
|
||||
"logo":"/big_logo.png",
|
||||
"modList": "none"
|
||||
},
|
||||
"versionInfo": {
|
||||
"id": "@minecraft_version@-@project@@version@",
|
||||
@@ -135,5 +136,18 @@
|
||||
"serverreq":true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"optionals": [
|
||||
{
|
||||
"name": "Mercurius",
|
||||
"client": true,
|
||||
"server": true,
|
||||
"default": true,
|
||||
"inject": true,
|
||||
"desc": "A mod that collects statistics about Minecraft and your system.<br>Useful for Forge to understand how Minecraft/Forge are used.",
|
||||
"url": "http://www.minecraftforge.net/forum/index.php?topic=43278.0",
|
||||
"artifact": "net.minecraftforge:MercuriusUpdater:1.10.2",
|
||||
"maven": "http://files.minecraftforge.net/maven/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
@@ -212,7 +212,7 @@
|
||||
public SoundType func_185467_w()
|
||||
{
|
||||
return this.field_149762_H;
|
||||
@@ -893,6 +915,1186 @@
|
||||
@@ -893,6 +915,1187 @@
|
||||
return "Block{" + field_149771_c.func_177774_c(this) + "}";
|
||||
}
|
||||
|
||||
@@ -1026,7 +1026,8 @@
|
||||
+ this != net.minecraft.init.Blocks.field_150411_aY &&
|
||||
+ this != net.minecraft.init.Blocks.field_185775_db;
|
||||
+ }
|
||||
+ else if (entity instanceof net.minecraft.entity.boss.EntityWither)
|
||||
+ else if ((entity instanceof net.minecraft.entity.boss.EntityWither) ||
|
||||
+ (entity instanceof net.minecraft.entity.projectile.EntityWitherSkull))
|
||||
+ {
|
||||
+ return net.minecraft.entity.boss.EntityWither.func_181033_a(this);
|
||||
+ }
|
||||
@@ -1399,7 +1400,7 @@
|
||||
public static void func_149671_p()
|
||||
{
|
||||
func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air"));
|
||||
@@ -1169,11 +2371,7 @@
|
||||
@@ -1169,11 +2372,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneTorch.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneTorch.java
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
public class BlockRedstoneTorch extends BlockTorch
|
||||
{
|
||||
- private static final Map<World, List<BlockRedstoneTorch.Toggle>> field_150112_b = Maps.<World, List<BlockRedstoneTorch.Toggle>>newHashMap();
|
||||
+ private static final Map<World, List<BlockRedstoneTorch.Toggle>> field_150112_b = new java.util.WeakHashMap<World, List<BlockRedstoneTorch.Toggle>>(); // FORGE - fix vanilla MC-101233
|
||||
private final boolean field_150113_a;
|
||||
|
||||
private boolean func_176598_a(World p_176598_1_, BlockPos p_176598_2_, boolean p_176598_3_)
|
||||
@@ -58,18 +58,23 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1169,6 +1176,10 @@
|
||||
@@ -1169,6 +1176,15 @@
|
||||
{
|
||||
tileentity.func_145839_a(p_147273_1_.func_148857_g());
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ if(tileentity == null)
|
||||
+ {
|
||||
+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g());
|
||||
+ return;
|
||||
+ }
|
||||
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
|
||||
+ }
|
||||
|
||||
if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock)
|
||||
{
|
||||
@@ -1266,15 +1277,15 @@
|
||||
@@ -1266,15 +1282,15 @@
|
||||
}
|
||||
else if (f == 101.0F)
|
||||
{
|
||||
@@ -88,7 +93,7 @@
|
||||
}
|
||||
}
|
||||
else if (i == 6)
|
||||
@@ -1368,7 +1379,7 @@
|
||||
@@ -1368,7 +1384,7 @@
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
|
||||
@@ -101,6 +101,15 @@
|
||||
{
|
||||
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, destroyblockprogress.func_73106_e());
|
||||
}
|
||||
@@ -926,7 +942,7 @@
|
||||
BlockPos blockpos2 = renderchunk4.func_178568_j().func_177982_a(8, 8, 8);
|
||||
boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D;
|
||||
|
||||
- if (!renderchunk4.func_188281_o() && !flag3)
|
||||
+ if (net.minecraftforge.common.ForgeModContainer.alwaysSetupTerrainOffThread || (!renderchunk4.func_188281_o() && !flag3))
|
||||
{
|
||||
this.field_175009_l.add(renderchunk4);
|
||||
}
|
||||
@@ -1213,6 +1229,13 @@
|
||||
|
||||
public void func_174976_a(float p_174976_1_, int p_174976_2_)
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
|
||||
@@ -113,11 +113,14 @@
|
||||
@@ -112,12 +112,15 @@
|
||||
{
|
||||
if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n())
|
||||
{
|
||||
RenderHelper.func_74519_b();
|
||||
+ if(!drawingBatch || !p_180546_1_.hasFastRenderer())
|
||||
+ {
|
||||
RenderHelper.func_74519_b();
|
||||
int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0);
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
|
||||
@@ -109,6 +109,15 @@
|
||||
this.field_184239_as = null;
|
||||
entity.func_184225_p(this);
|
||||
}
|
||||
@@ -2182,7 +2201,7 @@
|
||||
double d1 = p_145771_3_ - (double)blockpos.func_177956_o();
|
||||
double d2 = p_145771_5_ - (double)blockpos.func_177952_p();
|
||||
List<AxisAlignedBB> list = this.field_70170_p.func_147461_a(this.func_174813_aQ());
|
||||
-
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.GetCollisionBoxesEvent(this.field_70170_p, this, this.func_174813_aQ(), list));
|
||||
if (list.isEmpty())
|
||||
{
|
||||
return false;
|
||||
@@ -2336,6 +2355,7 @@
|
||||
{
|
||||
if (!this.field_70170_p.field_72995_K && !this.field_70128_L)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
|
||||
@@ -93,6 +93,7 @@
|
||||
@@ -90,9 +90,11 @@
|
||||
private static final Map < Class <? extends Entity > , Integer > field_75624_e = Maps. < Class <? extends Entity > , Integer > newHashMap();
|
||||
private static final Map<String, Integer> field_180126_g = Maps.<String, Integer>newHashMap();
|
||||
public static final Map<String, EntityList.EntityEggInfo> field_75627_a = Maps.<String, EntityList.EntityEggInfo>newLinkedHashMap();
|
||||
+ private static final Map<String, java.lang.reflect.Constructor<? extends Entity>> CACHED_CONSTRUCTORS = Maps.newHashMap();
|
||||
|
||||
public static void func_75618_a(Class <? extends Entity > p_75618_0_, String p_75618_1_, int p_75618_2_)
|
||||
{
|
||||
@@ -8,19 +12,43 @@
|
||||
if (field_75625_b.containsKey(p_75618_1_))
|
||||
{
|
||||
throw new IllegalArgumentException("ID is already registered: " + p_75618_1_);
|
||||
@@ -152,9 +153,10 @@
|
||||
{
|
||||
Entity entity = null;
|
||||
@@ -132,12 +134,20 @@
|
||||
|
||||
+ Class <? extends Entity > oclass = null;
|
||||
try
|
||||
{
|
||||
- Class <? extends Entity > oclass = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id"));
|
||||
+ oclass = field_75625_b.get(p_75615_0_.func_74779_i("id"));
|
||||
+ java.lang.reflect.Constructor<? extends Entity> ctr = CACHED_CONSTRUCTORS.get(p_75620_0_);
|
||||
+ if (ctr == null)
|
||||
+ {
|
||||
Class <? extends Entity > oclass = (Class)field_75625_b.get(p_75620_0_);
|
||||
|
||||
if (oclass != null)
|
||||
{
|
||||
@@ -168,7 +170,17 @@
|
||||
- entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_75620_1_});
|
||||
+ ctr = oclass.getConstructor(World.class);
|
||||
+ CACHED_CONSTRUCTORS.put(p_75620_0_, ctr);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ if (ctr != null)
|
||||
+ entity = ctr.newInstance(p_75620_1_);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -154,12 +164,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
- Class <? extends Entity > oclass = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id"));
|
||||
-
|
||||
- if (oclass != null)
|
||||
- {
|
||||
- entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_75615_1_});
|
||||
- }
|
||||
+ entity = func_75620_a(p_75615_0_.func_74779_i("id"), p_75615_1_);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -168,7 +173,17 @@
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
@@ -32,13 +60,13 @@
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
|
||||
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
|
||||
+ p_75615_0_.func_74779_i("id"), oclass.getName());
|
||||
+ p_75615_0_.func_74779_i("id"), field_75625_b.get(p_75615_0_.func_74779_i("id")).getName());
|
||||
+ entity = null;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -208,7 +220,8 @@
|
||||
@@ -208,7 +223,8 @@
|
||||
@Nullable
|
||||
public static Entity func_188429_b(String p_188429_0_, World p_188429_1_)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/SharedMonsterAttributes.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/SharedMonsterAttributes.java
|
||||
@@ -16,7 +16,7 @@
|
||||
public class SharedMonsterAttributes
|
||||
{
|
||||
private static final Logger field_151476_f = LogManager.getLogger();
|
||||
- public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).func_111117_a("Max Health").func_111112_a(true);
|
||||
+ public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, Float.MIN_VALUE, 1024.0D)).func_111117_a("Max Health").func_111112_a(true); // Forge: set smallest max-health value to fix MC-119183. This gets rounded to float so we use the smallest positive float value.
|
||||
public static final IAttribute field_111265_b = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).func_111117_a("Follow Range");
|
||||
public static final IAttribute field_111266_c = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).func_111117_a("Knockback Resistance");
|
||||
public static final IAttribute field_111263_d = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).func_111117_a("Movement Speed").func_111112_a(true);
|
||||
@@ -0,0 +1,16 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityShulker.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityShulker.java
|
||||
@@ -391,6 +391,13 @@
|
||||
|
||||
if (flag)
|
||||
{
|
||||
+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), 0);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) flag = false;
|
||||
+ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
+ }
|
||||
+
|
||||
+ if (flag)
|
||||
+ {
|
||||
this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F);
|
||||
this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1));
|
||||
this.field_70180_af.func_187227_b(field_184702_c, Byte.valueOf((byte)0));
|
||||
@@ -0,0 +1,11 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
@@ -62,7 +62,7 @@
|
||||
float f = super.func_180428_a(p_180428_1_, p_180428_2_, p_180428_3_, p_180428_4_);
|
||||
Block block = p_180428_4_.func_177230_c();
|
||||
|
||||
- if (this.func_82342_d() && EntityWither.func_181033_a(block))
|
||||
+ if (this.func_82342_d() && block.canEntityDestroy(p_180428_4_, p_180428_2_, p_180428_3_, this))
|
||||
{
|
||||
f = Math.min(0.8F, f);
|
||||
}
|
||||
@@ -1,6 +1,30 @@
|
||||
--- ../src-base/minecraft/net/minecraft/inventory/Container.java
|
||||
+++ ../src-work/minecraft/net/minecraft/inventory/Container.java
|
||||
@@ -650,7 +650,7 @@
|
||||
@@ -606,18 +606,19 @@
|
||||
if (itemstack != null && func_184997_a(p_75135_1_, itemstack))
|
||||
{
|
||||
int j = itemstack.field_77994_a + p_75135_1_.field_77994_a;
|
||||
+ int maxSize = Math.min(slot.func_75219_a(), p_75135_1_.func_77976_d());
|
||||
|
||||
- if (j <= p_75135_1_.func_77976_d())
|
||||
+ if (j <= maxSize)
|
||||
{
|
||||
p_75135_1_.field_77994_a = 0;
|
||||
itemstack.field_77994_a = j;
|
||||
slot.func_75218_e();
|
||||
flag = true;
|
||||
}
|
||||
- else if (itemstack.field_77994_a < p_75135_1_.func_77976_d())
|
||||
+ else if (itemstack.field_77994_a < maxSize)
|
||||
{
|
||||
- p_75135_1_.field_77994_a -= p_75135_1_.func_77976_d() - itemstack.field_77994_a;
|
||||
- itemstack.field_77994_a = p_75135_1_.func_77976_d();
|
||||
+ p_75135_1_.field_77994_a -= maxSize - itemstack.field_77994_a;
|
||||
+ itemstack.field_77994_a = maxSize;
|
||||
slot.func_75218_e();
|
||||
flag = true;
|
||||
}
|
||||
@@ -650,7 +651,7 @@
|
||||
Slot slot1 = (Slot)this.field_75151_b.get(i);
|
||||
ItemStack itemstack1 = slot1.func_75211_c();
|
||||
|
||||
@@ -9,7 +33,7 @@
|
||||
{
|
||||
slot1.func_75215_d(p_75135_1_.func_77946_l());
|
||||
slot1.func_75218_e();
|
||||
@@ -728,7 +728,7 @@
|
||||
@@ -728,7 +729,7 @@
|
||||
p_94525_2_.field_77994_a = 1;
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
--- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java
|
||||
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java
|
||||
@@ -146,7 +146,7 @@
|
||||
@@ -91,12 +91,9 @@
|
||||
|
||||
slot.func_75220_a(itemstack1, itemstack);
|
||||
}
|
||||
- else if (!this.field_82864_f.func_75216_d() && this.field_82864_f.func_75214_a(itemstack1) && itemstack1.field_77994_a == 1)
|
||||
+ else if (this.func_75135_a(itemstack1, 0, 1, false)) //Forge Fix Shift Clicking in beacons with stacks larger then 1.
|
||||
{
|
||||
- if (!this.func_75135_a(itemstack1, 0, 1, false))
|
||||
- {
|
||||
- return null;
|
||||
- }
|
||||
+ return null;
|
||||
}
|
||||
else if (p_82846_2_ >= 1 && p_82846_2_ < 28)
|
||||
{
|
||||
@@ -146,7 +143,7 @@
|
||||
|
||||
public boolean func_75214_a(@Nullable ItemStack p_75214_1_)
|
||||
{
|
||||
|
||||
@@ -18,3 +18,13 @@
|
||||
p_180614_3_.func_184133_a(p_180614_2_, p_180614_4_, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
|
||||
--p_180614_1_.field_77994_a;
|
||||
return EnumActionResult.SUCCESS;
|
||||
@@ -66,4 +66,9 @@
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public Block getBlock()
|
||||
+ {
|
||||
+ return this.field_150935_a;
|
||||
+ }
|
||||
}
|
||||
@@ -34,7 +34,15 @@
|
||||
this.field_77994_a = p_i1881_2_;
|
||||
this.field_77991_e = p_i1881_3_;
|
||||
|
||||
@@ -117,7 +123,7 @@
|
||||
@@ -99,6 +105,7 @@
|
||||
|
||||
public static ItemStack func_77949_a(NBTTagCompound p_77949_0_)
|
||||
{
|
||||
+ if (p_77949_0_.func_82582_d()) return null; // Deserialized inventories can have empty ItemStack compounds. Fixes tons of NumberFormatExceptions
|
||||
ItemStack itemstack = new ItemStack();
|
||||
itemstack.func_77963_c(p_77949_0_);
|
||||
return itemstack.func_77973_b() != null ? itemstack : null;
|
||||
@@ -117,7 +124,7 @@
|
||||
public ItemStack func_77979_a(int p_77979_1_)
|
||||
{
|
||||
p_77979_1_ = Math.min(p_77979_1_, this.field_77994_a);
|
||||
@@ -43,7 +51,7 @@
|
||||
|
||||
if (this.field_77990_d != null)
|
||||
{
|
||||
@@ -130,11 +136,12 @@
|
||||
@@ -130,11 +137,12 @@
|
||||
|
||||
public Item func_77973_b()
|
||||
{
|
||||
@@ -57,7 +65,7 @@
|
||||
EnumActionResult enumactionresult = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_, p_179546_8_);
|
||||
|
||||
if (enumactionresult == EnumActionResult.SUCCESS)
|
||||
@@ -173,12 +180,20 @@
|
||||
@@ -173,12 +181,20 @@
|
||||
p_77955_1_.func_74782_a("tag", this.field_77990_d);
|
||||
}
|
||||
|
||||
@@ -79,7 +87,7 @@
|
||||
this.field_77994_a = p_77963_1_.func_74771_c("Count");
|
||||
this.field_77991_e = p_77963_1_.func_74765_d("Damage");
|
||||
|
||||
@@ -196,11 +211,12 @@
|
||||
@@ -196,11 +212,12 @@
|
||||
this.field_151002_e.func_179215_a(this.field_77990_d);
|
||||
}
|
||||
}
|
||||
@@ -93,7 +101,7 @@
|
||||
}
|
||||
|
||||
public boolean func_77985_e()
|
||||
@@ -210,7 +226,7 @@
|
||||
@@ -210,7 +227,7 @@
|
||||
|
||||
public boolean func_77984_f()
|
||||
{
|
||||
@@ -102,7 +110,7 @@
|
||||
}
|
||||
|
||||
public boolean func_77981_g()
|
||||
@@ -220,32 +236,27 @@
|
||||
@@ -220,32 +237,27 @@
|
||||
|
||||
public boolean func_77951_h()
|
||||
{
|
||||
@@ -140,7 +148,7 @@
|
||||
}
|
||||
|
||||
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_)
|
||||
@@ -277,8 +288,8 @@
|
||||
@@ -277,8 +289,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +159,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +343,7 @@
|
||||
@@ -332,7 +344,7 @@
|
||||
|
||||
public boolean func_150998_b(IBlockState p_150998_1_)
|
||||
{
|
||||
@@ -160,7 +168,7 @@
|
||||
}
|
||||
|
||||
public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_)
|
||||
@@ -342,7 +353,7 @@
|
||||
@@ -342,7 +354,7 @@
|
||||
|
||||
public ItemStack func_77946_l()
|
||||
{
|
||||
@@ -169,7 +177,7 @@
|
||||
|
||||
if (this.field_77990_d != null)
|
||||
{
|
||||
@@ -354,7 +365,19 @@
|
||||
@@ -354,7 +366,19 @@
|
||||
|
||||
public static boolean func_77970_a(@Nullable ItemStack p_77970_0_, @Nullable ItemStack p_77970_1_)
|
||||
{
|
||||
@@ -190,7 +198,7 @@
|
||||
}
|
||||
|
||||
public static boolean func_77989_b(@Nullable ItemStack p_77989_0_, @Nullable ItemStack p_77989_1_)
|
||||
@@ -364,7 +387,11 @@
|
||||
@@ -364,7 +388,11 @@
|
||||
|
||||
private boolean func_77959_d(ItemStack p_77959_1_)
|
||||
{
|
||||
@@ -203,7 +211,7 @@
|
||||
}
|
||||
|
||||
public static boolean func_179545_c(@Nullable ItemStack p_179545_0_, @Nullable ItemStack p_179545_1_)
|
||||
@@ -764,6 +791,7 @@
|
||||
@@ -764,6 +792,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +219,7 @@
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -875,7 +903,7 @@
|
||||
@@ -875,7 +904,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -220,7 +228,7 @@
|
||||
}
|
||||
|
||||
return multimap;
|
||||
@@ -908,6 +936,18 @@
|
||||
@@ -908,6 +937,18 @@
|
||||
@Deprecated
|
||||
public void func_150996_a(Item p_150996_1_)
|
||||
{
|
||||
@@ -239,7 +247,7 @@
|
||||
this.field_151002_e = p_150996_1_;
|
||||
}
|
||||
|
||||
@@ -993,4 +1033,45 @@
|
||||
@@ -993,4 +1034,45 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
+ net.minecraft.util.math.AxisAlignedBB cbb = null;
|
||||
+ try
|
||||
+ {
|
||||
+ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, pos).func_72321_a(pos.func_177958_n(), pos.func_177956_o(), pos.func_177952_p());
|
||||
+ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, pos).func_186670_a(pos);
|
||||
+ }
|
||||
+ catch (Exception e)
|
||||
+ {
|
||||
|
||||
@@ -206,6 +206,15 @@
|
||||
this.func_72964_e(i, j).func_76612_a(p_72838_1_);
|
||||
this.field_72996_f.add(p_72838_1_);
|
||||
this.func_72923_a(p_72838_1_);
|
||||
@@ -1221,7 +1284,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.GetCollisionBoxesEvent(this, p_184144_1_, p_184144_2_, list));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1296,7 +1359,6 @@
|
||||
return list;
|
||||
}
|
||||
@@ -355,7 +364,7 @@
|
||||
throw new ReportedException(crashreport1);
|
||||
}
|
||||
}
|
||||
@@ -1682,7 +1796,7 @@
|
||||
@@ -1682,11 +1796,11 @@
|
||||
{
|
||||
BlockPos blockpos = tileentity.func_174877_v();
|
||||
|
||||
@@ -364,6 +373,11 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
- this.field_72984_F.func_76320_a(tileentity.getClass().getSimpleName());
|
||||
+ this.field_72984_F.func_76320_a(this.field_72984_F.field_76327_a ? tileentity.getClass().getSimpleName() : ""); // Fix for MC-117087
|
||||
((ITickable)tileentity).func_73660_a();
|
||||
this.field_72984_F.func_76319_b();
|
||||
}
|
||||
@@ -1695,6 +1809,13 @@
|
||||
CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity");
|
||||
CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked");
|
||||
@@ -378,7 +392,7 @@
|
||||
throw new ReportedException(crashreport2);
|
||||
}
|
||||
}
|
||||
@@ -1707,20 +1828,28 @@
|
||||
@@ -1707,20 +1828,31 @@
|
||||
|
||||
if (this.func_175667_e(tileentity.func_174877_v()))
|
||||
{
|
||||
@@ -395,13 +409,18 @@
|
||||
-
|
||||
if (!this.field_147483_b.isEmpty())
|
||||
{
|
||||
- this.field_175730_i.removeAll(this.field_147483_b);
|
||||
- this.field_147482_g.removeAll(this.field_147483_b);
|
||||
+ for (Object tile : field_147483_b)
|
||||
+ {
|
||||
+ ((TileEntity)tile).onChunkUnload();
|
||||
+ }
|
||||
+
|
||||
this.field_175730_i.removeAll(this.field_147483_b);
|
||||
this.field_147482_g.removeAll(this.field_147483_b);
|
||||
+ // forge: faster "contains" makes this removal much more efficient (MC-117075)
|
||||
+ java.util.Set<TileEntity> remove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<TileEntity, Boolean>());
|
||||
+ remove.addAll(field_147483_b);
|
||||
+ this.field_175730_i.removeAll(remove);
|
||||
+ this.field_147482_g.removeAll(remove);
|
||||
this.field_147483_b.clear();
|
||||
}
|
||||
|
||||
@@ -410,7 +429,7 @@
|
||||
this.field_72984_F.func_76318_c("pendingBlockEntities");
|
||||
|
||||
if (!this.field_147484_a.isEmpty())
|
||||
@@ -1759,8 +1888,12 @@
|
||||
@@ -1759,8 +1891,12 @@
|
||||
|
||||
public boolean func_175700_a(TileEntity p_175700_1_)
|
||||
{
|
||||
@@ -424,7 +443,7 @@
|
||||
if (flag && p_175700_1_ instanceof ITickable)
|
||||
{
|
||||
this.field_175730_i.add(p_175700_1_);
|
||||
@@ -1780,6 +1913,11 @@
|
||||
@@ -1780,6 +1916,11 @@
|
||||
{
|
||||
if (this.field_147481_N)
|
||||
{
|
||||
@@ -436,7 +455,7 @@
|
||||
this.field_147484_a.addAll(p_147448_1_);
|
||||
}
|
||||
else
|
||||
@@ -1800,9 +1938,12 @@
|
||||
@@ -1800,9 +1941,12 @@
|
||||
{
|
||||
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
|
||||
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
|
||||
@@ -451,7 +470,7 @@
|
||||
{
|
||||
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
|
||||
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
|
||||
@@ -2001,6 +2142,10 @@
|
||||
@@ -2001,6 +2145,10 @@
|
||||
blockpos$pooledmutableblockpos.func_185344_t();
|
||||
return true;
|
||||
}
|
||||
@@ -462,7 +481,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2040,6 +2185,16 @@
|
||||
@@ -2040,6 +2188,16 @@
|
||||
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos);
|
||||
Block block = iblockstate.func_177230_c();
|
||||
|
||||
@@ -479,7 +498,7 @@
|
||||
if (iblockstate.func_185904_a() == p_72918_2_)
|
||||
{
|
||||
double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue()));
|
||||
@@ -2116,6 +2271,9 @@
|
||||
@@ -2116,6 +2274,9 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2));
|
||||
|
||||
@@ -489,7 +508,7 @@
|
||||
if (iblockstate.func_185904_a() == p_72830_2_)
|
||||
{
|
||||
int j2 = ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue();
|
||||
@@ -2148,6 +2306,7 @@
|
||||
@@ -2148,6 +2309,7 @@
|
||||
public Explosion func_72885_a(@Nullable Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
|
||||
{
|
||||
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
|
||||
@@ -497,7 +516,7 @@
|
||||
explosion.func_77278_a();
|
||||
explosion.func_77279_a(true);
|
||||
return explosion;
|
||||
@@ -2270,6 +2429,7 @@
|
||||
@@ -2270,6 +2432,7 @@
|
||||
|
||||
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_)
|
||||
{
|
||||
@@ -505,7 +524,7 @@
|
||||
if (!this.func_189509_E(p_175690_1_))
|
||||
{
|
||||
if (p_175690_2_ != null && !p_175690_2_.func_145837_r())
|
||||
@@ -2277,6 +2437,8 @@
|
||||
@@ -2277,6 +2440,8 @@
|
||||
if (this.field_147481_N)
|
||||
{
|
||||
p_175690_2_.func_174878_a(p_175690_1_);
|
||||
@@ -514,7 +533,7 @@
|
||||
Iterator<TileEntity> iterator = this.field_147484_a.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
@@ -2295,8 +2457,10 @@
|
||||
@@ -2295,8 +2460,10 @@
|
||||
else
|
||||
{
|
||||
this.func_175700_a(p_175690_2_);
|
||||
@@ -526,7 +545,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2309,6 +2473,8 @@
|
||||
@@ -2309,6 +2476,8 @@
|
||||
{
|
||||
tileentity.func_145843_s();
|
||||
this.field_147484_a.remove(tileentity);
|
||||
@@ -535,7 +554,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2321,6 +2487,7 @@
|
||||
@@ -2321,6 +2490,7 @@
|
||||
|
||||
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
|
||||
}
|
||||
@@ -543,7 +562,7 @@
|
||||
}
|
||||
|
||||
public void func_147457_a(TileEntity p_147457_1_)
|
||||
@@ -2347,7 +2514,7 @@
|
||||
@@ -2347,7 +2517,7 @@
|
||||
if (chunk != null && !chunk.func_76621_g())
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_175677_1_);
|
||||
@@ -552,7 +571,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2370,6 +2537,7 @@
|
||||
@@ -2370,6 +2540,7 @@
|
||||
{
|
||||
this.field_72985_G = p_72891_1_;
|
||||
this.field_72992_H = p_72891_2_;
|
||||
@@ -560,7 +579,7 @@
|
||||
}
|
||||
|
||||
public void func_72835_b()
|
||||
@@ -2379,6 +2547,11 @@
|
||||
@@ -2379,6 +2550,11 @@
|
||||
|
||||
protected void func_72947_a()
|
||||
{
|
||||
@@ -572,7 +591,7 @@
|
||||
if (this.field_72986_A.func_76059_o())
|
||||
{
|
||||
this.field_73004_o = 1.0F;
|
||||
@@ -2392,6 +2565,11 @@
|
||||
@@ -2392,6 +2568,11 @@
|
||||
|
||||
protected void func_72979_l()
|
||||
{
|
||||
@@ -584,7 +603,7 @@
|
||||
if (!this.field_73011_w.func_177495_o())
|
||||
{
|
||||
if (!this.field_72995_K)
|
||||
@@ -2511,6 +2689,11 @@
|
||||
@@ -2511,6 +2692,11 @@
|
||||
|
||||
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
|
||||
{
|
||||
@@ -596,7 +615,7 @@
|
||||
Biome biome = this.func_180494_b(p_175670_1_);
|
||||
float f = biome.func_180626_a(p_175670_1_);
|
||||
|
||||
@@ -2552,6 +2735,11 @@
|
||||
@@ -2552,6 +2738,11 @@
|
||||
|
||||
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
|
||||
{
|
||||
@@ -608,7 +627,7 @@
|
||||
Biome biome = this.func_180494_b(p_175708_1_);
|
||||
float f = biome.func_180626_a(p_175708_1_);
|
||||
|
||||
@@ -2569,7 +2757,7 @@
|
||||
@@ -2569,7 +2760,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_175708_1_);
|
||||
|
||||
@@ -617,7 +636,7 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -2601,10 +2789,11 @@
|
||||
@@ -2601,10 +2792,11 @@
|
||||
else
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_175638_1_);
|
||||
@@ -632,7 +651,15 @@
|
||||
{
|
||||
j = 1;
|
||||
}
|
||||
@@ -2703,7 +2892,7 @@
|
||||
@@ -2638,6 +2830,7 @@
|
||||
|
||||
if (i >= 14)
|
||||
{
|
||||
+ blockpos$pooledmutableblockpos.func_185344_t();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -2703,7 +2896,7 @@
|
||||
int j4 = j2 + enumfacing.func_96559_d();
|
||||
int k4 = k2 + enumfacing.func_82599_e();
|
||||
blockpos$pooledmutableblockpos.func_181079_c(i4, j4, k4);
|
||||
@@ -641,7 +668,7 @@
|
||||
i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos);
|
||||
|
||||
if (i3 == l2 - l4 && j < this.field_72994_J.length)
|
||||
@@ -2811,10 +3000,10 @@
|
||||
@@ -2811,10 +3004,10 @@
|
||||
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate <? super Entity > p_175674_3_)
|
||||
{
|
||||
List<Entity> list = Lists.<Entity>newArrayList();
|
||||
@@ -656,7 +683,7 @@
|
||||
|
||||
for (int i1 = i; i1 <= j; ++i1)
|
||||
{
|
||||
@@ -2867,10 +3056,10 @@
|
||||
@@ -2867,10 +3060,10 @@
|
||||
|
||||
public <T extends Entity> List<T> func_175647_a(Class <? extends T > p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate <? super T > p_175647_3_)
|
||||
{
|
||||
@@ -671,7 +698,7 @@
|
||||
List<T> list = Lists.<T>newArrayList();
|
||||
|
||||
for (int i1 = i; i1 < j; ++i1)
|
||||
@@ -2950,11 +3139,13 @@
|
||||
@@ -2950,11 +3143,13 @@
|
||||
|
||||
public void func_175650_b(Collection<Entity> p_175650_1_)
|
||||
{
|
||||
@@ -688,7 +715,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2967,7 +3158,7 @@
|
||||
@@ -2967,7 +3162,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_175716_2_);
|
||||
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_176223_P().func_185890_d(this, p_175716_2_);
|
||||
@@ -697,7 +724,7 @@
|
||||
}
|
||||
|
||||
public int func_181545_F()
|
||||
@@ -3050,7 +3241,7 @@
|
||||
@@ -3050,7 +3245,7 @@
|
||||
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_)
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
|
||||
@@ -706,7 +733,16 @@
|
||||
}
|
||||
|
||||
public boolean func_175640_z(BlockPos p_175640_1_)
|
||||
@@ -3247,7 +3438,7 @@
|
||||
@@ -3185,7 +3380,7 @@
|
||||
{
|
||||
d2 *= ((Double)Objects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
|
||||
}
|
||||
-
|
||||
+ d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, p_184150_7_);
|
||||
if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
|
||||
{
|
||||
d0 = d1;
|
||||
@@ -3247,7 +3442,7 @@
|
||||
|
||||
public long func_72905_C()
|
||||
{
|
||||
@@ -715,7 +751,7 @@
|
||||
}
|
||||
|
||||
public long func_82737_E()
|
||||
@@ -3257,17 +3448,17 @@
|
||||
@@ -3257,17 +3452,17 @@
|
||||
|
||||
public long func_72820_D()
|
||||
{
|
||||
@@ -736,7 +772,7 @@
|
||||
|
||||
if (!this.func_175723_af().func_177746_a(blockpos))
|
||||
{
|
||||
@@ -3279,7 +3470,7 @@
|
||||
@@ -3279,7 +3474,7 @@
|
||||
|
||||
public void func_175652_B(BlockPos p_175652_1_)
|
||||
{
|
||||
@@ -745,7 +781,7 @@
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -3299,12 +3490,18 @@
|
||||
@@ -3299,12 +3494,18 @@
|
||||
|
||||
if (!this.field_72996_f.contains(p_72897_1_))
|
||||
{
|
||||
@@ -764,7 +800,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3398,8 +3595,7 @@
|
||||
@@ -3398,8 +3599,7 @@
|
||||
|
||||
public boolean func_180502_D(BlockPos p_180502_1_)
|
||||
{
|
||||
@@ -774,7 +810,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -3460,12 +3656,12 @@
|
||||
@@ -3460,12 +3660,12 @@
|
||||
|
||||
public int func_72800_K()
|
||||
{
|
||||
@@ -789,7 +825,7 @@
|
||||
}
|
||||
|
||||
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
|
||||
@@ -3509,7 +3705,7 @@
|
||||
@@ -3509,7 +3709,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double func_72919_O()
|
||||
{
|
||||
@@ -798,7 +834,7 @@
|
||||
}
|
||||
|
||||
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
|
||||
@@ -3543,7 +3739,7 @@
|
||||
@@ -3543,7 +3743,7 @@
|
||||
|
||||
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
|
||||
{
|
||||
@@ -807,7 +843,7 @@
|
||||
{
|
||||
BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing);
|
||||
|
||||
@@ -3551,18 +3747,14 @@
|
||||
@@ -3551,18 +3751,14 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(blockpos);
|
||||
|
||||
@@ -830,7 +866,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3628,6 +3820,112 @@
|
||||
@@ -3628,6 +3824,112 @@
|
||||
return i >= -128 && i <= 128 && j >= -128 && j <= 128;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,15 @@
|
||||
{
|
||||
BlockPos blockpos = func_180621_a(p_77192_1_, chunkpos1.field_77276_a, chunkpos1.field_77275_b);
|
||||
int k1 = blockpos.func_177958_n();
|
||||
@@ -135,7 +137,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
- entityliving = (EntityLiving)biome$spawnlistentry.field_76300_b.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_77192_1_});
|
||||
+ entityliving = (EntityLiving)biome$spawnlistentry.newInstance(p_77192_1_);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -145,8 +147,10 @@
|
||||
|
||||
entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
|
||||
@@ -52,3 +61,12 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -257,7 +262,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
- entityliving = (EntityLiving)biome$spawnlistentry.field_76300_b.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_77191_0_});
|
||||
+ entityliving = (EntityLiving)biome$spawnlistentry.newInstance(p_77191_0_);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -128,7 +128,15 @@
|
||||
{
|
||||
IBlockState iblockstate = this.func_180495_p(p_175654_1_);
|
||||
|
||||
@@ -587,7 +603,7 @@
|
||||
@@ -563,6 +579,7 @@
|
||||
|
||||
public void func_180497_b(BlockPos p_180497_1_, Block p_180497_2_, int p_180497_3_, int p_180497_4_)
|
||||
{
|
||||
+ if (p_180497_2_ == null) return; //Forge: Prevent null blocks from ticking, can happen if blocks are removed in old worlds. TODO: Fix real issue causing block to be null.
|
||||
if (p_180497_1_ instanceof BlockPos.MutableBlockPos || p_180497_1_ instanceof BlockPos.PooledMutableBlockPos)
|
||||
{
|
||||
p_180497_1_ = new BlockPos(p_180497_1_);
|
||||
@@ -587,7 +604,7 @@
|
||||
|
||||
public void func_72939_s()
|
||||
{
|
||||
@@ -137,7 +145,7 @@
|
||||
{
|
||||
if (this.field_80004_Q++ >= 300)
|
||||
{
|
||||
@@ -711,6 +727,9 @@
|
||||
@@ -711,6 +728,9 @@
|
||||
{
|
||||
NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next();
|
||||
iterator.remove();
|
||||
@@ -147,7 +155,7 @@
|
||||
int k = 0;
|
||||
|
||||
if (this.func_175707_a(nextticklistentry1.field_180282_a.func_177982_a(0, 0, 0), nextticklistentry1.field_180282_a.func_177982_a(0, 0, 0)))
|
||||
@@ -837,6 +856,10 @@
|
||||
@@ -837,6 +857,10 @@
|
||||
|
||||
public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_)
|
||||
{
|
||||
@@ -158,7 +166,7 @@
|
||||
return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_);
|
||||
}
|
||||
|
||||
@@ -902,6 +925,7 @@
|
||||
@@ -902,6 +926,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -166,7 +174,7 @@
|
||||
this.field_72987_B = true;
|
||||
BiomeProvider biomeprovider = this.field_73011_w.func_177499_m();
|
||||
List<Biome> list = biomeprovider.func_76932_a();
|
||||
@@ -986,6 +1010,7 @@
|
||||
@@ -986,6 +1011,7 @@
|
||||
}
|
||||
|
||||
chunkproviderserver.func_186027_a(p_73044_1_);
|
||||
@@ -174,7 +182,7 @@
|
||||
|
||||
for (Chunk chunk : Lists.newArrayList(chunkproviderserver.func_189548_a()))
|
||||
{
|
||||
@@ -1030,6 +1055,7 @@
|
||||
@@ -1030,6 +1056,7 @@
|
||||
this.field_72986_A.func_176135_e(this.func_175723_af().func_177732_i());
|
||||
this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_184103_al().func_72378_q());
|
||||
this.field_72988_C.func_75744_a();
|
||||
@@ -182,7 +190,7 @@
|
||||
}
|
||||
|
||||
public boolean func_72838_d(Entity p_72838_1_)
|
||||
@@ -1041,7 +1067,7 @@
|
||||
@@ -1041,7 +1068,7 @@
|
||||
{
|
||||
for (Entity entity : Lists.newArrayList(p_175650_1_))
|
||||
{
|
||||
@@ -191,7 +199,7 @@
|
||||
{
|
||||
this.field_72996_f.add(entity);
|
||||
this.func_72923_a(entity);
|
||||
@@ -1122,7 +1148,7 @@
|
||||
@@ -1122,7 +1149,7 @@
|
||||
{
|
||||
if (super.func_72942_c(p_72942_1_))
|
||||
{
|
||||
@@ -200,7 +208,7 @@
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -1144,6 +1170,7 @@
|
||||
@@ -1144,6 +1171,7 @@
|
||||
public Explosion func_72885_a(@Nullable Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
|
||||
{
|
||||
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
|
||||
@@ -208,7 +216,7 @@
|
||||
explosion.func_77278_a();
|
||||
explosion.func_77279_a(false);
|
||||
|
||||
@@ -1189,7 +1216,7 @@
|
||||
@@ -1189,7 +1217,7 @@
|
||||
{
|
||||
if (this.func_147485_a(blockeventdata))
|
||||
{
|
||||
@@ -217,7 +225,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1215,27 +1242,31 @@
|
||||
@@ -1215,27 +1243,31 @@
|
||||
|
||||
if (this.field_73003_n != this.field_73004_o)
|
||||
{
|
||||
@@ -255,7 +263,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1314,6 +1345,11 @@
|
||||
@@ -1314,6 +1346,11 @@
|
||||
return this.field_73061_a.func_152345_ab();
|
||||
}
|
||||
|
||||
|
||||
@@ -134,3 +134,40 @@
|
||||
public static void func_185358_q()
|
||||
{
|
||||
func_185354_a(0, "ocean", new BiomeOcean((new Biome.BiomeProperties("Ocean")).func_185398_c(-1.0F).func_185400_d(0.1F)));
|
||||
@@ -547,6 +625,7 @@
|
||||
public Class <? extends EntityLiving > field_76300_b;
|
||||
public int field_76301_c;
|
||||
public int field_76299_d;
|
||||
+ private final java.lang.reflect.Constructor<?> ctr;
|
||||
|
||||
public SpawnListEntry(Class <? extends EntityLiving > p_i1970_1_, int p_i1970_2_, int p_i1970_3_, int p_i1970_4_)
|
||||
{
|
||||
@@ -554,12 +633,28 @@
|
||||
this.field_76300_b = p_i1970_1_;
|
||||
this.field_76301_c = p_i1970_3_;
|
||||
this.field_76299_d = p_i1970_4_;
|
||||
+
|
||||
+ java.lang.reflect.Constructor<?> tmp = null;
|
||||
+ try
|
||||
+ {
|
||||
+ tmp = p_i1970_1_.getConstructor(World.class);
|
||||
+ }
|
||||
+ catch (NoSuchMethodException e)
|
||||
+ {
|
||||
+ com.google.common.base.Throwables.propagate(e);
|
||||
+ }
|
||||
+ ctr = tmp;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.field_76300_b.getSimpleName() + "*(" + this.field_76301_c + "-" + this.field_76299_d + "):" + this.field_76292_a;
|
||||
}
|
||||
+
|
||||
+ public EntityLiving newInstance(World world) throws Exception
|
||||
+ {
|
||||
+ return (EntityLiving)ctr.newInstance(world);
|
||||
+ }
|
||||
}
|
||||
|
||||
public static enum TempCategory
|
||||
@@ -0,0 +1,39 @@
|
||||
--- ../src-base/minecraft/net/minecraft/world/chunk/BlockStateContainer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/chunk/BlockStateContainer.java
|
||||
@@ -30,6 +30,10 @@
|
||||
|
||||
private void func_186012_b(int p_186012_1_)
|
||||
{
|
||||
+ setBits(p_186012_1_, false);
|
||||
+ }
|
||||
+ private void setBits(int p_186012_1_, boolean forceBits)
|
||||
+ {
|
||||
if (p_186012_1_ != this.field_186024_e)
|
||||
{
|
||||
this.field_186024_e = p_186012_1_;
|
||||
@@ -47,6 +51,8 @@
|
||||
{
|
||||
this.field_186022_c = field_186023_d;
|
||||
this.field_186024_e = MathHelper.func_151241_e(Block.field_176229_d.func_186804_a());
|
||||
+ if (forceBits)
|
||||
+ this.field_186024_e = p_186012_1_;
|
||||
}
|
||||
|
||||
this.field_186022_c.func_186041_a(field_186020_a);
|
||||
@@ -102,11 +108,15 @@
|
||||
|
||||
if (this.field_186024_e != i)
|
||||
{
|
||||
- this.func_186012_b(i);
|
||||
+ this.setBits(i, true); //Forge, Force bit density to fix network issues, resize below if needed.
|
||||
}
|
||||
|
||||
this.field_186022_c.func_186038_a(p_186010_1_);
|
||||
p_186010_1_.func_186873_b(this.field_186021_b.func_188143_a());
|
||||
+
|
||||
+ int regSize = MathHelper.func_151241_e(Block.field_176229_d.func_186804_a());
|
||||
+ if (this.field_186022_c == field_186023_d && this.field_186024_e != regSize) // Resize bits to fit registry.
|
||||
+ this.func_186008_a(regSize, field_186020_a);
|
||||
}
|
||||
|
||||
public void func_186009_b(PacketBuffer p_186009_1_)
|
||||
@@ -117,6 +117,7 @@ import com.google.common.collect.Sets;
|
||||
|
||||
public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
private static boolean firstLoad = Boolean.parseBoolean(System.getProperty("fml.skipFirstModelBake", "true"));
|
||||
private final Map<ModelResourceLocation, IModel> stateModels = Maps.newHashMap();
|
||||
private final Set<ModelResourceLocation> missingVariants = Sets.newHashSet();
|
||||
private final Map<ResourceLocation, Exception> loadingExceptions = Maps.newHashMap();
|
||||
@@ -168,6 +169,16 @@ public final class ModelLoader extends ModelBakery
|
||||
HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
|
||||
Multimaps.invertFrom(Multimaps.forMap(stateModels), models);
|
||||
|
||||
if (firstLoad)
|
||||
{
|
||||
firstLoad = false;
|
||||
for (ModelResourceLocation mrl : stateModels.keySet())
|
||||
{
|
||||
bakedRegistry.putObject(mrl, missingBaked);
|
||||
}
|
||||
return bakedRegistry;
|
||||
}
|
||||
|
||||
ProgressBar bakeBar = ProgressManager.push("ModelLoader: baking", models.keySet().size());
|
||||
|
||||
for(IModel model : models.keySet())
|
||||
|
||||
@@ -470,7 +470,10 @@ public class ForgeChunkManager
|
||||
return;
|
||||
}
|
||||
|
||||
dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, Chunk>build());
|
||||
if (dormantChunkCacheSize != 0)
|
||||
{ // only put into cache if we're using dormant chunk caching
|
||||
dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, Chunk>build());
|
||||
}
|
||||
WorldServer worldServer = (WorldServer) world;
|
||||
File chunkDir = worldServer.getChunkSaveLocation();
|
||||
File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");
|
||||
@@ -615,7 +618,10 @@ public class ForgeChunkManager
|
||||
}
|
||||
|
||||
forcedChunks.remove(world);
|
||||
dormantChunkCache.remove(world);
|
||||
if (dormantChunkCacheSize != 0) // only if in use
|
||||
{
|
||||
dormantChunkCache.remove(world);
|
||||
}
|
||||
// integrated server is shutting down
|
||||
if (!FMLCommonHandler.instance().getMinecraftServerInstance().isServerRunning())
|
||||
{
|
||||
@@ -959,6 +965,7 @@ public class ForgeChunkManager
|
||||
|
||||
public static void putDormantChunk(long coords, Chunk chunk)
|
||||
{
|
||||
if (dormantChunkCacheSize == 0) return; // Skip if we're not dormant caching chunks
|
||||
Cache<Long, Chunk> cache = dormantChunkCache.get(chunk.getWorld());
|
||||
if (cache != null)
|
||||
{
|
||||
@@ -968,6 +975,7 @@ public class ForgeChunkManager
|
||||
|
||||
public static Chunk fetchDormantChunk(long coords, World world)
|
||||
{
|
||||
if (dormantChunkCacheSize == 0) return null; // Don't bother with maps at all if its never gonna get a response
|
||||
Cache<Long, Chunk> cache = dormantChunkCache.get(world);
|
||||
if (cache == null)
|
||||
{
|
||||
|
||||
@@ -115,6 +115,7 @@ import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
|
||||
import net.minecraftforge.event.entity.living.LootingLevelEvent;
|
||||
import net.minecraftforge.event.entity.player.AnvilRepairEvent;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.NoteBlockEvent;
|
||||
@@ -540,6 +541,14 @@ public class ForgeHooks
|
||||
return event.getLootingLevel();
|
||||
}
|
||||
|
||||
public static double getPlayerVisibilityDistance(EntityPlayer player, double xzDistance, double maxXZDistance)
|
||||
{
|
||||
PlayerEvent.Visibility event = new PlayerEvent.Visibility(player);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
double value = event.getVisibilityModifier() * xzDistance;
|
||||
return value >= maxXZDistance ? maxXZDistance : value;
|
||||
}
|
||||
|
||||
public static boolean isLivingOnLadder(IBlockState state, World world, BlockPos pos, EntityLivingBase entity)
|
||||
{
|
||||
boolean isSpectator = (entity instanceof EntityPlayer && ((EntityPlayer)entity).isSpectator());
|
||||
@@ -1163,7 +1172,7 @@ public class ForgeHooks
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new ThrowableImpactEvent(throwable, ray));
|
||||
}
|
||||
|
||||
|
||||
public static boolean onCropsGrowPre(World worldIn, BlockPos pos, IBlockState state, boolean def)
|
||||
{
|
||||
BlockEvent ev = new BlockEvent.CropGrowEvent.Pre(worldIn,pos,state);
|
||||
|
||||
@@ -110,6 +110,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
|
||||
public static boolean replaceVanillaBucketModel = true;
|
||||
public static long java8Reminder = 0;
|
||||
public static boolean disableStairSlabCulling = false; // Also known as the "DontCullStairsBecauseIUseACrappyTexturePackThatBreaksBasicBlockShapesSoICantTrustBasicBlockCulling" flag
|
||||
public static boolean alwaysSetupTerrainOffThread = false; // In RenderGlobal.setupTerrain, always force the chunk render updates to be queued to the thread
|
||||
|
||||
private static Configuration config;
|
||||
private static ForgeModContainer INSTANCE;
|
||||
@@ -296,6 +297,13 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
|
||||
prop.setLanguageKey("forge.configgui.disableStairSlabCulling").setRequiresMcRestart(false);
|
||||
propOrder.add(prop.getName());
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_CLIENT, "alwaysSetupTerrainOffThread", Boolean.FALSE,
|
||||
"Enable forge to queue all chunk updates to the Chunk Update thread. May increase FPS significantly, but may also cause weird rendering lag. Not recommended for computers " +
|
||||
"without a significant number of cores available.");
|
||||
alwaysSetupTerrainOffThread = prop.getBoolean(Boolean.FALSE);
|
||||
prop.setLanguageKey("forge.configgui.alwaysSetupTerrainOffThread");
|
||||
propOrder.add(prop.getName());
|
||||
|
||||
config.setCategoryPropertyOrder(CATEGORY_CLIENT, propOrder);
|
||||
|
||||
if (config.hasChanged())
|
||||
@@ -320,30 +328,22 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
|
||||
{
|
||||
if (getMetadata().modId.equals(event.getModID()))
|
||||
{
|
||||
if (!event.isWorldRunning())
|
||||
if ("chunkLoader".equals(event.getConfigID()))
|
||||
{
|
||||
if (Configuration.CATEGORY_GENERAL.equals(event.getConfigID()))
|
||||
{
|
||||
syncConfig(false);
|
||||
}
|
||||
else if ("chunkLoader".equals(event.getConfigID()))
|
||||
{
|
||||
ForgeChunkManager.syncConfigDefaults();
|
||||
ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
else if (VERSION_CHECK_CAT.equals(event.getConfigID()))
|
||||
{
|
||||
syncConfig(false);
|
||||
}
|
||||
ForgeChunkManager.syncConfigDefaults();
|
||||
ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean tmp = config.get(Configuration.CATEGORY_CLIENT, "disableStairSlabCulling", disableStairSlabCulling).getBoolean();
|
||||
if (disableStairSlabCulling != tmp)
|
||||
boolean tmpStairs = disableStairSlabCulling;
|
||||
|
||||
syncConfig(false);
|
||||
|
||||
if (event.isWorldRunning() && tmpStairs != disableStairSlabCulling)
|
||||
{
|
||||
disableStairSlabCulling = tmp;
|
||||
FMLCommonHandler.instance().reloadRenderers();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ForgeVersion
|
||||
//This number is incremented every minecraft release, never reset
|
||||
public static final int minorVersion = 18;
|
||||
//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 = 2;
|
||||
public static final int revisionVersion = 3;
|
||||
//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;
|
||||
// This is the minecraft version we're building for - used in various places in Forge/FML code
|
||||
|
||||
@@ -62,6 +62,7 @@ import net.minecraftforge.fml.client.config.IConfigElement;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.FMLInjectionData;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
/**
|
||||
* This class offers advanced configurations capabilities, allowing to provide
|
||||
@@ -1055,20 +1056,8 @@ public class Configuration
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (buffer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
buffer.close();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
if (input != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
input.close();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
IOUtils.closeQuietly(buffer);
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
||||
resetChangedState();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class Java6Utils
|
||||
{
|
||||
/**
|
||||
* {@link ZipFile} does not implement {@link Closeable} on Java 6.
|
||||
* This method is the same as {@link IOUtils#closeQuietly(Closeable)} but works on {@link ZipFile} on Java 6.
|
||||
*/
|
||||
public static void closeZipQuietly(@Nullable ZipFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (file != null)
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,8 +126,8 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
|
||||
*/
|
||||
public static class Item extends AttachCapabilitiesEvent<net.minecraft.item.Item>
|
||||
{
|
||||
@Deprecated
|
||||
private final net.minecraft.item.ItemStack stack;
|
||||
@Deprecated
|
||||
private final net.minecraft.item.Item item;
|
||||
public Item(net.minecraft.item.Item item, net.minecraft.item.ItemStack stack)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
* Event for when an Enderman teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright.
|
||||
* Event for when an Enderman/Shulker teleports or an ender pearl is used. Can be used to either modify the target position, or cancel the teleport outright.
|
||||
* @author Mithion
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -351,4 +351,36 @@ public class PlayerEvent extends LivingEvent
|
||||
return playerUUID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the world checks if a player is near enough to be attacked by an entity.
|
||||
* The resulting visibility modifier is multiplied by the one calculated by Minecraft (based on sneaking and more) and used to calculate the radius a player has to be in (targetDistance*modifier).
|
||||
* This can also be used to increase the visibility of a player, if it was decreased by Minecraft or other mods. But the resulting value cannot be higher than the standard target distance.
|
||||
*/
|
||||
public static class Visibility extends PlayerEvent
|
||||
{
|
||||
|
||||
private double visibilityModifier = 1D;
|
||||
|
||||
public Visibility(EntityPlayer player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mod Is multiplied with the current modifier
|
||||
*/
|
||||
public void modifyVisibility(double mod)
|
||||
{
|
||||
visibilityModifier *= mod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current modifier
|
||||
*/
|
||||
public double getVisibilityModifier()
|
||||
{
|
||||
return visibilityModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This event is fired after {@link Entity#pushOutOfBlocks(double, double, double)} calls {@link World#getCollisionBoxes(AxisAlignedBB)}
|
||||
* and before returning the list in {@link World#getCollisionBoxes(Entity, AxisAlignedBB)}<br>
|
||||
* <br>
|
||||
* {@link #entity} contains the entity calling {@link Entity#pushOutOfBlocks(double, double, double)} or the entity passed in the {@link World#getCollisionBoxes(Entity, AxisAlignedBB)}. <b>Can be null.</b><br>
|
||||
* {@link #aabb} contains the AxisAlignedBB passed in the method.<br>
|
||||
* {@link #collisionBoxesList} contains the list of detected collision boxes intersecting with {@link #aabb}. The list can be modified.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult} <br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public class GetCollisionBoxesEvent extends WorldEvent
|
||||
{
|
||||
private final Entity entity;
|
||||
private final AxisAlignedBB aabb;
|
||||
private final List<AxisAlignedBB> collisionBoxesList;
|
||||
|
||||
public GetCollisionBoxesEvent(World world, @Nullable Entity entity, AxisAlignedBB aabb, List<AxisAlignedBB> collisionBoxesList)
|
||||
{
|
||||
super(world);
|
||||
this.entity = entity;
|
||||
this.aabb = aabb;
|
||||
this.collisionBoxesList = collisionBoxesList;
|
||||
}
|
||||
|
||||
public Entity getEntity()
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getAabb()
|
||||
{
|
||||
return aabb;
|
||||
}
|
||||
|
||||
public List<AxisAlignedBB> getCollisionBoxesList()
|
||||
{
|
||||
return collisionBoxesList;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.fml.client;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -103,6 +104,7 @@ import net.minecraftforge.fml.common.registry.PersistentRegistryManager;
|
||||
import net.minecraftforge.fml.common.toposort.ModSortingException;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -290,9 +292,17 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader());
|
||||
String optifineVersion = (String) optifineConfig.getField("VERSION").get(null);
|
||||
Map<String,Object> dummyOptifineMeta = ImmutableMap.<String,Object>builder().put("name", "Optifine").put("version", optifineVersion).build();
|
||||
ModMetadata optifineMetadata = MetadataCollection.from(getClass().getResourceAsStream("optifinemod.info"),"optifine").getMetadataForId("optifine", dummyOptifineMeta);
|
||||
optifineContainer = new DummyModContainer(optifineMetadata);
|
||||
FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features",optifineContainer.getVersion());
|
||||
InputStream optifineModInfoInputStream = getClass().getResourceAsStream("optifinemod.info");
|
||||
try
|
||||
{
|
||||
ModMetadata optifineMetadata = MetadataCollection.from(optifineModInfoInputStream, "optifine").getMetadataForId("optifine", dummyOptifineMeta);
|
||||
optifineContainer = new DummyModContainer(optifineMetadata);
|
||||
FMLLog.info("Forge Mod Loader has detected optifine %s, enabling compatibility features", optifineContainer.getVersion());
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(optifineModInfoInputStream);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -1046,4 +1056,10 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new ModelRegistryEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayVSyncForced()
|
||||
{
|
||||
return SplashProgress.isDisplayVSyncForced;
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,10 @@ public class SplashProgress
|
||||
private static int barBorderColor;
|
||||
private static int barColor;
|
||||
private static int barBackgroundColor;
|
||||
static boolean isDisplayVSyncForced = false;
|
||||
private static final int TIMING_FRAME_COUNT = 200;
|
||||
private static final int TIMING_FRAME_THRESHOLD = TIMING_FRAME_COUNT * 5 * 1000000; // 5 ms per frame, scaled to nanos
|
||||
|
||||
static final Semaphore mutex = new Semaphore(1);
|
||||
|
||||
private static String getString(String name, String def)
|
||||
@@ -240,7 +244,8 @@ public class SplashProgress
|
||||
private final int barHeight = 20;
|
||||
private final int textHeight2 = 20;
|
||||
private final int barOffset = 55;
|
||||
|
||||
private long updateTiming;
|
||||
private long framecount;
|
||||
public void run()
|
||||
{
|
||||
setGL();
|
||||
@@ -252,6 +257,7 @@ public class SplashProgress
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
while(!done)
|
||||
{
|
||||
framecount++;
|
||||
ProgressBar first = null, penult = null, last = null;
|
||||
Iterator<ProgressBar> i = ProgressManager.barIterator();
|
||||
while(i.hasNext())
|
||||
@@ -348,16 +354,40 @@ public class SplashProgress
|
||||
// is trying to impose a framerate or other thing is occurring. Without the mutex, the main
|
||||
// thread would delay waiting for the same global display lock
|
||||
mutex.acquireUninterruptibly();
|
||||
long updateStart = System.nanoTime();
|
||||
Display.update();
|
||||
// As soon as we're done, we release the mutex. The other thread can now ping the processmessages
|
||||
// call as often as it wants until we get get back here again
|
||||
long dur = System.nanoTime() - updateStart;
|
||||
if (framecount < TIMING_FRAME_COUNT) {
|
||||
updateTiming += dur;
|
||||
}
|
||||
mutex.release();
|
||||
if(pause)
|
||||
{
|
||||
clearGL();
|
||||
setGL();
|
||||
}
|
||||
Display.sync(100);
|
||||
// Such a hack - if the time taken is greater than 10 milliseconds, we're gonna guess that we're on a
|
||||
// system where vsync is forced through the swapBuffers call - so we have to force a sleep and let the
|
||||
// loading thread have a turn - some badly designed mods access Keyboard and therefore GlobalLock.lock
|
||||
// during splash screen, and mutex against the above Display.update call as a result.
|
||||
// 4 milliseconds is a guess - but it should be enough to trigger in most circumstances. (Maybe if
|
||||
// 240FPS is possible, this won't fire?)
|
||||
if (framecount >= TIMING_FRAME_COUNT && updateTiming > TIMING_FRAME_THRESHOLD) {
|
||||
if (!isDisplayVSyncForced)
|
||||
{
|
||||
isDisplayVSyncForced = true;
|
||||
FMLLog.log(Level.INFO, "Using alternative sync timing : %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming);
|
||||
}
|
||||
try { Thread.sleep(16); } catch (InterruptedException ie) {}
|
||||
} else
|
||||
{
|
||||
if (framecount ==TIMING_FRAME_COUNT) {
|
||||
FMLLog.log(Level.INFO, "Using sync timing. %d frames of Display.update took %d nanos", TIMING_FRAME_COUNT, updateTiming);
|
||||
}
|
||||
Display.sync(100);
|
||||
}
|
||||
}
|
||||
clearGL();
|
||||
}
|
||||
|
||||
@@ -1507,9 +1507,9 @@ public class GuiConfigEntries extends GuiListExtended
|
||||
comment = I18n.format(configElement.getLanguageKey() + ".tooltip").replace("\\n", "\n");
|
||||
|
||||
if (!comment.equals(configElement.getLanguageKey() + ".tooltip"))
|
||||
Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + comment).split("\n"));
|
||||
Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + removeTag(comment, "[default:", "]")).split("\n"));
|
||||
else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty())
|
||||
Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + configElement.getComment()).split("\n"));
|
||||
Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.YELLOW + removeTag(configElement.getComment(), "[default:", "]")).split("\n"));
|
||||
else
|
||||
Collections.addAll(toolTip, (TextFormatting.GREEN + name + "\n" + TextFormatting.RED + "No tooltip defined.").split("\n"));
|
||||
|
||||
@@ -1665,6 +1665,23 @@ public class GuiConfigEntries extends GuiListExtended
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Get string surrounding tagged area.
|
||||
*/
|
||||
private String removeTag(String target, String tagStart, String tagEnd)
|
||||
{
|
||||
int tagStartPosition = tagStartPosition = target.indexOf(tagStart);
|
||||
int tagEndPosition = tagEndPosition = target.indexOf(tagEnd, tagStartPosition + tagStart.length());
|
||||
|
||||
if (-1 == tagStartPosition || -1 == tagEndPosition)
|
||||
return target;
|
||||
|
||||
String taglessResult = target.substring(0, tagStartPosition);
|
||||
taglessResult += target.substring(tagEndPosition + 1, target.length());
|
||||
|
||||
return taglessResult;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -751,4 +751,6 @@ public class FMLCommonHandler
|
||||
{
|
||||
sidedDelegate.fireSidedRegistryEvents();
|
||||
}
|
||||
|
||||
public boolean isDisplayVSyncForced() { return sidedDelegate.isDisplayVSyncForced(); }
|
||||
}
|
||||
@@ -20,6 +20,7 @@ package net.minecraftforge.fml.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -53,6 +54,7 @@ import net.minecraftforge.fml.common.versioning.VersionParser;
|
||||
import net.minecraftforge.fml.common.versioning.VersionRange;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
@@ -286,7 +288,15 @@ public class FMLModContainer implements ModContainer
|
||||
if (versionFile != null)
|
||||
{
|
||||
version = new Properties();
|
||||
version.load(source.getInputStream(versionFile));
|
||||
InputStream sourceInputStream = source.getInputStream(versionFile);
|
||||
try
|
||||
{
|
||||
version.load(sourceInputStream);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(sourceInputStream);
|
||||
}
|
||||
}
|
||||
source.close();
|
||||
}
|
||||
@@ -297,8 +307,14 @@ public class FMLModContainer implements ModContainer
|
||||
{
|
||||
version = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propsFile);
|
||||
version.load(fis);
|
||||
fis.close();
|
||||
try
|
||||
{
|
||||
version.load(fis);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(fis);
|
||||
}
|
||||
}
|
||||
}
|
||||
return version;
|
||||
|
||||
@@ -77,4 +77,6 @@ public interface IFMLSidedHandler
|
||||
void reloadRenderers();
|
||||
|
||||
void fireSidedRegistryEvents();
|
||||
|
||||
boolean isDisplayVSyncForced();
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -59,6 +60,7 @@ import net.minecraftforge.fml.common.versioning.VersionParser;
|
||||
import net.minecraftforge.fml.relauncher.ModListHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
@@ -213,7 +215,15 @@ public class Loader
|
||||
}
|
||||
|
||||
minecraft = new MinecraftDummyContainer(MC_VERSION);
|
||||
mcp = new MCPDummyContainer(MetadataCollection.from(getClass().getResourceAsStream("/mcpmod.info"), "MCP").getMetadataForId("mcp", null));
|
||||
InputStream mcpModInputStream = getClass().getResourceAsStream("/mcpmod.info");
|
||||
try
|
||||
{
|
||||
mcp = new MCPDummyContainer(MetadataCollection.from(mcpModInputStream, "MCP").getMetadataForId("mcp", null));
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(mcpModInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.google.common.base.Joiner;
|
||||
public class ProgressManager
|
||||
{
|
||||
private static final List<ProgressBar> bars = new CopyOnWriteArrayList<ProgressBar>();
|
||||
|
||||
/**
|
||||
* Not a fully fleshed out API, may change in future MC versions.
|
||||
* However feel free to use and suggest additions.
|
||||
@@ -57,7 +56,9 @@ public class ProgressManager
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isDisplayVSyncForced() {
|
||||
return FMLCommonHandler.instance().isDisplayVSyncForced();
|
||||
}
|
||||
/**
|
||||
* Not a fully fleshed out API, may change in future MC versions.
|
||||
* However feel free to use and suggest additions.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package net.minecraftforge.fml.common.asm;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.security.CodeSource;
|
||||
import java.security.cert.Certificate;
|
||||
@@ -28,6 +28,8 @@ import java.util.Map;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import net.minecraftforge.common.util.Java6Utils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
@@ -113,7 +115,15 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||
mcJarFile = new JarFile(mcPath,true);
|
||||
mcJarFile.getManifest();
|
||||
JarEntry cbrEntry = mcJarFile.getJarEntry("net/minecraft/client/ClientBrandRetriever.class");
|
||||
ByteStreams.toByteArray(mcJarFile.getInputStream(cbrEntry));
|
||||
InputStream mcJarFileInputStream = mcJarFile.getInputStream(cbrEntry);
|
||||
try
|
||||
{
|
||||
ByteStreams.toByteArray(mcJarFileInputStream);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(mcJarFileInputStream);
|
||||
}
|
||||
Certificate[] certificates = cbrEntry.getCertificates();
|
||||
certCount = certificates != null ? certificates.length : 0;
|
||||
if (certificates!=null)
|
||||
@@ -136,17 +146,7 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (mcJarFile != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
mcJarFile.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
// Noise
|
||||
}
|
||||
}
|
||||
Java6Utils.closeZipQuietly(mcJarFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+3
-21
@@ -45,6 +45,7 @@ import java.util.zip.ZipOutputStream;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -469,27 +470,8 @@ public class AccessTransformer implements IClassTransformer
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (outJar != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
outJar.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (inJar != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
inJar.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
IOUtils.closeQuietly(outJar);
|
||||
IOUtils.closeQuietly(inJar);
|
||||
}
|
||||
}
|
||||
Multimap<String, Modifier> getModifiers()
|
||||
|
||||
+3
-21
@@ -35,6 +35,7 @@ import java.util.zip.ZipOutputStream;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
@@ -269,27 +270,8 @@ public class MarkerTransformer implements IClassTransformer
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (outJar != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
outJar.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (inJar != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
inJar.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
IOUtils.closeQuietly(outJar);
|
||||
IOUtils.closeQuietly(inJar);
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -21,18 +21,30 @@ package net.minecraftforge.fml.common.asm.transformers.deobf;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.FieldVisitor;
|
||||
import org.objectweb.asm.Handle;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
import org.objectweb.asm.commons.RemappingClassAdapter;
|
||||
import org.objectweb.asm.commons.RemappingMethodAdapter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FMLRemappingAdapter extends RemappingClassAdapter {
|
||||
public FMLRemappingAdapter(ClassVisitor cv)
|
||||
{
|
||||
super(cv, FMLDeobfuscatingRemapper.INSTANCE);
|
||||
}
|
||||
|
||||
private static final List<Handle> META_FACTORIES = Arrays.asList(
|
||||
new Handle(Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory",
|
||||
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"),
|
||||
new Handle(Opcodes.H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "altMetafactory",
|
||||
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;")
|
||||
);
|
||||
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
|
||||
{
|
||||
@@ -89,5 +101,18 @@ public class FMLRemappingAdapter extends RemappingClassAdapter {
|
||||
mv.visitFieldInsn(opcode, type, fieldName, newDesc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs)
|
||||
{
|
||||
if (META_FACTORIES.contains(bsm))
|
||||
{
|
||||
String owner = Type.getReturnType(desc).getInternalName();
|
||||
String odesc = ((Type) bsmArgs[0]).getDescriptor(); // First constant argument is "samMethodType - Signature and return type of method to be implemented by the function object."
|
||||
name = remapper.mapMethodName(owner, name, odesc);
|
||||
}
|
||||
|
||||
super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.ModContainerFactory;
|
||||
import net.minecraftforge.fml.common.discovery.asm.ASMModParser;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
@@ -73,8 +74,14 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
|
||||
try
|
||||
{
|
||||
FileInputStream fis = new FileInputStream(metadata);
|
||||
mc = MetadataCollection.from(fis,modDir.getName());
|
||||
fis.close();
|
||||
try
|
||||
{
|
||||
mc = MetadataCollection.from(fis, modDir.getName());
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(fis);
|
||||
}
|
||||
FMLLog.fine("Found an mcmod.info file in directory %s", modDir.getName());
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -101,11 +108,11 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
|
||||
if (match.matches())
|
||||
{
|
||||
ASMModParser modParser = null;
|
||||
FileInputStream fis = null;
|
||||
try
|
||||
{
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
fis = new FileInputStream(file);
|
||||
modParser = new ASMModParser(fis);
|
||||
fis.close();
|
||||
candidate.addClassEntry(path+file.getName());
|
||||
}
|
||||
catch (LoaderException e)
|
||||
@@ -115,7 +122,11 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwables.propagate(e);
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(fis);
|
||||
}
|
||||
|
||||
modParser.validate();
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
|
||||
package net.minecraftforge.fml.common.discovery;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import net.minecraftforge.common.util.Java6Utils;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.LoaderException;
|
||||
import net.minecraftforge.fml.common.MetadataCollection;
|
||||
@@ -30,6 +32,7 @@ import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.ModContainerFactory;
|
||||
import net.minecraftforge.fml.common.discovery.asm.ASMModParser;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
@@ -54,7 +57,15 @@ public class JarDiscoverer implements ITypeDiscoverer
|
||||
if (modInfo != null)
|
||||
{
|
||||
FMLLog.finer("Located mcmod.info file in file %s", candidate.getModContainer().getName());
|
||||
mc = MetadataCollection.from(jar.getInputStream(modInfo), candidate.getModContainer().getName());
|
||||
InputStream inputStream = jar.getInputStream(modInfo);
|
||||
try
|
||||
{
|
||||
mc = MetadataCollection.from(inputStream, candidate.getModContainer().getName());
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,7 +84,15 @@ public class JarDiscoverer implements ITypeDiscoverer
|
||||
ASMModParser modParser;
|
||||
try
|
||||
{
|
||||
modParser = new ASMModParser(jar.getInputStream(ze));
|
||||
InputStream inputStream = jar.getInputStream(ze);
|
||||
try
|
||||
{
|
||||
modParser = new ASMModParser(inputStream);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
}
|
||||
candidate.addClassEntry(ze.getName());
|
||||
}
|
||||
catch (LoaderException e)
|
||||
@@ -101,16 +120,7 @@ public class JarDiscoverer implements ITypeDiscoverer
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (jar != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
jar.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
Java6Utils.closeZipQuietly(jar);
|
||||
}
|
||||
return foundMods;
|
||||
}
|
||||
|
||||
+6
-4
@@ -529,10 +529,12 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
else
|
||||
{
|
||||
List<Packet<INetHandlerPlayClient>> parts = ((FMLProxyPacket)msg).toS3FPackets();
|
||||
for (Packet<INetHandlerPlayClient> pkt : parts)
|
||||
int sizeMinusOne = parts.size() - 1;
|
||||
for (int i = 0; i < sizeMinusOne; i++)
|
||||
{
|
||||
ctx.write(pkt, promise);
|
||||
ctx.write(parts.get(i), ctx.voidPromise());
|
||||
}
|
||||
ctx.write(parts.get(sizeMinusOne), promise);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -583,7 +585,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
if (!(cause instanceof ClosedChannelException))
|
||||
{
|
||||
// Mute the reset by peer exception - it's disconnection noise
|
||||
if (cause.getMessage().contains("Connection reset by peer"))
|
||||
if (cause.getMessage() != null && cause.getMessage().contains("Connection reset by peer"))
|
||||
{
|
||||
FMLLog.log(Level.DEBUG, cause, "Muted NetworkDispatcher exception");
|
||||
}
|
||||
@@ -645,7 +647,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
{
|
||||
throw new IOException("Received FML MultiPart packet out of order, Expected " + part_expected + " Got " + part);
|
||||
}
|
||||
int len = input.readableBytes() - 1;
|
||||
int len = input.readableBytes();
|
||||
input.readBytes(data, offset, len);
|
||||
part_expected++;
|
||||
offset += len;
|
||||
|
||||
@@ -143,7 +143,7 @@ public class FMLProxyPacket implements Packet<INetHandler> {
|
||||
return new CPacketCustomPayload(channel, payload);
|
||||
}
|
||||
|
||||
static final int PART_SIZE = 0x1000000 - 0x50; // Make it a constant so that it gets inlined below.
|
||||
static final int PART_SIZE = 0x100000 - 0x50; // Make it a constant so that it gets inlined below.
|
||||
// FIXME int overflow
|
||||
public static final int MAX_LENGTH = PART_SIZE * 255;
|
||||
public List<Packet<INetHandlerPlayClient>> toS3FPackets() throws IOException
|
||||
|
||||
@@ -21,6 +21,7 @@ package net.minecraftforge.fml.common.patcher;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -30,6 +31,7 @@ import java.util.jar.JarFile;
|
||||
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||
import net.minecraftforge.fml.repackage.com.nothome.delta.Delta;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
@@ -40,6 +42,8 @@ import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class GenDiffSet {
|
||||
|
||||
private static final List<String> RESERVED_NAMES = Arrays.asList("CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9");
|
||||
@@ -78,8 +82,7 @@ public class GenDiffSet {
|
||||
String sourceClassName = name.replace('/', '.');
|
||||
String targetClassName = remapper.map(name).replace('/', '.');
|
||||
JarEntry entry = sourceZip.getJarEntry(jarName);
|
||||
|
||||
byte[] vanillaBytes = entry != null ? ByteStreams.toByteArray(sourceZip.getInputStream(entry)) : new byte[0];
|
||||
byte[] vanillaBytes = toByteArray(sourceZip, entry);
|
||||
byte[] patchedBytes = Files.toByteArray(targetFile);
|
||||
|
||||
byte[] diff = delta.compute(vanillaBytes, patchedBytes);
|
||||
@@ -117,4 +120,21 @@ public class GenDiffSet {
|
||||
sourceZip.close();
|
||||
}
|
||||
|
||||
private static byte[] toByteArray(JarFile sourceZip, @Nullable JarEntry entry) throws IOException
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
InputStream sourceZipInputStream = sourceZip.getInputStream(entry);
|
||||
try
|
||||
{
|
||||
return ByteStreams.toByteArray(sourceZipInputStream);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(sourceZipInputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ package net.minecraftforge.fml.common.versioning;
|
||||
|
||||
public class DefaultArtifactVersion implements ArtifactVersion
|
||||
{
|
||||
|
||||
private ComparableVersion comparableVersion;
|
||||
private String label;
|
||||
private boolean unbounded;
|
||||
@@ -71,7 +70,7 @@ public class DefaultArtifactVersion implements ArtifactVersion
|
||||
@Override
|
||||
public boolean containsVersion(ArtifactVersion source)
|
||||
{
|
||||
if (!source.getLabel().equals(getLabel()))
|
||||
if (source.getLabel() != null && !source.getLabel().equals(getLabel()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.FileFilter;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -55,6 +56,7 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.Name;
|
||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex;
|
||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
@@ -464,9 +466,19 @@ public class CoreModManager {
|
||||
try
|
||||
{
|
||||
Files.createParentDirs(target);
|
||||
FileOutputStream targ = new FileOutputStream(target);
|
||||
ByteStreams.copy(jar.getInputStream(jarEntry), targ);
|
||||
targ.close();
|
||||
FileOutputStream targetOutputStream = null;
|
||||
InputStream jarInputStream = null;
|
||||
try
|
||||
{
|
||||
targetOutputStream = new FileOutputStream(target);
|
||||
jarInputStream = jar.getInputStream(jarEntry);
|
||||
ByteStreams.copy(jarInputStream, targetOutputStream);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(targetOutputStream);
|
||||
IOUtils.closeQuietly(jarInputStream);
|
||||
}
|
||||
FMLRelaunchLog.log(Level.DEBUG, "Extracted ContainedDep %s from %s to %s", dep, jar.getName(), target.getCanonicalPath());
|
||||
result.put(dep,target);
|
||||
} catch (IOException e)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.fml.repackage.com.nothome.delta;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import static net.minecraftforge.fml.repackage.com.nothome.delta.GDiffWriter.COPY_INT_INT;
|
||||
import static net.minecraftforge.fml.repackage.com.nothome.delta.GDiffWriter.COPY_INT_UBYTE;
|
||||
import static net.minecraftforge.fml.repackage.com.nothome.delta.GDiffWriter.COPY_INT_USHORT;
|
||||
@@ -70,16 +72,16 @@ public class GDiffPatcher {
|
||||
throws IOException
|
||||
{
|
||||
RandomAccessFileSeekableSource source =new RandomAccessFileSeekableSource(new RandomAccessFile(sourceFile, "r"));
|
||||
InputStream patch = new FileInputStream(patchFile);
|
||||
OutputStream output = new FileOutputStream(outputFile);
|
||||
InputStream patch = null;
|
||||
OutputStream output = null;
|
||||
try {
|
||||
patch = new FileInputStream(patchFile);
|
||||
output = new FileOutputStream(outputFile);
|
||||
patch(source, patch, output);
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
} finally {
|
||||
source.close();
|
||||
patch.close();
|
||||
output.close();
|
||||
IOUtils.closeQuietly(source);
|
||||
IOUtils.closeQuietly(patch);
|
||||
IOUtils.closeQuietly(output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import net.minecraft.server.dedicated.PendingCommand;
|
||||
import net.minecraft.util.IThreadListener;
|
||||
import net.minecraft.util.text.translation.LanguageMap;
|
||||
import net.minecraft.world.storage.SaveFormatOld;
|
||||
import net.minecraftforge.common.util.Java6Utils;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.IFMLSidedHandler;
|
||||
@@ -259,15 +260,7 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(stream);
|
||||
try
|
||||
{
|
||||
if (zip != null)
|
||||
zip.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// shush
|
||||
}
|
||||
Java6Utils.closeZipQuietly(zip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,4 +332,10 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayVSyncForced()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -52,9 +52,7 @@ public class ItemHandlerHelper
|
||||
if (a == null || !a.isItemEqual(b))
|
||||
return false;
|
||||
|
||||
final NBTTagCompound aTag = a.getTagCompound();
|
||||
final NBTTagCompound bTag = b.getTagCompound();
|
||||
return (aTag != null || bTag == null) && (aTag == null || aTag.equals(bTag));
|
||||
return ItemStack.areItemStackTagsEqual(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,9 +73,7 @@ public class ItemHandlerHelper
|
||||
if (a.getHasSubtypes() && a.getMetadata() != b.getMetadata())
|
||||
return false;
|
||||
|
||||
final NBTTagCompound aTag = a.getTagCompound();
|
||||
final NBTTagCompound bTag = b.getTagCompound();
|
||||
return (aTag != null || bTag == null) && (aTag == null || aTag.equals(bTag));
|
||||
return ItemStack.areItemStackTagsEqual(a, b);
|
||||
}
|
||||
|
||||
public static ItemStack copyStackWithSize(ItemStack itemStack, int size)
|
||||
|
||||
@@ -50,7 +50,7 @@ public class VanillaInventoryCodeHooks
|
||||
for (int j = 0; j < dest.getSizeInventory(); j++)
|
||||
{
|
||||
ItemStack destStack = dest.getStackInSlot(j);
|
||||
if (destStack == null || destStack.stackSize < destStack.getMaxStackSize() && destStack.stackSize < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack))
|
||||
if (dest.isItemValidForSlot(j, extractItem) && (destStack == null || destStack.stackSize < destStack.getMaxStackSize() && destStack.stackSize < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack)))
|
||||
{
|
||||
extractItem = handler.extractItem(i, 1, false);
|
||||
if (destStack == null)
|
||||
|
||||
@@ -50,6 +50,8 @@ forge.configgui.forgeLightPipelineEnabled=Forge Light Pipeline Enabled
|
||||
forge.configgui.java8Reminder=Java 8 Reminder timestamp
|
||||
forge.configgui.disableStairSlabCulling=Disable Stair/Slab culling.
|
||||
forge.configgui.disableStairSlabCulling.tooltip=Enable this if you see through blocks touching stairs/slabs with your resource pack.
|
||||
forge.configgui.alwaysSetupTerrainOffThread=Force threaded chunk rendering
|
||||
forge.configgui.alwaysSetupTerrainOffThread.tooltip=Enable forge to queue all chunk updates to the Chunk Update thread. May increase FPS significantly, but may also cause weird rendering lag. Not recommended for computers without a significant number of cores available.
|
||||
|
||||
forge.configgui.modID.tooltip=The mod ID that you want to define override settings for.
|
||||
forge.configgui.modID=Mod ID
|
||||
|
||||
@@ -55,3 +55,5 @@ net/minecraft/world/storage/loot/LootEntry.<init>(II[Lnet/minecraft/world/storag
|
||||
net/minecraft/world/storage/loot/LootEntryItem.<init>(Lnet/minecraft/item/Item;II[Lnet/minecraft/world/storage/loot/functions/LootFunction;[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46644_1_,p_i46644_2_,p_i46644_3_,p_i46644_4_,p_i46644_5_,entryName
|
||||
net/minecraft/world/storage/loot/LootEntryTable.<init>(Lnet/minecraft/util/ResourceLocation;II[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46639_1_,p_i46639_2_,p_i46639_3_,p_i46639_4_,entryName
|
||||
net/minecraft/world/storage/loot/LootEntryEmpty.<init>(II[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46645_1_,p_i46645_2_,p_i46645_3_,entryName
|
||||
|
||||
net/minecraft/world/chunk/BlockStateContainer.setBits(IZ)V=|p_186012_1_,forceBits
|
||||
@@ -7,7 +7,7 @@
|
||||
<Console name="SysOut" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||
</Console>
|
||||
<Queue name="ServerGuiConsole">
|
||||
<Queue name="ServerGuiConsole" ignoreExceptions="true">
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %msg%n" />
|
||||
</Queue>
|
||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</TerminalConsole>
|
||||
<!-- Keep a console appender open so log4j2 doesn't close our main out stream if we redirect System.out to the logger -->
|
||||
<Console name="SysOut" target="SYSTEM_OUT"/>
|
||||
<Queue name="ServerGuiConsole">
|
||||
<Queue name="ServerGuiConsole" ignoreExceptions="true">
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %replace{%msg}{(?i)\u00A7[0-9A-FK-OR]}{}%n" />
|
||||
</Queue>
|
||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 187 B |
@@ -0,0 +1,78 @@
|
||||
package net.minecraftforge.debug;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = BigNetworkMessageTest.MOD_ID, name = "Big network message test mod", version = "1.0", acceptableRemoteVersions = "*")
|
||||
@Mod.EventBusSubscriber
|
||||
public class BigNetworkMessageTest
|
||||
{
|
||||
static final boolean ENABLED = true;
|
||||
static final String MOD_ID = "big_packet_test";
|
||||
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
IMessageHandler<BigMessage, IMessage> handler = new IMessageHandler<BigMessage, IMessage>()
|
||||
{
|
||||
@Override public IMessage onMessage(BigMessage message, MessageContext ctx)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
};
|
||||
INSTANCE.registerMessage(handler, BigMessage.class, 0, Side.SERVER);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent evt)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
INSTANCE.sendTo(new BigMessage(), (EntityPlayerMP) evt.player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BigMessage implements IMessage
|
||||
{
|
||||
private static final int BYTE_COUNT = 0x200000;// 2MB
|
||||
|
||||
@Override public void toBytes(ByteBuf buf)
|
||||
{
|
||||
// write consecutive bytes, overflowing back to zero as necessary
|
||||
for (int i = 0; i < BYTE_COUNT; i++)
|
||||
{
|
||||
buf.writeByte(i & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void fromBytes(ByteBuf buf)
|
||||
{
|
||||
for (int i = 0; i < BYTE_COUNT; i++)
|
||||
{
|
||||
int read = buf.readUnsignedByte();
|
||||
int expected = i & 0xFF;
|
||||
if (read != expected)
|
||||
{
|
||||
throw new RuntimeException("Found incorrect byte at " + (i + 1) + " expected " + expected + " but found " + read);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package net.minecraftforge.test;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
@@ -13,13 +14,16 @@ import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.Capability.IStorage;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = "forge.testcapmod", name = "Forge TestCapMod", version = "1.0")
|
||||
public class TestCapabilityMod
|
||||
{
|
||||
@@ -55,13 +59,28 @@ public class TestCapabilityMod
|
||||
IExampleCapability inv = te.getCapability(TEST_CAP, event.getFace());
|
||||
System.out.println("Hi I'm a " + inv.getOwnerType());
|
||||
}
|
||||
if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.DIRT)
|
||||
if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.DIRT && event.getItemStack().hasCapability(TEST_CAP, null))
|
||||
{
|
||||
event.getEntityPlayer().addChatMessage(new TextComponentString(TextFormatting.RED + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST"));
|
||||
IExampleCapability cap = event.getItemStack().getCapability(TEST_CAP, null);
|
||||
event.getEntityPlayer().addChatMessage(new TextComponentString((cap.getVal() ? TextFormatting.GREEN : TextFormatting.RED) + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST"));
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInteractItem(PlayerInteractEvent.RightClickItem event)
|
||||
{
|
||||
if (!event.getEntityPlayer().isSneaking()) return;
|
||||
if (event.getItemStack() == null) return;
|
||||
if (event.getItemStack().getItem() != Items.STICK) return;
|
||||
|
||||
if (event.getItemStack().hasCapability(TEST_CAP, null))
|
||||
{
|
||||
IExampleCapability cap = event.getItemStack().getCapability(TEST_CAP, null);
|
||||
cap.toggleVal();
|
||||
System.out.println("Test value is now: " + (cap.getVal() ? "TRUE" : "FALSE"));
|
||||
}
|
||||
}
|
||||
|
||||
// Example of having this annotation on a method, this will be called when the capability is present.
|
||||
// You could do something like register event handlers to attach these capabilities to objects, or
|
||||
@@ -72,6 +91,54 @@ public class TestCapabilityMod
|
||||
System.out.println("IExampleCapability was registered wheeeeee!");
|
||||
}
|
||||
|
||||
// Having the Provider implement the cap is not recommended as this creates a hard dep on the cap interface.
|
||||
// And does not allow for sidedness.
|
||||
// But as this is a example and we do not care about that here we go.
|
||||
class Provider<V> implements ICapabilitySerializable<NBTTagCompound>, IExampleCapability
|
||||
{
|
||||
private V obj;
|
||||
private boolean value;
|
||||
|
||||
Provider(V obj)
|
||||
{
|
||||
this.obj = obj;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing)
|
||||
{
|
||||
return TEST_CAP != null && capability == TEST_CAP;
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
|
||||
{
|
||||
if (TEST_CAP != null && capability == TEST_CAP) return TEST_CAP.cast(this);
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setBoolean("CapTestVal", this.value);
|
||||
return tag;
|
||||
}
|
||||
@Override
|
||||
public void deserializeNBT(NBTTagCompound tag) {
|
||||
this.value = tag.getBoolean("CapTestVal");
|
||||
}
|
||||
@Override
|
||||
public String getOwnerType() {
|
||||
return obj.getClass().getName();
|
||||
}
|
||||
@Override
|
||||
public boolean getVal() {
|
||||
return this.value;
|
||||
}
|
||||
@Override
|
||||
public void toggleVal() {
|
||||
this.value = !this.value;
|
||||
}
|
||||
}
|
||||
|
||||
// An example of how to attach a capability to an arbitrary Tile entity.
|
||||
// Note: Doing this IS NOT recommended for normal implementations.
|
||||
// If you control the TE it is HIGHLY recommend that you implement a fast
|
||||
@@ -80,36 +147,15 @@ public class TestCapabilityMod
|
||||
@SubscribeEvent
|
||||
public void onTELoad(AttachCapabilitiesEvent.TileEntity event)
|
||||
{
|
||||
// Having the Provider implement the cap is not recomended as this creates a hard dep on the cap interface.
|
||||
// And doesnt allow for sidedness.
|
||||
// But as this is a example and we dont care about that here we go.
|
||||
class Provider implements ICapabilityProvider, IExampleCapability
|
||||
{
|
||||
private TileEntity te;
|
||||
//Attach it! The resource location MUST be unique it's recommended that you tag it with your modid and what the cap is.
|
||||
event.addCapability(new ResourceLocation("forge.testcapmod:dummy_cap"), new Provider(event.getTileEntity()));
|
||||
}
|
||||
|
||||
Provider(TileEntity te)
|
||||
{
|
||||
this.te = te;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
|
||||
{
|
||||
return TEST_CAP != null && capability == TEST_CAP;
|
||||
}
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
|
||||
{
|
||||
if (TEST_CAP != null && capability == TEST_CAP) return TEST_CAP.cast(this);
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String getOwnerType() {
|
||||
return te.getClass().getName();
|
||||
}
|
||||
}
|
||||
|
||||
//Attach it! The resource location MUST be unique it's recomneded that you tag it with your modid and what the cap is.
|
||||
event.addCapability(new ResourceLocation("TestCapabilityMod:DummyCap"), new Provider(event.getTileEntity()));
|
||||
@SubscribeEvent
|
||||
public void onItemLoad(AttachCapabilitiesEvent.Item event)
|
||||
{
|
||||
if (event.getItem() == Items.STICK)
|
||||
event.addCapability(new ResourceLocation("forge.testcapmod:dummy_cap"), new Provider(event.getItemStack()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -123,7 +169,7 @@ public class TestCapabilityMod
|
||||
public void attachTileEntity(AttachCapabilitiesEvent<TileEntity> event)
|
||||
{
|
||||
if (!(event.getObject() instanceof TileEntity))
|
||||
throw new IllegalArgumentException("Generic event handler failed! Exprected Tile Entity got " + event.getObject());
|
||||
throw new IllegalArgumentException("Generic event handler failed! Expected Tile Entity got " + event.getObject());
|
||||
}
|
||||
|
||||
// Capabilities SHOULD be interfaces, NOT concrete classes, this allows for
|
||||
@@ -131,6 +177,8 @@ public class TestCapabilityMod
|
||||
public static interface IExampleCapability
|
||||
{
|
||||
String getOwnerType();
|
||||
boolean getVal();
|
||||
void toggleVal();
|
||||
}
|
||||
|
||||
// Storage implementations are required, tho there is some flexibility here.
|
||||
@@ -156,5 +204,10 @@ public class TestCapabilityMod
|
||||
public String getOwnerType(){
|
||||
return "Default Implementation!";
|
||||
}
|
||||
public boolean getVal() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void toggleVal() {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user