Compare commits

...
42 Commits
Author SHA1 Message Date
mezz 86baf7462f Improve JavaDoc links, fix some broken JavaDocs (#2833)
Improve JavaDoc links, fix broken JavaDocs
2016-05-29 14:05:07 -07:00
Shadowfacts 9bb927dc64 Pass the correct position into isSideSolid in BlockRailBase#canPlaceBlockAt (#2919) 2016-05-27 19:13:20 -07:00
boni 5d5c005aae Fix Bucket rendering and add sound (#2865)
* Adjust generated quads from texture to take texture size into account #2858

*  Fix universal bucket not passing through when rightclicking on a non-block
Add proper sound events when picking up modded fluids #2821

* Have FluidUtil execute properly on both sides and sync as expected. Add default sounds to interacting with tanks

* Save sound for filling/emptying in the fluid
2016-05-16 13:20:31 -07:00
LexManos 87b0f7db99 Lets just simply this. Fixes last commit. 2016-05-14 21:40:31 -07:00
LexManos d5b93bf262 Add modder facing API for Villager Career level trades. Ref: #2854 2016-05-14 20:11:55 -07:00
RainWarrior 5445f96327 Extended Animation State Machine format to allow multiple transitions from one state. 2016-05-13 12:46:34 +03:00
cpw 2e6f4e5b86 Fix up release jsons to clean up extraneous netty references 2016-05-11 11:15:45 -04:00
LexManos 75468e9b0d Make LootPool constructor public again. Closes #2847 2016-05-11 01:25:48 -07:00
LexManos 34d4b0b93f Fix type in LootEntry json name. And rename LootTable.finalize to freeze to avoid overriding Object function. Closes #2846 and #2847 2016-05-10 23:35:02 -07:00
RainWarrior 92800f61d3 Fixed joint animation application correctly. 2016-05-10 10:46:04 +03:00
Shadowfacts 58d26618f6 Add ScreenshotEvent (#2828)
Add ScreenshotEvent
2016-05-09 14:51:30 -07:00
LexManos aaa146c10d New LootTable interaction system and event.
Modders can now modify and reference internal elements of a loot table by name.
Editing can ONLY be done in the event and any external editing will cause a exception to be thrown.
See this gist for more information: https://gist.github.com/LexManos/77c983d67b9ad27010428478b66d50fd
2016-05-09 14:15:59 -07:00
RainWarrior babd54bb87 Fixed joint hierarchy not being used fully in the animation system. 2016-05-09 20:40:53 +03:00
LexManos d30aae862f Fixed issue in ChunkIO that would potentially cause NPEs on chunks. Closes #2837 2016-05-09 02:10:24 -07:00
LexManos a7d5820e99 Fixed map extension recipie. 2016-05-08 16:38:07 -07:00
mezz 363e84b2c5 Fix the rand given to PopulateChunkEvent (#2834) 2016-05-07 11:17:18 -07:00
LexManos 6e46b6e4c1 Fix areas where dimension types are used as dimension IDs. 2016-05-05 12:50:12 -07:00
LexManos 0d13fe245d Add NPE protection to in-hand item rendering. 2016-05-04 22:29:17 -07:00
Matthew Messinger 5f74a75435 Fix url regex (#2815)
Fixed url detection in chat messages. Stops false positives such as `um.....no`
2016-05-04 10:46:33 -07:00
LexManos aa672ea69a Bump version for new RB. 2016-05-03 23:19:51 -07:00
LexManos 42404c531d Slightly better practice because wait can be randomly interupted. 2016-05-03 23:19:40 -07:00
cpw 4248dbc71d Merge in a fix from 1.8.9 for rails 2016-05-03 23:39:32 -04:00
cpw f5781488d9 Merge branch '1.9' 2016-05-03 23:24:43 -04:00
bloodmc 23cdcb96a9 Call markDirty when restoring blocks with TileEntities. (#2808)
This change makes sure the updated tileentity is saved properly within the
chunk.
2016-05-02 15:18:26 -07:00
bloodmc b53e53dcb7 Call markDirty when restoring blocks with TileEntities. (#2807)
This change makes sure the updated tileentity is saved properly within the
chunk.
2016-05-02 15:01:49 -07:00
bloodmc 7c6372202e Fix wrong blockstate being passed to notifyNeighborsRespectDebug. (#2806) 2016-05-02 14:33:35 -07:00
bloodmc b5bda7117a Only run block physics for TileEntities while capturing block placement. (#2805)
Currently, all blocks placed by players that are not TE's run physics
twice. Blocks that contain a TileEntity are not affected due to a check in
'ForgeHooks.onPlaceItemIntoWorld'.

In order to fix the problem, 'Chunk.setBlockState' will now verify if
blocks are being captured before running onBlockAdded and if so, only run
physics if the block has a tileentity. This check also prevents blocks
such as TNT's from running its physics (explosion) when placement event is
cancelled.
2016-05-02 14:23:24 -07:00
Craig Burton d31cf8ddbc Update ore dictionary (#2721)
Updated the Ore Dictionary with more vanilla items:
  -Prismarine Shard ( "gemPrismarine" )
  -Prismarine Crystals ( "dustPrismarine" )
  -Prismarine Block ( "blockPrismarine" )
  -Prismarine Brick ( "blockPrismarineBrick" )
  -Dark Prismarine ( "blockDarkPrismarine" )
  -Nether Wart ( "cropNetherWart" )
  -Sugarcane ( "sugarcane" )
  -Paper ( "paper" )
  -Ender Pearl ( "enderpearl" )
  -Bone ( "bone)
  -Gunpowder ( "gunpowder)
  -String ( "string" )
  -Nether Star ( "netherStar" )
  -Leather ( "leather" )
  -Feather ( "feather" )
  -Egg ( "egg" )
  -End Stone ( "endstone" )
  -Torch ( "torch" )
  -Vine ( "vine" )
  -Cactus ( "blockCactus" )
  -Grass ( "grass")
  -Obsidian ( "obsidian" )
  -Red Sandstone ( added to "sandstone" )
  -Crafting Table ( "workbench" )
  -Slime Block ( "blockSlime" )
  -Granite ( "stoneGranite" )
  -Polished Granite ( "stoneGranitePolished" )
  -Diorite ( "stoneDiorite" )
  -Polished Diorite ( "stoneDioritePolished" )
  -Andesite ( "stoneAndesite" )
  -Polished Andesite ( "stoneAndesitePolished" )
2016-04-07 11:49:31 -07:00
LexManos ce4d31529d Merge pull request #2714 from nekosune/patch-1
Corrected CapabilityItemHandler.readNBT ignoring anything in slot 0
2016-04-05 13:32:55 -07:00
Katrina Swales f4ca1f61b9 Corrected readNBT ignoring anything in slot 0 2016-04-05 19:44:20 +01:00
LexManos c7e54b8ecc Merge pull request #2649 from mezz/tooltips
Make tooltips layout in the right direction, wrap if there is no room
2016-03-24 19:18:26 -07:00
mezz eca3b900e0 Make tooltips layout in the right direction, wrap if there is no room
Fixes #2255
2016-03-24 19:12:46 -07:00
LexManos 1d21345dfd Merge pull request #2531 from Choonster/finite-fluid-drain-fix
Allow finite fluids to be drained correctly
2016-03-21 19:54:53 -07:00
LexManos 76efd93235 Merge pull request #2621 from Thutmose/patch-1
Fix pushing players inside blocks.
2016-03-21 19:34:58 -07:00
Thutmose e349855688 Fix pushing players inside blocks.
same changes made to the 1.9 branch
2016-03-21 22:33:35 -04:00
LexManos b317d5d107 Merge pull request #2605 from Thutmose/playersize
Fixed players smaller than 1 block not being able to walk under overhang
2016-03-21 17:15:11 -07:00
Thutmose cd81cd0934 Allow players sized smaller than 1 block to walk into small spaces 2016-03-21 17:41:41 -04:00
LexManos 3930f6f8bd Merge pull request #2612 from CovertJaguar/master
Add missing Minecart/Track hook.
2016-03-21 14:08:40 -07:00
CovertJaguar f61605c7af Add missing Minecart/Track hook. 2016-03-21 03:18:25 -07:00
LexManos cc2895b793 Merge pull request #2594 from Corosauce/master
Fix for patch targetting the wrong field to change for failed pathfinding penalty
2016-03-20 06:53:53 -07:00
Corosauce c01e98e25f Fix for patch targetting the wrong field to change for failed pathfinding penalty 2016-03-20 02:05:38 -04:00
Choonster TheMage 9ca3ede736 Allow finite fluids to be drained correctly 2016-03-07 21:31:27 +11:00
112 changed files with 1754 additions and 558 deletions

No files matched your search

+2 -1
View File
@@ -29,7 +29,8 @@
{
"comment": "Force the downgrade on dedicated server to match client. Netty bug: https://github.com/MinecraftForge/MinecraftForge/issues/1848",
"name": "io.netty:netty-all:4.0.15.Final",
"serverreq":true
"serverreq":true,
"clientclasspath":false
},
{
"name": "net.minecraft:launchwrapper:1.12",
-5
View File
@@ -26,11 +26,6 @@
"name": "@artifact@",
"url": "http://files.minecraftforge.net/maven/"
},
{
"comment": "Force the downgrade on dedicated server to match client. Netty bug: https://github.com/MinecraftForge/MinecraftForge/issues/1848",
"name": "io.netty:netty-all:4.0.23.Final",
"serverreq":true
},
{
"name": "net.minecraft:launchwrapper:1.12",
"serverreq":true
-5
View File
@@ -26,11 +26,6 @@
"name": "@artifact@",
"url": "http://files.minecraftforge.net/maven/"
},
{
"comment": "Force the downgrade on dedicated server to match client. Netty bug: https://github.com/MinecraftForge/MinecraftForge/issues/1848",
"name": "io.netty:netty-all:4.0.23.Final",
"serverreq":true
},
{
"name": "net.minecraft:launchwrapper:1.12",
"serverreq":true
-5
View File
@@ -24,11 +24,6 @@
"name": "@artifact@",
"url": "http://files.minecraftforge.net/maven/"
},
{
"comment": "Force the downgrade on dedicated server to match client. Netty bug: https://github.com/MinecraftForge/MinecraftForge/issues/1848",
"name": "io.netty:netty-all:4.0.23.Final",
"serverreq":true
},
{
"name": "net.minecraft:launchwrapper:1.12",
"serverreq":true
@@ -14,7 +14,7 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q();
+ return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).isSideSolid(p_176196_1_, p_176196_2_, EnumFacing.UP);
+ return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).isSideSolid(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP);
}
public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_)
@@ -48,7 +48,7 @@
{
flag = true;
}
@@ -160,6 +160,81 @@
@@ -160,6 +160,98 @@
public abstract IProperty<BlockRailBase.EnumRailDirection> func_176560_l();
@@ -57,7 +57,7 @@
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pod Block's position in world
+ * @param pos Block's position in world
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos)
@@ -69,7 +69,7 @@
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pod Block's position in world
+ * @param pos Block's position in world
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos)
@@ -78,10 +78,27 @@
+ }
+
+ /**
+ * Return the rail's direction.
+ * Can be used to make the cart think the rail is a different shape,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * @param world The world.
+ * @param pos Block's position in world
+ * @param state The BlockState
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @return The direction.
+ */
+ public EnumRailDirection getRailDirection(IBlockAccess world, BlockPos pos, IBlockState state, @javax.annotation.Nullable net.minecraft.entity.item.EntityMinecart cart)
+ {
+ return state.func_177229_b(func_176560_l());
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param pod Block's position in world
+ * @param pos Block's position in world
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
@@ -94,7 +111,7 @@
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param pod Block's position in world
+ * @param pos Block's position in world
+ */
+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
+ {
@@ -130,7 +147,7 @@
public static enum EnumRailDirection implements IStringSerializable
{
NORTH_SOUTH(0, "north_south"),
@@ -230,6 +305,7 @@
@@ -230,6 +322,7 @@
private IBlockState field_180366_e;
private final boolean field_150656_f;
private final List<BlockPos> field_150657_g = Lists.<BlockPos>newArrayList();
@@ -138,17 +155,19 @@
public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_)
{
@@ -238,7 +314,8 @@
@@ -237,8 +330,9 @@
this.field_180367_c = p_i45739_3_;
this.field_180366_e = p_i45739_4_;
this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c();
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(this.field_180365_d.func_176560_l());
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(this.field_180365_d.func_176560_l());
- this.field_150656_f = this.field_180365_d.field_150053_a;
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = field_180365_d.getRailDirection(p_i45739_2_, p_i45739_3_, p_i45739_4_, null);
+ this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_);
+ this.canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_);
this.func_180360_a(blockrailbase$enumraildirection);
}
@@ -429,7 +506,7 @@
@@ -429,7 +523,7 @@
}
}
@@ -157,7 +176,7 @@
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
{
@@ -442,7 +519,7 @@
@@ -442,7 +536,7 @@
}
}
@@ -166,7 +185,7 @@
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
{
@@ -585,7 +662,7 @@
@@ -585,7 +679,7 @@
}
}
@@ -175,7 +194,7 @@
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
{
@@ -598,7 +675,7 @@
@@ -598,7 +692,7 @@
}
}
@@ -1,5 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -316,7 +316,7 @@
{
ItemStack itemstack = abstractclientplayer.func_184607_cu();
- if (itemstack.func_77973_b() == Items.field_151031_f)
+ if (itemstack != null && itemstack.func_77973_b() == Items.field_151031_f) //Forge: Data watcher can desync and cause this to NPE...
{
EnumHand enumhand1 = abstractclientplayer.func_184600_cs();
flag = enumhand1 == EnumHand.MAIN_HAND;
@@ -360,7 +360,7 @@
this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside);
}
@@ -9,6 +9,15 @@
{
private static final Logger field_184243_a = LogManager.getLogger();
private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -185,7 +185,7 @@
if (p_i1582_1_ != null)
{
- this.field_71093_bK = p_i1582_1_.field_73011_w.func_186058_p().func_186068_a();
+ this.field_71093_bK = p_i1582_1_.field_73011_w.getDimension();
}
this.field_70180_af = new EntityDataManager(this);
@@ -195,8 +195,16 @@
this.field_70180_af.func_187214_a(field_184242_az, "");
this.field_70180_af.func_187214_a(field_184234_aB, Boolean.valueOf(false));
@@ -232,33 +232,28 @@
public abstract EnumHandSide func_184591_cq();
public boolean func_184587_cr()
@@ -2369,8 +2435,16 @@
{
ItemStack itemstack = this.func_184586_b(this.func_184600_cs());
@@ -2371,12 +2437,19 @@
- if (itemstack == this.field_184627_bm)
+ if (itemstack == this.field_184627_bm && itemstack != null)
if (itemstack == this.field_184627_bm)
{
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn <= 0)
+ if (this.field_184627_bm != null)
+ {
+ this.func_71036_o();
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn > 0)
+ field_184627_bm.func_77973_b().onUsingTick(field_184627_bm, this, field_184628_bn);
+ }
+ else
+ { // Forge Keep unindented to lower patch
+ field_184627_bm.func_77973_b().onUsingTick(field_184627_bm, this, field_184628_bn); //Forge Added
+
if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0)
{
this.func_184584_a(this.field_184627_bm, 5);
@@ -2380,6 +2454,7 @@
}
- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K)
+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K)
{
this.func_71036_o();
}
+ }
}
else
{
@@ -2394,8 +2469,10 @@
@@ -2394,8 +2467,10 @@
if (itemstack != null && !this.func_184587_cr())
{
@@ -270,7 +265,7 @@
if (!this.field_70170_p.field_72995_K)
{
@@ -2478,6 +2555,8 @@
@@ -2478,6 +2553,8 @@
this.func_184584_a(this.field_184627_bm, 16);
ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this);
@@ -279,7 +274,7 @@
if (itemstack != null && itemstack.field_77994_a == 0)
{
itemstack = null;
@@ -2507,7 +2586,8 @@
@@ -2507,7 +2584,8 @@
{
if (this.field_184627_bm != null)
{
@@ -289,7 +284,7 @@
}
this.func_184602_cy();
@@ -2626,4 +2706,28 @@
@@ -2626,4 +2704,28 @@
{
return true;
}
@@ -117,8 +117,9 @@
}
- double d0 = 0.0078125D;
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l());
+ double slopeAdjustment = getSlopeAdjustment();
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l());
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = blockrailbase.getRailDirection(field_70170_p, p_180460_1_, p_180460_2_, this);
switch (blockrailbase$enumraildirection)
{
@@ -120,16 +120,24 @@
this.field_175562_bw = 1;
}
@@ -552,7 +596,7 @@
@@ -552,13 +596,11 @@
int i = this.field_175563_bv - 1;
int j = this.field_175562_bw - 1;
- EntityVillager.ITradeList[][] aentityvillager$itradelist1 = aentityvillager$itradelist[i];
+ EntityVillager.ITradeList[][] aentityvillager$itradelist1 = this.getProfessionForge().getCareer(i).getTrades();
+ java.util.List<EntityVillager.ITradeList> trades = this.getProfessionForge().getCareer(i).getTrades(j);
if (j >= 0 && j < aentityvillager$itradelist1.length)
- if (j >= 0 && j < aentityvillager$itradelist1.length)
+ if (trades != null)
{
@@ -647,9 +691,14 @@
- EntityVillager.ITradeList[] aentityvillager$itradelist2 = aentityvillager$itradelist1[j];
-
- for (EntityVillager.ITradeList entityvillager$itradelist : aentityvillager$itradelist2)
+ for (EntityVillager.ITradeList entityvillager$itradelist : trades)
{
entityvillager$itradelist.func_179401_a(this.field_70963_i, this.field_70146_Z);
}
@@ -647,9 +689,14 @@
}
}
@@ -145,7 +153,7 @@
textcomponenttranslation.func_150256_b().func_150209_a(this.func_174823_aP());
textcomponenttranslation.func_150256_b().func_179989_a(this.func_110124_au().toString());
@@ -708,7 +757,7 @@
@@ -708,7 +755,7 @@
public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_)
{
p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_);
@@ -5,7 +5,7 @@
mapdata.field_76197_d = 0;
mapdata.func_176054_a(p_77659_3_.field_70165_t, p_77659_3_.field_70161_v, mapdata.field_76197_d);
- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.func_186058_p().func_186068_a();
+ mapdata.field_76200_c = p_77659_2_.field_73011_w.func_186058_p().func_186068_a();
+ mapdata.field_76200_c = p_77659_2_.field_73011_w.getDimension();
mapdata.field_186210_e = true;
mapdata.func_76185_a();
--p_77659_1_.field_77994_a;
@@ -5,7 +5,16 @@
mapdata.field_76197_d = 3;
mapdata.func_176054_a((double)p_77873_2_.func_72912_H().func_76079_c(), (double)p_77873_2_.func_72912_H().func_76074_e(), mapdata.field_76197_d);
- mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.func_186058_p().func_186068_a();
+ mapdata.field_76200_c = p_77873_2_.field_73011_w.func_186058_p().func_186068_a();
+ mapdata.field_76200_c = p_77873_2_.field_73011_w.getDimension();
mapdata.func_76185_a();
p_77873_2_.func_72823_a(s, mapdata);
}
@@ -67,7 +67,7 @@
public void func_77872_a(World p_77872_1_, Entity p_77872_2_, MapData p_77872_3_)
{
- if (p_77872_1_.field_73011_w.func_186058_p().func_186068_a() == p_77872_3_.field_76200_c && p_77872_2_ instanceof EntityPlayer)
+ if (p_77872_1_.field_73011_w.getDimension() == p_77872_3_.field_76200_c && p_77872_2_ instanceof EntityPlayer)
{
int i = 1 << p_77872_3_.field_76197_d;
int j = p_77872_3_.field_76201_a;
@@ -189,7 +189,7 @@
}
public void func_71190_q()
@@ -672,14 +666,17 @@
@@ -672,24 +666,28 @@
}
this.field_71304_b.func_76318_c("levels");
@@ -210,7 +210,11 @@
this.field_71304_b.func_76320_a(worldserver.func_72912_H().func_76065_j());
if (this.field_71315_w % 20 == 0)
@@ -690,6 +687,7 @@
{
this.field_71304_b.func_76320_a("timeSync");
- this.field_71318_t.func_148537_a(new SPacketTimeUpdate(worldserver.func_82737_E(), worldserver.func_72820_D(), worldserver.func_82736_K().func_82766_b("doDaylightCycle")), worldserver.field_73011_w.func_186058_p().func_186068_a());
+ this.field_71318_t.func_148537_a(new SPacketTimeUpdate(worldserver.func_82737_E(), worldserver.func_72820_D(), worldserver.func_82736_K().func_82766_b("doDaylightCycle")), worldserver.field_73011_w.getDimension());
this.field_71304_b.func_76319_b();
}
this.field_71304_b.func_76320_a("tick");
@@ -50,6 +50,15 @@
}
}
}
@@ -506,7 +512,7 @@
public boolean func_175579_a(World p_175579_1_, BlockPos p_175579_2_, EntityPlayer p_175579_3_)
{
- if (p_175579_1_.field_73011_w.func_186058_p().func_186068_a() != 0)
+ if (p_175579_1_.field_73011_w.getDimension() != 0)
{
return false;
}
@@ -580,6 +586,9 @@
return this.field_71340_o.func_73669_a("network-compression-threshold", super.func_175577_aI());
}
@@ -27,15 +27,17 @@
p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p);
String s1 = "local";
@@ -123,7 +134,7 @@
@@ -123,8 +134,8 @@
WorldInfo worldinfo = worldserver.func_72912_H();
BlockPos blockpos = worldserver.func_175694_M();
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_);
- nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
+ p_72355_2_.field_71135_a = nethandlerplayserver;
nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
+ nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.getDimension(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
nethandlerplayserver.func_147359_a(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
nethandlerplayserver.func_147359_a(new SPacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
nethandlerplayserver.func_147359_a(new SPacketSpawnPosition(blockpos));
@@ -213,6 +224,7 @@
}
@@ -0,0 +1,16 @@
--- ../src-base/minecraft/net/minecraft/util/ScreenShotHelper.java
+++ ../src-work/minecraft/net/minecraft/util/ScreenShotHelper.java
@@ -52,10 +52,13 @@
file2 = new File(file1, p_148259_1_);
}
+ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(bufferedimage, file2);
+ if (event.isCanceled()) return event.getCancelMessage(); else file2 = event.getScreenshotFile();
ImageIO.write(bufferedimage, "png", (File)file2);
ITextComponent itextcomponent = new TextComponentString(file2.getName());
itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
itextcomponent.func_150256_b().func_150228_d(Boolean.valueOf(true));
+ if (event.getResultMessage() != null) return event.getResultMessage();
return new TextComponentTranslation("screenshot.success", new Object[] {itextcomponent});
}
catch (Exception exception)
@@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/world/WorldManager.java
+++ ../src-work/minecraft/net/minecraft/world/WorldManager.java
@@ -50,7 +50,7 @@
public void func_184375_a(EntityPlayer p_184375_1_, SoundEvent p_184375_2_, SoundCategory p_184375_3_, double p_184375_4_, double p_184375_6_, double p_184375_8_, float p_184375_10_, float p_184375_11_)
{
- this.field_72783_a.func_184103_al().func_148543_a(p_184375_1_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_ > 1.0F ? (double)(16.0F * p_184375_10_) : 16.0D, this.field_72782_b.field_73011_w.func_186058_p().func_186068_a(), new SPacketSoundEffect(p_184375_2_, p_184375_3_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_, p_184375_11_));
+ this.field_72783_a.func_184103_al().func_148543_a(p_184375_1_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_ > 1.0F ? (double)(16.0F * p_184375_10_) : 16.0D, this.field_72782_b.field_73011_w.getDimension(), new SPacketSoundEffect(p_184375_2_, p_184375_3_, p_184375_4_, p_184375_6_, p_184375_8_, p_184375_10_, p_184375_11_));
}
public void func_147585_a(int p_147585_1_, int p_147585_2_, int p_147585_3_, int p_147585_4_, int p_147585_5_, int p_147585_6_)
@@ -72,7 +72,7 @@
public void func_180439_a(EntityPlayer p_180439_1_, int p_180439_2_, BlockPos p_180439_3_, int p_180439_4_)
{
- this.field_72783_a.func_184103_al().func_148543_a(p_180439_1_, (double)p_180439_3_.func_177958_n(), (double)p_180439_3_.func_177956_o(), (double)p_180439_3_.func_177952_p(), 64.0D, this.field_72782_b.field_73011_w.func_186058_p().func_186068_a(), new SPacketEffect(p_180439_2_, p_180439_3_, p_180439_4_, false));
+ this.field_72783_a.func_184103_al().func_148543_a(p_180439_1_, (double)p_180439_3_.func_177958_n(), (double)p_180439_3_.func_177956_o(), (double)p_180439_3_.func_177952_p(), 64.0D, this.field_72782_b.field_73011_w.getDimension(), new SPacketEffect(p_180439_2_, p_180439_3_, p_180439_4_, false));
}
public void func_180440_a(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_)
@@ -221,6 +221,15 @@
{
this.field_72996_f.add(entity);
this.func_72923_a(entity);
@@ -1139,7 +1178,7 @@
{
if (super.func_72942_c(p_72942_1_))
{
- this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, p_72942_1_.field_70165_t, p_72942_1_.field_70163_u, p_72942_1_.field_70161_v, 512.0D, this.field_73011_w.func_186058_p().func_186068_a(), new SPacketSpawnGlobalEntity(p_72942_1_));
+ this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, p_72942_1_.field_70165_t, p_72942_1_.field_70163_u, p_72942_1_.field_70161_v, 512.0D, this.field_73011_w.getDimension(), new SPacketSpawnGlobalEntity(p_72942_1_));
return true;
}
else
@@ -1161,6 +1200,7 @@
public Explosion func_72885_a(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_)
{
@@ -229,8 +238,27 @@
explosion.func_77278_a();
explosion.func_77279_a(false);
@@ -1240,19 +1280,23 @@
this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_186058_p().func_186068_a());
@@ -1206,7 +1246,7 @@
{
if (this.func_147485_a(blockeventdata))
{
- this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, (double)blockeventdata.func_180328_a().func_177958_n(), (double)blockeventdata.func_180328_a().func_177956_o(), (double)blockeventdata.func_180328_a().func_177952_p(), 64.0D, this.field_73011_w.func_186058_p().func_186068_a(), new SPacketBlockAction(blockeventdata.func_180328_a(), blockeventdata.func_151337_f(), blockeventdata.func_151339_d(), blockeventdata.func_151338_e()));
+ this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, (double)blockeventdata.func_180328_a().func_177958_n(), (double)blockeventdata.func_180328_a().func_177956_o(), (double)blockeventdata.func_180328_a().func_177952_p(), 64.0D, this.field_73011_w.getDimension(), new SPacketBlockAction(blockeventdata.func_180328_a(), blockeventdata.func_151337_f(), blockeventdata.func_151339_d(), blockeventdata.func_151338_e()));
}
}
@@ -1232,27 +1272,31 @@
if (this.field_73003_n != this.field_73004_o)
{
- this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.func_186058_p().func_186068_a());
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.getDimension());
}
if (this.field_73018_p != this.field_73017_q)
{
- this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_186058_p().func_186068_a());
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.getDimension());
}
+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension,
@@ -58,7 +58,7 @@
public void func_185931_b(int p_185931_1_, int p_185931_2_)
{
BlockFalling.field_149832_M = true;
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_73230_p, p_185931_1_, p_185931_2_, false);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_73230_p, this.field_73220_k, p_185931_1_, p_185931_2_, false);
BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16);
if (this.field_73229_q)
@@ -66,7 +66,7 @@
}
}
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_73230_p, p_185931_1_, p_185931_2_, false);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_73230_p, this.field_73220_k, p_185931_1_, p_185931_2_, false);
BlockFalling.field_149832_M = false;
}
@@ -43,7 +43,7 @@
public void func_185931_b(int p_185931_1_, int p_185931_2_)
{
BlockFalling.field_149832_M = true;
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185952_n, p_185931_1_, p_185931_2_, false);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false);
BlockPos blockpos = new BlockPos(p_185931_1_ * 16, 0, p_185931_2_ * 16);
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_);
this.field_73172_c.func_175794_a(this.field_185952_n, this.field_185954_p, chunkcoordintpair);
@@ -71,7 +71,7 @@
}
+ }//Forge: End doGLowstone
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185952_n, p_185931_1_, p_185931_2_, false);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185952_n, this.field_185954_p, p_185931_1_, p_185931_2_, false);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(this.field_185952_n, this.field_185954_p, blockpos));
+
+ if (net.minecraftforge.event.terraingen.TerrainGen.decorate(this.field_185952_n, this.field_185954_p, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM))
@@ -46,7 +46,7 @@
boolean flag = false;
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_185931_1_, p_185931_2_);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag);
+
if (this.field_185996_o)
{
@@ -94,7 +94,7 @@
}
+ }//Forge: End ICE
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185995_n, p_185931_1_, p_185931_2_, flag);
+ net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.field_185995_n, this.field_185990_i, p_185931_1_, p_185931_2_, flag);
+
BlockFalling.field_149832_M = false;
}
@@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootEntry.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootEntry.java
@@ -18,15 +18,17 @@
public abstract class LootEntry
{
+ protected final String entryName;
protected final int field_186364_c;
protected final int field_186365_d;
protected final LootCondition[] field_186366_e;
- protected LootEntry(int p_i46642_1_, int p_i46642_2_, LootCondition[] p_i46642_3_)
+ protected LootEntry(int p_i46642_1_, int p_i46642_2_, LootCondition[] p_i46642_3_, String entryName)
{
this.field_186364_c = p_i46642_1_;
this.field_186365_d = p_i46642_2_;
this.field_186366_e = p_i46642_3_;
+ this.entryName = entryName;
}
public int func_186361_a(float p_186361_1_)
@@ -34,6 +36,8 @@
return Math.max(MathHelper.func_76141_d((float)this.field_186364_c + (float)this.field_186365_d * p_186361_1_), 0);
}
+ public String getEntryName(){ return this.entryName; }
+
public abstract void func_186363_a(Collection<ItemStack> p_186363_1_, Random p_186363_2_, LootContext p_186363_3_);
protected abstract void func_186362_a(JsonObject p_186362_1_, JsonSerializationContext p_186362_2_);
@@ -57,6 +61,9 @@
alootcondition = new LootCondition[0];
}
+ LootEntry ret = net.minecraftforge.common.ForgeHooks.deserializeJsonLootEntry(s, jsonobject, i, j, alootcondition);
+ if (ret != null) return ret;
+
if (s.equals("item"))
{
return LootEntryItem.func_186367_a(jsonobject, p_deserialize_3_, i, j, alootcondition);
@@ -78,6 +85,8 @@
public JsonElement serialize(LootEntry p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
+ if (p_serialize_1_.entryName != null && !p_serialize_1_.entryName.startsWith("custom#"))
+ jsonobject.addProperty("entryName", p_serialize_1_.entryName);
jsonobject.addProperty("weight", (Number)Integer.valueOf(p_serialize_1_.field_186364_c));
jsonobject.addProperty("quality", (Number)Integer.valueOf(p_serialize_1_.field_186365_d));
@@ -86,6 +95,9 @@
jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.field_186366_e));
}
+ String type = net.minecraftforge.common.ForgeHooks.getLootEntryType(p_serialize_1_);
+ if (type != null) jsonobject.addProperty("type", type);
+ else
if (p_serialize_1_ instanceof LootEntryItem)
{
jsonobject.addProperty("type", "item");
@@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootEntryEmpty.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootEntryEmpty.java
@@ -10,9 +10,9 @@
public class LootEntryEmpty extends LootEntry
{
- public LootEntryEmpty(int p_i46645_1_, int p_i46645_2_, LootCondition[] p_i46645_3_)
+ public LootEntryEmpty(int p_i46645_1_, int p_i46645_2_, LootCondition[] p_i46645_3_, String entryName)
{
- super(p_i46645_1_, p_i46645_2_, p_i46645_3_);
+ super(p_i46645_1_, p_i46645_2_, p_i46645_3_, entryName);
}
public void func_186363_a(Collection<ItemStack> p_186363_1_, Random p_186363_2_, LootContext p_186363_3_)
@@ -25,6 +25,6 @@
public static LootEntryEmpty func_186372_a(JsonObject p_186372_0_, JsonDeserializationContext p_186372_1_, int p_186372_2_, int p_186372_3_, LootCondition[] p_186372_4_)
{
- return new LootEntryEmpty(p_186372_2_, p_186372_3_, p_186372_4_);
+ return new LootEntryEmpty(p_186372_2_, p_186372_3_, p_186372_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186372_0_, "empty"));
}
}
@@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootEntryItem.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootEntryItem.java
@@ -18,9 +18,9 @@
protected final Item field_186368_a;
protected final LootFunction[] field_186369_b;
- public LootEntryItem(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, LootFunction[] p_i46644_4_, LootCondition[] p_i46644_5_)
+ public LootEntryItem(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, LootFunction[] p_i46644_4_, LootCondition[] p_i46644_5_, String entryName)
{
- super(p_i46644_2_, p_i46644_3_, p_i46644_5_);
+ super(p_i46644_2_, p_i46644_3_, p_i46644_5_, entryName);
this.field_186368_a = p_i46644_1_;
this.field_186369_b = p_i46644_4_;
}
@@ -42,7 +42,7 @@
if (itemstack.field_77994_a > 0)
{
- if (itemstack.field_77994_a < this.field_186368_a.func_77639_j())
+ if (itemstack.field_77994_a < this.field_186368_a.getItemStackLimit(itemstack))
{
p_186363_1_.add(itemstack);
}
@@ -82,6 +82,7 @@
public static LootEntryItem func_186367_a(JsonObject p_186367_0_, JsonDeserializationContext p_186367_1_, int p_186367_2_, int p_186367_3_, LootCondition[] p_186367_4_)
{
+ String name = net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186367_0_, "item");
Item item = JsonUtils.func_188180_i(p_186367_0_, "name");
LootFunction[] alootfunction;
@@ -94,6 +95,6 @@
alootfunction = new LootFunction[0];
}
- return new LootEntryItem(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_);
+ return new LootEntryItem(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_, name);
}
}
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootEntryTable.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootEntryTable.java
@@ -14,9 +14,9 @@
{
protected final ResourceLocation field_186371_a;
- public LootEntryTable(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, LootCondition[] p_i46639_4_)
+ public LootEntryTable(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, LootCondition[] p_i46639_4_, String entryName)
{
- super(p_i46639_2_, p_i46639_3_, p_i46639_4_);
+ super(p_i46639_2_, p_i46639_3_, p_i46639_4_, entryName);
this.field_186371_a = p_i46639_1_;
}
@@ -34,7 +34,8 @@
public static LootEntryTable func_186370_a(JsonObject p_186370_0_, JsonDeserializationContext p_186370_1_, int p_186370_2_, int p_186370_3_, LootCondition[] p_186370_4_)
{
+ String name = net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186370_0_, "loot_table");
ResourceLocation resourcelocation = new ResourceLocation(JsonUtils.func_151200_h(p_186370_0_, "name"));
- return new LootEntryTable(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_);
+ return new LootEntryTable(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_, name);
}
}
@@ -0,0 +1,121 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootPool.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootPool.java
@@ -21,17 +21,19 @@
public class LootPool
{
- private final LootEntry[] field_186453_a;
- private final LootCondition[] field_186454_b;
+ private final List<LootEntry> field_186453_a;
+ private final List<LootCondition> field_186454_b;
private RandomValueRange field_186455_c;
private RandomValueRange field_186456_d;
+ private final String name;
- public LootPool(LootEntry[] p_i46643_1_, LootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_)
+ public LootPool(LootEntry[] p_i46643_1_, LootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_, String name)
{
- this.field_186453_a = p_i46643_1_;
- this.field_186454_b = p_i46643_2_;
+ this.field_186453_a = Lists.newArrayList(p_i46643_1_);
+ this.field_186454_b = Lists.newArrayList(p_i46643_2_);
this.field_186455_c = p_i46643_3_;
this.field_186456_d = p_i46643_4_;
+ this.name = name;
}
protected void func_186452_a(Collection<ItemStack> p_186452_1_, Random p_186452_2_, LootContext p_186452_3_)
@@ -72,7 +74,7 @@
public void func_186449_b(Collection<ItemStack> p_186449_1_, Random p_186449_2_, LootContext p_186449_3_)
{
- if (LootConditionManager.func_186638_a(this.field_186454_b, p_186449_2_, p_186449_3_))
+ if (LootConditionManager.testAllConditions(this.field_186454_b, p_186449_2_, p_186449_3_))
{
int i = this.field_186455_c.func_186511_a(p_186449_2_) + MathHelper.func_76141_d(this.field_186456_d.func_186507_b(p_186449_2_) * p_186449_3_.func_186491_f());
@@ -83,21 +85,74 @@
}
}
+ //======================== FORGE START =============================================
+ private boolean isFrozen = false;
+ public void freeze()
+ {
+ this.isFrozen = true;
+ }
+ public boolean isFrozen(){ return this.isFrozen; }
+ private void checkFrozen()
+ {
+ if (this.isFrozen())
+ throw new RuntimeException("Attempted to modify LootPool after being frozen!");
+ }
+
+ public String getName(){ return this.name; }
+ public RandomValueRange getRolls() { return this.field_186455_c; }
+ public RandomValueRange getBonusRolls() { return this.field_186456_d; }
+ public void setRolls (RandomValueRange v){ checkFrozen(); this.field_186455_c = v; }
+ public void setBonusRolls(RandomValueRange v){ checkFrozen(); this.field_186456_d = v; }
+
+ public LootEntry getEntry(String name)
+ {
+ for (LootEntry entry : this.field_186453_a)
+ if (name.equals(entry.getEntryName()))
+ return entry;
+ return null;
+ }
+ public LootEntry removeEntry(String name)
+ {
+ checkFrozen();
+ for (LootEntry entry : this.field_186453_a)
+ {
+ if (name.equals(entry.getEntryName()))
+ {
+ this.field_186453_a.remove(entry);
+ return entry;
+ }
+ }
+ return null;
+ }
+ public void addEntry(LootEntry entry)
+ {
+ checkFrozen();
+ for (LootEntry e : this.field_186453_a)
+ if (e == entry || e.getEntryName().equals(entry.getEntryName()))
+ throw new RuntimeException("Attempted to add a duplicate entry to pool: " + e.getEntryName());
+ this.field_186453_a.add(entry);
+ }
+ //TODO: Allow modifications of conditions? If so need a way to uniquely identify them.
+ //======================== FORGE END ===============================================
+
public static class Serializer implements JsonDeserializer<LootPool>, JsonSerializer<LootPool>
{
public LootPool deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
JsonObject jsonobject = JsonUtils.func_151210_l(p_deserialize_1_, "loot pool");
+ String name = net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject);
LootEntry[] alootentry = (LootEntry[])JsonUtils.func_188174_a(jsonobject, "entries", p_deserialize_3_, LootEntry[].class);
LootCondition[] alootcondition = (LootCondition[])JsonUtils.func_188177_a(jsonobject, "conditions", new LootCondition[0], p_deserialize_3_, LootCondition[].class);
RandomValueRange randomvaluerange = (RandomValueRange)JsonUtils.func_188174_a(jsonobject, "rolls", p_deserialize_3_, RandomValueRange.class);
RandomValueRange randomvaluerange1 = (RandomValueRange)JsonUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class);
- return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1);
+ return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1, name);
}
public JsonElement serialize(LootPool p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_)
{
JsonObject jsonobject = new JsonObject();
+ if (p_serialize_1_.name != null && !p_serialize_1_.name.startsWith("custom#"))
+ jsonobject.add("name", p_serialize_3_.serialize(p_serialize_1_.name));
jsonobject.add("entries", p_serialize_3_.serialize(p_serialize_1_.field_186453_a));
jsonobject.add("rolls", p_serialize_3_.serialize(p_serialize_1_.field_186455_c));
@@ -106,7 +161,7 @@
jsonobject.add("bonus_rolls", p_serialize_3_.serialize(p_serialize_1_.field_186456_d));
}
- if (!ArrayUtils.isEmpty((Object[])p_serialize_1_.field_186454_b))
+ if (!p_serialize_1_.field_186454_b.isEmpty())
{
jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.field_186454_b));
}
@@ -0,0 +1,75 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootTable.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootTable.java
@@ -24,11 +24,11 @@
{
private static final Logger field_186465_b = LogManager.getLogger();
public static final LootTable field_186464_a = new LootTable(new LootPool[0]);
- private final LootPool[] field_186466_c;
+ private final List<LootPool> field_186466_c;
public LootTable(LootPool[] p_i46641_1_)
{
- this.field_186466_c = p_i46641_1_;
+ this.field_186466_c = Lists.newArrayList(p_i46641_1_);
}
public List<ItemStack> func_186462_a(Random p_186462_1_, LootContext p_186462_2_)
@@ -146,6 +146,58 @@
return list;
}
+ //======================== FORGE START =============================================
+ private boolean isFrozen = false;
+ public void freeze()
+ {
+ this.isFrozen = true;
+ for (LootPool pool : this.field_186466_c)
+ pool.freeze();
+ }
+ public boolean isFrozen(){ return this.isFrozen; }
+ private void checkFrozen()
+ {
+ if (this.isFrozen())
+ throw new RuntimeException("Attempted to modify LootTable after being finalized!");
+ }
+
+ public LootPool getPool(String name)
+ {
+ for (LootPool pool : this.field_186466_c)
+ {
+ if (name.equals(pool.getName()))
+ return pool;
+ }
+ return null;
+ }
+
+ public LootPool removePool(String name)
+ {
+ checkFrozen();
+ for (LootPool pool : this.field_186466_c)
+ {
+ if (name.equals(pool.getName()))
+ {
+ this.field_186466_c.remove(pool);
+ return pool;
+ }
+ }
+
+ return null;
+ }
+
+ public void addPool(LootPool pool)
+ {
+ checkFrozen();
+ for (LootPool p : this.field_186466_c)
+ {
+ if (p == pool || p.getName().equals(pool.getName()))
+ throw new RuntimeException("Attempted to add a duplicate pool to loot table: " + pool.getName());
+ }
+ this.field_186466_c.add(pool);
+ }
+ //======================== FORGE END ===============================================
+
public static class Serializer implements JsonDeserializer<LootTable>, JsonSerializer<LootTable>
{
public LootTable deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
@@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootTableManager.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootTableManager.java
@@ -102,7 +102,7 @@
try
{
- return (LootTable)LootTableManager.field_186526_b.fromJson(s, LootTable.class);
+ return net.minecraftforge.common.ForgeHooks.loadLootTable(LootTableManager.field_186526_b, p_186517_1_, s, true);
}
catch (JsonParseException jsonparseexception)
{
@@ -142,7 +142,7 @@
try
{
- return (LootTable)LootTableManager.field_186526_b.fromJson(s, LootTable.class);
+ return net.minecraftforge.common.ForgeHooks.loadLootTable(LootTableManager.field_186526_b, p_186518_1_, s, false);
}
catch (JsonParseException jsonparseexception)
{
@@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/world/storage/loot/conditions/LootConditionManager.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/conditions/LootConditionManager.java
@@ -41,6 +41,16 @@
}
}
+
+ public static boolean testAllConditions(Iterable<LootCondition> conditions, Random rand, LootContext context)
+ {
+ if (conditions == null) return true;
+ for (LootCondition cond : conditions)
+ if (!cond.func_186618_a(rand, context))
+ return false;
+ return true;
+ }
+
public static boolean func_186638_a(LootCondition[] p_186638_0_, Random p_186638_1_, LootContext p_186638_2_)
{
if (p_186638_0_ == null)
@@ -6,6 +6,8 @@ import static net.minecraftforge.common.ForgeVersion.Status.BETA_OUTDATED;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL20.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.util.Collections;
@@ -77,6 +79,7 @@ import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.ScreenshotEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
@@ -705,4 +708,12 @@ public class ForgeHooksClient
{
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO));
}
public static ScreenshotEvent onScreenshot(BufferedImage image, File screenshotFile)
{
ScreenshotEvent event = new ScreenshotEvent(image, screenshotFile);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
}
@@ -3,6 +3,8 @@ package net.minecraftforge.client.event;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -48,7 +50,7 @@ public class GuiScreenEvent extends Event
}
/**
* The {@code buttonList} field from the GuiScreen object referenced by {@code gui}.
* The {@link #buttonList} field from the GuiScreen object referenced by {@link #gui}.
*/
public List<GuiButton> getButtonList()
{
@@ -61,11 +63,10 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires just after initializing {@code GuiScreen.mc}, {@code GuiScreen.fontRendererObj},
* {@code GuiScreen.width}, and {@code GuiScreen.height}, and just before calling {@code GuiScreen.buttonList.clear()}
* and {@code GuiScreen.initGui()}. To skip or override a screen's initGui() method cancel the event.<br/><br/>
* This event fires just after initializing {@link GuiScreen#mc}, {@link GuiScreen#fontRendererObj},
* {@link GuiScreen#width}, and {@link GuiScreen#height}.<br/><br/>
*
* If canceled the following lines are skipped in {@code GuiScreen.setWorldAndResolution()}:<br/>
* If canceled the following lines are skipped in {@link GuiScreen#setWorldAndResolution(Minecraft, int, int)}:<br/>
* {@code this.buttonList.clear();}<br/>
* {@code this.initGui();}<br/>
*/
@@ -79,7 +80,7 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires right after {@code GuiScreen.initGui()}.
* This event fires right after {@link GuiScreen#initGui()}.
* This is a good place to alter a GuiScreen's component layout if desired.
*/
public static class Post extends InitGuiEvent
@@ -130,8 +131,8 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires just before {@code GuiScreen.drawScreen()} is called.
* Cancel this event to skip {@code GuiScreen.drawScreen()}.
* This event fires just before {@link GuiScreen#drawScreen(int, int, float)} is called.
* Cancel this event to skip {@link GuiScreen#drawScreen(int, int, float)}.
*/
@Cancelable
public static class Pre extends DrawScreenEvent
@@ -143,7 +144,7 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires just after {@code GuiScreen.drawScreen()} is called.
* This event fires just after {@link GuiScreen#drawScreen(int, int, float)} is called.
*/
public static class Post extends DrawScreenEvent
{
@@ -155,7 +156,7 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires at the end of {@code GuiScreen.drawDefaultBackground()} and before the rest of the Gui draws.
* This event fires at the end of {@link GuiScreen#drawDefaultBackground()} and before the rest of the Gui draws.
* This allows drawing next to Guis, above the background but below any tooltips.
*/
public static class BackgroundDrawnEvent extends GuiScreenEvent
@@ -191,7 +192,7 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires in {@code InventoryEffectRenderer.updateActivePotionEffects()}
* This event fires in {@link InventoryEffectRenderer#updateActivePotionEffects()}
* when potion effects are active and the gui wants to move over.
* Cancel this event to prevent the Gui from being moved.
*/
@@ -230,7 +231,7 @@ public class GuiScreenEvent extends Event
}
/**
* A COPY of the {@code buttonList} field from the GuiScreen referenced by {@code gui}.
* A COPY of the {@link #buttonList} field from the GuiScreen referenced by {@link #gui}.
*/
public List<GuiButton> getButtonList()
{
@@ -244,7 +245,7 @@ public class GuiScreenEvent extends Event
/**
* This event fires once it has been determined that a GuiButton object has been clicked.
* Cancel this event to bypass {@code GuiScreen.actionPerformed()}.
* Cancel this event to bypass {@link GuiScreen#actionPerformed(GuiButton)}.
* Replace button with a different button from buttonList to have that button's action executed.
*/
@Cancelable
@@ -257,8 +258,8 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires after {@code GuiScreen.actionPerformed()} provided that the active
* screen has not been changed as a result of {@code GuiScreen.actionPerformed()}.
* This event fires after {@link GuiScreen#actionPerformed(GuiButton)} provided that the active
* screen has not been changed as a result of {@link GuiScreen#actionPerformed(GuiButton)}.
*/
public static class Post extends ActionPerformedEvent
{
@@ -278,7 +279,7 @@ public class GuiScreenEvent extends Event
/**
* This event fires when mouse input is detected by a GuiScreen.
* Cancel this event to bypass {@code GuiScreen.handleMouseInput()}.
* Cancel this event to bypass {@link GuiScreen#handleMouseInput()}.
*/
@Cancelable
public static class Pre extends MouseInputEvent
@@ -290,8 +291,8 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires after {@code GuiScreen.handleMouseInput()} provided that the active
* screen has not been changed as a result of {@code GuiScreen.handleMouseInput()}.
* This event fires after {@link GuiScreen#handleMouseInput()} provided that the active
* screen has not been changed as a result of {@link GuiScreen#handleMouseInput()}.
*/
public static class Post extends MouseInputEvent
{
@@ -311,7 +312,7 @@ public class GuiScreenEvent extends Event
/**
* This event fires when keyboard input is detected by a GuiScreen.
* Cancel this event to bypass {@code GuiScreen.handleKeyboardInput()}.
* Cancel this event to bypass {@link GuiScreen#handleKeyboardInput()}.
*/
@Cancelable
public static class Pre extends KeyboardInputEvent
@@ -323,8 +324,8 @@ public class GuiScreenEvent extends Event
}
/**
* This event fires after {@code GuiScreen.handleKeyboardInput()} provided that the active
* screen has not been changed as a result of {@code GuiScreen.handleKeyboardInput()}.
* This event fires after {@link GuiScreen#handleKeyboardInput()} provided that the active
* screen has not been changed as a result of {@link GuiScreen#handleKeyboardInput()}.
*/
public static class Post extends KeyboardInputEvent
{
@@ -0,0 +1,67 @@
package net.minecraftforge.client.event;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import java.awt.image.BufferedImage;
import java.io.File;
/**
* This event is fired before and after a screenshot is taken
* This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}
* This event is {@link Cancelable}
*
* {@link #screenshotFile} contains the file the screenshot will be/was saved to
* {@link #image} contains the {@link BufferedImage} that will be saved
* {@link #resultMessage} contains the {@link ITextComponent} to be returned. If {@code null}, the default vanilla message will be used instead
*/
@Cancelable
public class ScreenshotEvent extends Event
{
public static final ITextComponent DEFAULT_CANCEL_REASON = new TextComponentString("Screenshot canceled");
private BufferedImage image;
private File screenshotFile;
private ITextComponent resultMessage = null;
public ScreenshotEvent(BufferedImage image, File screenshotFile)
{
this.image = image;
this.screenshotFile = screenshotFile;
}
public BufferedImage getImage()
{
return image;
}
public File getScreenshotFile()
{
return screenshotFile;
}
public void setScreenshotFile(File screenshotFile)
{
this.screenshotFile = screenshotFile;
}
public ITextComponent getResultMessage()
{
return resultMessage;
}
public void setResultMessage(ITextComponent resultMessage)
{
this.resultMessage = resultMessage;
}
public ITextComponent getCancelMessage()
{
return getResultMessage() != null ? getResultMessage() : DEFAULT_CANCEL_REASON;
}
}
@@ -47,6 +47,8 @@ public final class ItemTextureQuadConverter
{
int w = template.getIconWidth();
int h = template.getIconHeight();
float wScale = 16f / (float)w;
float hScale = 16f / (float)h;
int[] data = template.getFrameTextureData(0)[0];
List<UnpackedBakedQuad> quads = Lists.newArrayList();
@@ -90,7 +92,12 @@ public final class ItemTextureQuadConverter
}
// create the quad
quads.add(genQuad(format, transform, start, y, x, endY, z, sprite, facing, color));
quads.add(genQuad(format, transform,
(float)start * wScale,
(float)y * hScale,
(float)x * wScale,
(float)endY * hScale,
z, sprite, facing, color));
// update Y if all the rows match. no need to rescan
if (endY - y > 1)
@@ -114,6 +121,8 @@ public final class ItemTextureQuadConverter
{
int w = template.getIconWidth();
int h = template.getIconHeight();
float wScale = 16f / (float)w;
float hScale = 16f / (float)h;
int[] data = template.getFrameTextureData(0)[0];
List<UnpackedBakedQuad> quads = Lists.newArrayList();
@@ -157,7 +166,12 @@ public final class ItemTextureQuadConverter
}
// create the quad
quads.add(genQuad(format, transform, x, start, endX, y, z, sprite, facing, color));
quads.add(genQuad(format, transform,
(float)x * wScale,
(float)start * hScale,
(float)endX * wScale,
(float)y * hScale,
z, sprite, facing, color));
// update X if all the columns match. no need to rescan
if (endX - x > 1)
@@ -181,6 +195,7 @@ public final class ItemTextureQuadConverter
/**
* Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH.
* Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
*/
public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, EnumFacing facing, int color)
{
@@ -140,7 +140,7 @@ public class BiomeDictionary
* Registers a biome with a specific biome type
*
* @param biome the biome to be registered
* @param type the type to register the biome as
* @param types the types to register the biome as
* @return returns true if the biome was registered successfully
*/
public static boolean registerBiomeType(BiomeGenBase biome, Type ... types)
@@ -1,5 +1,9 @@
package net.minecraftforge.common;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.EnumHelper;
public enum EnumPlantType
@@ -14,16 +18,16 @@ public enum EnumPlantType
/**
* Getting a custom {@link EnumPlantType}, or an existing one if it has the same name as that one. Your plant should implement {@link IPlantable}
* and return this custom type in {@link IPlantable#getPlantType(net.minecraft.world.IBlockAccess, net.minecraft.util.BlockPos)}.
* and return this custom type in {@link IPlantable#getPlantType(IBlockAccess, BlockPos)}.
*
* <p>If your new plant grows on blocks like any one of them above, never create a new {@link EnumPlantType}.
* This enumeration is only functioning in
* {@link net.minecraft.block.Block#canSustainPlant(net.minecraft.world.IBlockAccess, net.minecraft.util.BlockPos, net.minecraft.util.EnumFacing, IPlantable)},
* {@link net.minecraft.block.Block#canSustainPlant(IBlockState, IBlockAccess, BlockPos, EnumFacing, IPlantable)},
* which you are supposed to override this function in your new block and create a new plant type to grow on that block.
*
* <p>You can create an instance of your plant type in your API and let your/others mods access it. It will be faster than calling this method.
* @param name the name of the type of plant, you had better follow the style above
* @return the acquired {@EnumPlantType}, a new one if not found.
* @return the acquired {@link EnumPlantType}, a new one if not found.
*/
public static EnumPlantType getPlantType(String name)
{
@@ -3,12 +3,21 @@ package net.minecraftforge.common;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Throwables;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
@@ -47,6 +56,8 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -61,6 +72,10 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.world.storage.loot.LootEntry;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.LootTableManager;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.event.AnvilUpdateEvent;
import net.minecraftforge.event.ForgeEventFactory;
@@ -561,9 +576,9 @@ public class ForgeHooks
static final Pattern URL_PATTERN = Pattern.compile(
// schema ipv4 OR namespace port path ends
// |-----------------| |-------------------------| |----------------------------| |---------| |--| |---------------|
"((?:[a-z0-9]{2,}:\\/\\/)?(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}|(?:[-\\w_\\.]{1,}\\.[a-z]{2,}?))(?::[0-9]{1,5})?.*?(?=[!\"\u00A7 \n]|$))",
// schema ipv4 OR namespace port path ends
// |-----------------| |-------------------------| |-------------------------| |---------| |--| |---------------|
"((?:[a-z0-9]{2,}:\\/\\/)?(?:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}|(?:[-\\w_]{1,}\\.[a-z]{2,}?))(?::[0-9]{1,5})?.*?(?=[!\"\u00A7 \n]|$))",
Pattern.CASE_INSENSITIVE);
public static ITextComponent newChatWithLinks(String string){ return newChatWithLinks(string, true); }
@@ -970,4 +985,135 @@ public class ForgeHooks
{
MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.RightClickEmpty(player, hand));
}
private static ThreadLocal<Deque<LootTableContext>> lootContext = new ThreadLocal<Deque<LootTableContext>>();
private static LootTableContext getLootTableContext()
{
LootTableContext ctx = lootContext.get().peek();
if (ctx == null)
throw new JsonParseException("Invalid call stack, could to grab json context!"); // Show I throw this? Do we care about custom deserializers outside the manager?
return ctx;
}
public static LootTable loadLootTable(Gson gson, ResourceLocation name, String data, boolean custom)
{
Deque<LootTableContext> que = lootContext.get();
if (que == null)
{
que = Queues.newArrayDeque();
lootContext.set(que);
}
LootTable ret = null;
try
{
que.push(new LootTableContext(name, custom));
ret = gson.fromJson(data, LootTable.class);
que.pop();
}
catch (JsonParseException e)
{
que.pop();
throw e;
}
if (!custom)
ret = ForgeEventFactory.loadLootTable(name, ret);
if (ret != null)
ret.freeze();
return ret;
}
private static class LootTableContext
{
public final ResourceLocation name;
private final boolean vanilla;
public final boolean custom;
public int poolCount = 0;
public int entryCount = 0;
private HashSet<String> entryNames = Sets.newHashSet();
private LootTableContext(ResourceLocation name, boolean custom)
{
this.name = name;
this.custom = custom;
this.vanilla = "minecraft".equals(this.name.getResourceDomain());
}
private void resetPoolCtx()
{
this.entryCount = 0;
this.entryNames.clear();
}
public String validateEntryName(String name)
{
if (!this.entryNames.contains(name))
{
this.entryNames.add(name);
return name;
}
if (!this.vanilla)
throw new JsonParseException("Loot Table \"" + this.name.toString() + "\" Duplicate entry name \"" + name + "\" for pool #" + (this.poolCount - 1) + " entry #" + (this.entryCount-1));
int x = 0;
while (this.entryNames.contains(name + "#" + x))
x++;
name = name + "#" + x;
this.entryNames.add(name);
return name;
}
}
public static String readPoolName(JsonObject json)
{
LootTableContext ctx = ForgeHooks.getLootTableContext();
ctx.resetPoolCtx();
if (json.has("name"))
return JsonUtils.getString(json, "name");
if (ctx.custom)
return "custom#" + json.hashCode(); //We don't care about custom ones modders shouldn't be editing them!
ctx.poolCount++;
if (!ctx.vanilla)
throw new JsonParseException("Loot Table \"" + ctx.name.toString() + "\" Missing `name` entry for pool #" + (ctx.poolCount - 1));
return ctx.poolCount == 1 ? "main" : "pool" + (ctx.poolCount - 1);
}
public static String readLootEntryName(JsonObject json, String type)
{
LootTableContext ctx = ForgeHooks.getLootTableContext();
ctx.entryCount++;
if (json.has("entryName"))
return ctx.validateEntryName(JsonUtils.getString(json, "entryName"));
if (ctx.custom)
return "custom#" + json.hashCode(); //We don't care about custom ones modders shouldn't be editing them!
String name = null;
if ("item".equals(type))
name = JsonUtils.getString(json, "name");
else if ("loot_table".equals(type))
name = JsonUtils.getString(json, "name");
else if ("empty".equals(type))
name = "empty";
return ctx.validateEntryName(name);
}
//TODO: Some registry to support custom LootEntry types?
public static LootEntry deserializeJsonLootEntry(String type, JsonObject json, int weight, int quality, LootCondition[] conditions){ return null; }
public static String getLootEntryType(LootEntry entry){ return null; } //Companion to above function
}
@@ -35,7 +35,7 @@ public class ForgeVersion
//This number is incremented every minecraft release, never reset
public static final int minorVersion = 16;
//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 = 0;
public static final int revisionVersion = 1;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0;
// This is the minecraft version we're building for - used in various places in Forge/FML code
@@ -92,7 +92,7 @@ public class ForgeVersion
AHEAD(),
BETA(),
BETA_OUTDATED(6, true);
final int sheetOffset;
final boolean draw, animated;
@@ -100,39 +100,39 @@ public class ForgeVersion
{
this(0, false, false);
}
Status(int sheetOffset)
{
this(sheetOffset, true, false);
}
Status(int sheetOffset, boolean animated)
{
this(sheetOffset, true, animated);
}
Status(int sheetOffset, boolean draw, boolean animated)
{
this.sheetOffset = sheetOffset;
this.draw = draw;
this.animated = animated;
}
public int getSheetOffset()
{
return sheetOffset;
}
public boolean shouldDraw()
{
return draw;
}
public boolean isAnimated()
{
return animated;
}
}
public static class CheckResult
@@ -332,7 +332,7 @@ public final class TimeValues
if(SimpleExprValue.opsPattern.matcher(type).matches())
{
ImmutableList.Builder<ITimeValue> builder = ImmutableList.builder();
while(in.peek() != JsonToken.END_ARRAY)
while(in.hasNext())
{
builder.add(read(in));
}
@@ -55,7 +55,7 @@ public class Capability<T>
* @param capability The Capability being stored.
* @param instance An instance of that capabilities interface.
* @param side The side of the object the instance is associated with.
* @param A NBT holding the data. Must not be null, as doesn't make sense to call this function with nothing to read...
* @param nbt A NBT holding the data. Must not be null, as doesn't make sense to call this function with nothing to read...
*/
void readNBT(Capability<T> capability, T instance, EnumFacing side, NBTBase nbt);
}
@@ -60,7 +60,7 @@ public enum CapabilityManager
*
* @param type The Interface to be registered
* @param storage A default implementation of the storage handler.
* @param factor A Factory that will produce new instances of the default implementation.
* @param factory A Factory that will produce new instances of the default implementation.
*/
public <T> void register(Class<T> type, Capability.IStorage<T> storage, Callable<? extends T> factory)
{
@@ -45,17 +45,20 @@ public class ChunkIOExecutor
ChunkIOProvider task = tasks.get(key);
if (task != null)
{
if (!pool.remove(task) && !task.runFinished()) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
if (!pool.remove(task)) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
{
synchronized(task)
{
try
while (!task.runFinished())
{
task.wait();
}
catch (InterruptedException e)
{
e.printStackTrace(); // Something happened? Log it?
try
{
task.wait();
}
catch (InterruptedException e)
{
e.printStackTrace(); // Something happened? Log it?
}
}
}
}
@@ -67,7 +67,8 @@ class ChunkIOProvider implements Runnable
if (chunk == null)
{
// If the chunk loading failed just do it synchronously (may generate)
provider.originalLoadChunk(this.chunkInfo.x, this.chunkInfo.z);
this.chunk = provider.originalLoadChunk(this.chunkInfo.x, this.chunkInfo.z);
this.runCallbacks();
return;
}
@@ -87,13 +88,7 @@ class ChunkIOProvider implements Runnable
}
this.chunk.populateChunk(provider, provider.chunkGenerator);
for (Runnable r : this.callbacks)
{
r.run();
}
this.callbacks.clear();
this.runCallbacks();
}
public Chunk getChunk()
@@ -110,4 +105,14 @@ class ChunkIOProvider implements Runnable
{
return this.callbacks.size() > 0;
}
public void runCallbacks()
{
for (Runnable r : this.callbacks)
{
r.run();
}
this.callbacks.clear();
}
}
@@ -36,7 +36,10 @@ import java.util.regex.Pattern;
import com.google.common.base.CharMatcher;
import com.google.common.collect.ImmutableSet;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.GuiConfigEntries;
import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry;
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;
@@ -1215,9 +1218,15 @@ public class Configuration
/**
* Sets the custom IConfigEntry class that should be used in place of the standard entry class (which is just a button that
* navigates into the category). This class MUST provide a constructor with the following parameter types: {@code GuiConfig} (the parent
* GuiConfig screen will be provided), {@code GuiPropertyList} (the parent GuiPropertyList will be provided), {@code IConfigElement}
* navigates into the category). This class MUST provide a constructor with the following parameter types: {@link GuiConfig} (the parent
* GuiConfig screen will be provided), {@link GuiConfigEntries} (the parent GuiConfigEntries will be provided), {@link IConfigElement}
* (the IConfigElement for this Property will be provided).
*
* @see GuiConfigEntries.ListEntryBase
* @see GuiConfigEntries.StringEntry
* @see GuiConfigEntries.BooleanEntry
* @see GuiConfigEntries.DoubleEntry
* @see GuiConfigEntries.IntegerEntry
*/
public Configuration setCategoryConfigEntryClass(String category, Class<? extends IConfigEntry> clazz)
{
@@ -1561,7 +1570,7 @@ public class Configuration
*
* @param name Name of the property.
* @param category Category of the property.
* @param defaultValue Default value of the property.
* @param defaultValues Default values of the property.
* @param comment A brief description what the property does.
* @return The value of the new string property.
*/
@@ -9,8 +9,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.regex.Pattern;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.GuiConfigEntries;
import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry;
import net.minecraftforge.fml.client.config.GuiEditArray;
import net.minecraftforge.fml.client.config.GuiEditArrayEntries;
import net.minecraftforge.fml.client.config.GuiEditArrayEntries.IArrayEntry;
import net.minecraftforge.fml.client.config.IConfigElement;
public class Property
{
@@ -383,9 +388,15 @@ public class Property
/**
* Sets a custom IConfigEntry class that should be used in place of the standard entry class for this Property type. This class
* MUST provide a constructor with the following parameter types: {@code GuiConfig} (the owning GuiConfig screen will be provided),
* {@code GuiConfigEntries} (the owning GuiConfigEntries will be provided), {@code IConfigElement} (the IConfigElement for this Property
* MUST provide a constructor with the following parameter types: {@link GuiConfig} (the owning GuiConfig screen will be provided),
* {@link GuiConfigEntries} (the owning GuiConfigEntries will be provided), {@link IConfigElement} (the IConfigElement for this Property
* will be provided).
*
* @see GuiConfigEntries.ListEntryBase
* @see GuiConfigEntries.StringEntry
* @see GuiConfigEntries.BooleanEntry
* @see GuiConfigEntries.DoubleEntry
* @see GuiConfigEntries.IntegerEntry
*/
public Property setConfigEntryClass(Class<? extends IConfigEntry> clazz)
{
@@ -406,11 +417,15 @@ public class Property
/**
* Sets a custom IGuiEditListEntry class that should be used in place of the standard entry class for this Property type. This class
* MUST provide a constructor with the following parameter types: {@code GuiEditList} (the owning GuiEditList screen will be provided),
* {@code GuiPropertyList} (the parent GuiPropertyList will be provided), {@code IConfigProperty} (the IConfigProperty for this Property
* will be provided).
* MUST provide a constructor with the following parameter types: {@link GuiEditArray} (the owning GuiEditArray screen will be provided),
* {@link GuiEditArrayEntries} (the parent GuiEditArrayEntries will be provided), {@link IConfigElement} (the IConfigElement for this Property
* will be provided), and {@link Object} for the property's value.
*
* @param clazz a class that implements IConfigEntry
* @see GuiEditArrayEntries.BaseEntry
* @see GuiEditArrayEntries.StringEntry
* @see GuiEditArrayEntries.BooleanEntry
* @see GuiEditArrayEntries.DoubleEntry
* @see GuiEditArrayEntries.IntegerEntry
*/
public Property setArrayEntryClass(Class<? extends IArrayEntry> clazz)
{
@@ -855,7 +870,6 @@ public class Property
/**
* Returns the value in this property as a double, if the value is not a valid double, it will return the provided default.
*
* @param _default The default to provide if the current value is not a valid double
* @return The value
*/
public double getDouble()
@@ -2,8 +2,19 @@ package net.minecraftforge.common.model.animation;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Supplier;
import com.google.common.collect.*;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
@@ -25,12 +36,6 @@ import com.google.common.base.Predicate;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.annotations.SerializedName;
public final class AnimationStateMachine implements IAnimationStateMachine
@@ -38,7 +43,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
private final ImmutableMap<String, ITimeValue> parameters;
private final ImmutableMap<String, IClip> clips;
private final ImmutableList<String> states;
private final ImmutableMap<String, String> transitions;
private final ImmutableMultimap<String, String> transitions;
@SerializedName("start_state")
private final String startState;
@@ -58,7 +63,25 @@ public final class AnimationStateMachine implements IAnimationStateMachine
}
});
@Deprecated
public AnimationStateMachine(ImmutableMap<String, ITimeValue> parameters, ImmutableMap<String, IClip> clips, ImmutableList<String> states, ImmutableMap<String, String> transitions, String startState)
{
this(parameters, clips, states, ImmutableMultimap.copyOf(Multimaps.newSetMultimap(Maps.transformValues(transitions, new Function<String, Collection<String>>()
{
public Collection<String> apply(String input)
{
return ImmutableSet.of(input);
}
}), new Supplier<Set<String>>()
{
public Set<String> get()
{
return Sets.newHashSet();
}
})), startState);
}
public AnimationStateMachine(ImmutableMap<String, ITimeValue> parameters, ImmutableMap<String, IClip> clips, ImmutableList<String> states, ImmutableMultimap<String, String> transitions, String startState)
{
this.parameters = parameters;
this.clips = clips;
@@ -148,7 +171,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
{
throw new IllegalStateException("unknown state: " + newState);
}
if(!transitions.get(currentStateName).equals(newState))
if(!transitions.containsEntry(currentStateName, newState))
{
throw new IllegalArgumentException("no transition from current clip \"" + currentStateName + "\" to the clip \"" + newState + "\" found.");
}
@@ -208,7 +231,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
ImmutableMap.<String, ITimeValue>of(),
ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.INSTANCE),
ImmutableList.of("missingno"),
ImmutableMap.<String, String>of(),
ImmutableMultimap.<String, String>of(),
"missingno");
static
@@ -216,7 +239,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
missing.initialize();
}
public static final AnimationStateMachine getMissing()
public static AnimationStateMachine getMissing()
{
return missing;
}
@@ -257,8 +280,62 @@ public final class AnimationStateMachine implements IAnimationStateMachine
.registerTypeAdapterFactory(Clips.CommonClipTypeAdapterFactory.INSTANCE)
//.registerTypeAdapterFactory(ClipProviders.CommonClipProviderTypeAdapterFactory.INSTANCE)
.registerTypeAdapterFactory(TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE)
.registerTypeAdapterFactory(TransitionsAdapterFactory.INSTANCE)
.setPrettyPrinting()
.enableComplexMapKeySerialization()
.disableHtmlEscaping()
.create();
private enum TransitionsAdapterFactory implements TypeAdapterFactory
{
INSTANCE;
@SuppressWarnings("unchecked")
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
{
if(type.getRawType() != ImmutableMultimap.class || !(type.getType() instanceof ParameterizedType))
{
return null;
}
final Type[] typeArguments = ((ParameterizedType) type.getType()).getActualTypeArguments();
if(typeArguments.length != 2 || typeArguments[0] != String.class || typeArguments[1] != String.class)
{
return null;
}
final TypeAdapter<Map<String, Collection<String>>> mapAdapter = gson.getAdapter(new TypeToken<Map<String, Collection<String>>>(){});
final TypeAdapter<Collection<String>> collectionAdapter = gson.getAdapter(new TypeToken<Collection<String>>(){});
return (TypeAdapter<T>)new TypeAdapter<ImmutableMultimap<String, String>>()
{
@Override
public void write(JsonWriter out, ImmutableMultimap<String, String> value) throws IOException
{
mapAdapter.write(out, value.asMap());
}
@Override
public ImmutableMultimap<String, String> read(JsonReader in) throws IOException
{
ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder();
in.beginObject();
while(in.hasNext())
{
String key = in.nextName();
switch(in.peek())
{
case STRING:
builder.put(key, in.nextString());
break;
case BEGIN_ARRAY:
builder.putAll(key, collectionAdapter.read(in));
break;
default:
throw new JsonParseException("Expected String or Array, got " + in.peek());
}
}
in.endObject();
return builder.build();
}
};
}
}
}
@@ -282,11 +282,16 @@ public final class Clips
return Optional.absent();
}
IJoint joint = (IJoint)part.get();
if(!joint.getParent().isPresent())
// TODO: Cache clip application?
TRSRTransformation jointTransform = clip.apply(joint).apply(time).compose(joint.getInvBindPose());
Optional<? extends IJoint> parent = joint.getParent();
while(parent.isPresent())
{
return Optional.of(clip.apply(joint).apply(time).compose(joint.getInvBindPose()));
TRSRTransformation parentTransform = clip.apply(parent.get()).apply(time);
jointTransform = parentTransform.compose(jointTransform);
parent = parent.get().getParent();
}
return Optional.of(clip.apply(joint.getParent().get()).apply(time).compose(clip.apply(joint).apply(time)).compose(joint.getInvBindPose()));
return Optional.of(jointTransform);
}
}, clip.pastEvents(lastPollTime, time));
}
@@ -1,5 +1,8 @@
package net.minecraftforge.event;
import net.minecraft.command.CommandHandler;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.command.ICommand;
@@ -7,8 +10,8 @@ import net.minecraft.command.ICommandSender;
/**
* CommandEvent is fired whenever a command is scheduled to be executed.
* This event is fired during the invocation of CommandHandler#executeCommand(ICommandSender, String)
* and ClientCommandHandler#executeCommand(ICommandSender, String). <br>
* This event is fired during the invocation of {@link CommandHandler#executeCommand(ICommandSender, String)}
* and {@link ClientCommandHandler#executeCommand(ICommandSender, String)}. <br>
* <br>
* {@link #command} contains the instance of ICommand which is representative of the currently executing command.<br>
* {@link #sender} contains the instance of ICommandSender for the given command sender.<br>
@@ -3,6 +3,7 @@ package net.minecraftforge.event;
import java.io.File;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
@@ -23,6 +24,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
@@ -38,6 +40,7 @@ import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.storage.IPlayerFileData;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
import net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType;
@@ -525,9 +528,27 @@ public class ForgeEventFactory
return event.getResult() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY;
}
/**
* @deprecated Use {@link #onChunkPopulate(boolean, IChunkGenerator, World, Random, int, int, boolean)}<br>
* The Random param should not be world.rand, it should be the same chunk-position-seeded rand used by the Chunk Provider.
*/
@Deprecated
public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, int x, int z, boolean hasVillageGenerated)
{
MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, world.rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, world.rand, x, z, hasVillageGenerated));
}
public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, Random rand, int x, int z, boolean hasVillageGenerated)
{
MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, rand, x, z, hasVillageGenerated));
}
public static LootTable loadLootTable(ResourceLocation name, LootTable table)
{
LootTableLoadEvent event = new LootTableLoadEvent(name, table);
if (MinecraftForge.EVENT_BUS.post(event))
return LootTable.EMPTY_LOOT_TABLE;
return event.getTable();
}
}
@@ -0,0 +1,43 @@
package net.minecraftforge.event;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Event fired when a LootTable json is loaded from json.
* This event is fired whenever resources are loaded, or when the server starts.
* This event will NOT be fired for LootTables loaded from the world folder, these are
* considered configurations files and should not be modified by mods.
*
* Canceling the event will make it load a empty loot table.
*
*/
@Cancelable
public class LootTableLoadEvent extends Event
{
private final ResourceLocation name;
private LootTable table;
public LootTableLoadEvent(ResourceLocation name, LootTable table)
{
this.name = name;
this.table = table;
}
public ResourceLocation getName()
{
return this.name;
}
public LootTable getTable()
{
return this.table;
}
public void setTable(LootTable table)
{
this.table = table;
}
}
@@ -1,5 +1,8 @@
package net.minecraftforge.event;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.CPacketChatMessage;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -7,8 +10,8 @@ import net.minecraft.util.text.ITextComponent;
/**
* ServerChatEvent is fired whenever a C01PacketChatMessage is processed. <br>
* This event is fired via {@link ForgeHooks#onServerChatEvent(net.minecraft.network.NetHandlerPlayServer, String, ChatComponentTranslation)},
* which is executed by the NetHandlerPlayServer#processChatMessage(net.minecraft.network.play.client.C01PacketChatMessage)<br>
* This event is fired via {@link ForgeHooks#onServerChatEvent(NetHandlerPlayServer, String, ITextComponent)},
* which is executed by the {@link NetHandlerPlayServer#processChatMessage(CPacketChatMessage)}<br>
* <br>
* {@link #username} contains the username of the player sending the chat message.<br>
* {@link #message} contains the message being sent.<br>
@@ -1,6 +1,8 @@
package net.minecraftforge.event.brewing;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityBrewingStand;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
@@ -38,9 +40,9 @@ public class PotionBrewEvent extends Event
* PotionBrewEvent.Pre is fired before vanilla brewing takes place.
* All changes made to the event's array will be made to the TileEntity if the event is canceled.
* <br>
* The event is fired during the TileEntityBrewingStand#brewPotions() method invocation.<br>
* The event is fired during the {@link TileEntityBrewingStand#brewPotions()} method invocation.<br>
* <br>
* {@link #brewingStacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.<br>
* {@link #stacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If the event is not canceled, the vanilla brewing will take place instead of modded brewing.
@@ -63,9 +65,9 @@ public class PotionBrewEvent extends Event
/**
* PotionBrewEvent.Post is fired when a potion is brewed in the brewing stand.
* <br>
* The event is fired during the TileEntityBrewingStand#brewPotions() method invocation.<br>
* The event is fired during the {@link TileEntityBrewingStand#brewPotions()} method invocation.<br>
* <br>
* {@link #brewingStacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.<br>
* {@link #stacks} contains the itemstack array from the TileEntityBrewer holding all items in Brewer.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -1,5 +1,9 @@
package net.minecraftforge.event.entity;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.Entity;
@@ -47,7 +51,7 @@ public class EntityEvent extends Event
/**
* CanUpdate is fired when an Entity is being created. <br>
* This event is fired whenever vanilla Minecraft determines that an entity<br>
* cannot update in World#updateEntityWithOptionalForce(net.minecraft.entity.Entity, boolean) <br>
* cannot update in {@link World#updateEntityWithOptionalForce(net.minecraft.entity.Entity, boolean)} <br>
* <br>
* {@link CanUpdate#canUpdate} contains the boolean value of whether this entity can update.<br>
* If the modder decides that this Entity can be updated, they may change canUpdate to true, <br>
@@ -79,7 +83,7 @@ public class EntityEvent extends Event
/**
* EnteringChunk is fired when an Entity enters a chunk. <br>
* This event is fired whenever vanilla Minecraft determines that an entity <br>
* is entering a chunk in Chunk#addEntity(net.minecraft.entity.Entity) <br>
* is entering a chunk in {@link Chunk#addEntity(net.minecraft.entity.Entity)} <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -1,13 +1,17 @@
package net.minecraftforge.event.entity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import java.util.Collection;
/**
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
* This event is fired whenever an Entity is added to the world in
* World#addLoadedEntities(java.util.List), World#joinEntityInSurroundings(Entity), and World#spawnEntityInWorld(Entity). <br>
* {@link World#loadEntities(Collection)}, {@link WorldServer#loadEntities(Collection)} {@link World#joinEntityInSurroundings(Entity)}, and {@link World#spawnEntityInWorld(Entity)}. <br>
* <br>
* {@link #world} contains the world in which the entity is to join.<br>
* <br>
@@ -2,6 +2,7 @@ package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
@@ -1,5 +1,7 @@
package net.minecraftforge.event.entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.EntityLightningBolt;
@@ -7,7 +9,7 @@ import net.minecraft.entity.effect.EntityLightningBolt;
/**
* EntityStruckByLightningEvent is fired when an Entity is about to be struck by lightening.<br>
* This event is fired whenever an EntityLightningBolt is updated to strike an Entity in
* EntityLightningBolt#onUpdate() via {@link ForgeEventFactory#onEntityStruckByLightning(Entity, EntityLightningBolt)}.<br>
* {@link EntityLightningBolt#onUpdate()} via {@link ForgeEventFactory#onEntityStruckByLightning(Entity, EntityLightningBolt)}.<br>
* <br>
* {@link #lightning} contains the instance of EntityLightningBolt attempting to strike an entity.<br>
* <br>
@@ -1,6 +1,7 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
@@ -1,5 +1,10 @@
package net.minecraftforge.event.entity;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.util.SoundCategory;
@@ -8,8 +13,7 @@ import net.minecraft.util.SoundEvent;
/**
* PlaySoundAtEntityEvent is fired a sound is to be played at an Entity<br>
* This event is fired whenever a sound is set to be played at an Entity such as in
* EntityPlayerSP#playSound(String, float, float), World#playSoundAtEntity(Entity, String, float, float),
* and World#playerSoundToNearExcept(EntityPlayer, String, float, float).<br>
* {@link EntityPlayerSP#playSound(SoundEvent, float, float)} and {@link World#playSound(EntityPlayer, double, double, double, SoundEvent, SoundCategory, float, float)}.<br>
* <br>
* {@link #name} contains the name of the sound to be played at the Entity.<br>
* {@link #volume} contains the volume at which the sound is to be played originally.<br>
@@ -1,5 +1,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
@@ -7,8 +10,8 @@ import net.minecraft.entity.EntityLivingBase;
/**
* LivingAttackEvent is fired when a living Entity is attacked. <br>
* This event is fired whenever an Entity is attacked in
* EntityLivingBase#attackEntityFrom(DamageSource, float) and
* EntityPlayer#attackEntityFrom(DamageSource, float). <br>
* {@link EntityLivingBase#attackEntityFrom(DamageSource, float)} and
* {@link EntityPlayer#attackEntityFrom(DamageSource, float)}. <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingAttack(EntityLivingBase, DamageSource, float)}.<br>
* <br>
@@ -1,5 +1,9 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
@@ -7,9 +11,9 @@ import net.minecraft.entity.EntityLivingBase;
/**
* LivingDeathEvent is fired when an Entity dies. <br>
* This event is fired whenever an Entity dies in
* EntityLivingBase#onDeath(DamageSource),
* EntityPlayer#onDeath(DamageSource), and
* EntityPlayerMP#onDeath(DamageSource). <br>
* {@link EntityLivingBase#onDeath(DamageSource)},
* {@link EntityPlayer#onDeath(DamageSource)}, and
* {@link EntityPlayerMP#onDeath(DamageSource)}. <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingDeath(EntityLivingBase, DamageSource)}.<br>
* <br>
@@ -1,7 +1,10 @@
package net.minecraftforge.event.entity.living;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.item.EntityItem;
@@ -10,9 +13,9 @@ import net.minecraft.entity.EntityLivingBase;
/**
* LivingDropsEvent is fired when an Entity's death causes dropped items to appear.<br>
* This event is fired whenever an Entity dies and drops items in
* EntityLivingBase#onDeath(DamageSource).<br>
* {@link EntityLivingBase#onDeath(DamageSource)}.<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingDrops(EntityLivingBase, DamageSource, ArrayList<EntityItem>, int, boolean, int)}.<br>
* This event is fired via the {@link ForgeHooks#onLivingDrops(EntityLivingBase, DamageSource, ArrayList, int, boolean)}.<br>
* <br>
* {@link #source} contains the DamageSource that caused the drop to occur.<br>
* {@link #drops} contains the ArrayList of EntityItems that will be dropped.<br>
@@ -1,7 +1,12 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
/**
@@ -28,7 +33,7 @@ public class LivingEvent extends EntityEvent
/**
* LivingUpdateEvent is fired when an Entity is updated. <br>
* This event is fired whenever an Entity is updated in
* EntityLivingBase#onUpdate(). <br>
* {@link EntityLivingBase#onUpdate()}. <br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingUpdate(EntityLivingBase)}.<br>
* <br>
@@ -48,8 +53,8 @@ public class LivingEvent extends EntityEvent
/**
* LivingJumpEvent is fired when an Entity jumps.<br>
* This event is fired whenever an Entity jumps in
* EntityLivingBase#jump(), EntityMagmaCube#jump(),
* and EntityHorse#jump().<br>
* {@link EntityLivingBase#jump()}, {@link EntityMagmaCube#jump()},
* and {@link EntityHorse#jump()}.<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingJump(EntityLivingBase)}.<br>
* <br>
@@ -1,14 +1,16 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
/**
* LivingFallEvent is fired when an Entity is set to be falling.<br>
* This event is fired whenever an Entity is set to fall in
* EntityLivingBase#fall(float).<br>
* {@link EntityLivingBase#fall(float, float)}.<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingFall(EntityLivingBase, float)}.<br>
* This event is fired via the {@link ForgeHooks#onLivingFall(EntityLivingBase, float, float)}.<br>
* <br>
* {@link #distance} contains the distance the Entity is to fall. If this event is canceled, this value is set to 0.0F.
* <br>
@@ -1,13 +1,15 @@
package net.minecraftforge.event.entity.living;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.EntityLivingBase;
/**
* LivingHealEvent is fired when an Entity is set to be healed. <br>
* This event is fired whenever an Entity is healed in EntityLivingBase#heal(float)<br>
* This event is fired whenever an Entity is healed in {@link EntityLivingBase#heal(float)}<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingHeal(EntityLivingBase, float)}.<br>
* This event is fired via the {@link ForgeEventFactory#onLivingHeal(EntityLivingBase, float)}.<br>
* <br>
* {@link #amount} contains the amount of healing done to the Entity that was healed. <br>
* <br>
@@ -1,5 +1,8 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.EntityLivingBase;
@@ -7,8 +10,8 @@ import net.minecraft.entity.EntityLivingBase;
/**
* LivingHurtEvent is fired when an Entity is set to be hurt. <br>
* This event is fired whenever an Entity is hurt in
* EntityLivingBase#damageEntity(DamageSource, float) and
* EntityPlayer#damageEntity(DamageSource, float).<br>
* {@link EntityLivingBase#damageEntity(DamageSource, float)} and
* {@link EntityPlayer#damageEntity(DamageSource, float)}.<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingHurt(EntityLivingBase, DamageSource, float)}.<br>
* <br>
@@ -1,12 +1,16 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.<br>
* This event is fired whenever an Entity sets a target to attack in
* EntityLiving#setAttackTarget(EntityLivingBase) and
* EntityLivingBase#setRevengeTarget(EntityLivingBase).<br>
* {@link EntityLiving#setAttackTarget(EntityLivingBase)} and
* {@link EntityLivingBase#setRevengeTarget(EntityLivingBase)}.<br>
* <br>
* This event is fired via the {@link ForgeHooks#onLivingSetAttackTarget(EntityLivingBase, EntityLivingBase)}.<br>
* <br>
@@ -1,7 +1,11 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.world.WorldEntitySpawner;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
@@ -58,9 +62,9 @@ public class LivingSpawnEvent extends LivingEvent
/**
* SpecialSpawn is fired when an Entity is to be spawned from a mob spawner.<br>
* This event is fired whenever an Entity is spawned in a mob spawner in<br>
* SpawnerAnimals#findChunksForSpawning(WorldServer, boolean, boolean, boolean).<br>
* {@link WorldEntitySpawner#findChunksForSpawning(WorldServer, boolean, boolean, boolean)}.<br>
* <br>
* This event is fired via the {@link ForgeHooks#doSpecialSpawn(EntityLiving, World, float, float, float)}.<br>
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(EntityLiving, World, float, float, float)}.<br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the Entity is not spawned.<br>
@@ -2,8 +2,14 @@ package net.minecraftforge.event.entity.living;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* ZombieEvent is fired whenever a zombie is spawned for aid.
@@ -27,9 +33,9 @@ public class ZombieEvent extends EntityEvent {
/**
* SummonAidEvent is fired when a Zombie Entity is summoned.
* This event is fired whenever a Zombie Entity is summoned in
* EntityZombie#attackEntityFrom(DamageSource, float).
* {@link EntityZombie#attackEntityFrom(DamageSource, float)}.
*
* This event is fired via the {@link ForgeHooks#fireZombieSummonAid(EntityZombie, World, int, int, int, EntityLivingBase, double)}.
* This event is fired via the {@link ForgeEventFactory#fireZombieSummonAid(EntityZombie, World, int, int, int, EntityLivingBase, double)}.
*
* {@link #customSummonedAid} remains null, but can be populated with a custom EntityZombie which will be spawned.
* {@link #world} contains the world that this summoning is occurring in.
@@ -2,11 +2,13 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* MinecartCollisionEvent is fired when a minecart collides with an Entity.
* This event is fired whenever a minecraft collides in
* EntityMinecart#applyEntityCollision(Entity).
* {@link EntityMinecart#applyEntityCollision(Entity)}.
*
* {@link #collider} contains the Entity the Minecart collided with.
*
@@ -1,7 +1,9 @@
package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* MinecartEvent is fired whenever an event involving minecart entities occurs. <br>
@@ -1,5 +1,10 @@
package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecartContainer;
import net.minecraft.entity.item.EntityMinecartEmpty;
import net.minecraft.entity.item.EntityMinecartFurnace;
import net.minecraft.entity.item.EntityMinecartHopper;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
@@ -9,10 +14,11 @@ import net.minecraft.util.EnumHand;
/**
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
* This event is fired whenever a player interacts with a minecart in
* EntityMinecartContainer#interactFirst(EntityPlayer),
* EntityMinecartEmpty#interactFirst(EntityPlayer)
* EntityMinecartFurnace#interactFirst(EntityPlayer)
* EntityMinecartHopper#interactFirst(EntityPlayer).<br>
* {@link EntityMinecartContainer#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartEmpty#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartFurnace#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartHopper#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* etc.<br>
* <br>
* {@link #player} contains the EntityPlayer that is involved with this minecart interaction.<br>
* <br>
@@ -2,11 +2,13 @@ package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* MinecartUpdateEvent is fired when a minecart is updated.<br>
* This event is fired whenever a minecart is updated in
* EntityMinecart#onUpdate().<br>
* {@link EntityMinecart#onUpdate()}.<br>
* <br>
* {@link #pos} contains the coordinate of the track the entity is on {if applicable}.<br>
* <br>
@@ -1,5 +1,8 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBow;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -8,7 +11,7 @@ import net.minecraft.world.World;
/**
* ArrowLooseEvent is fired when a player stops using a bow.<br>
* This event is fired whenever a player stops using a bow in
* ItemBow#onPlayerStoppedUsing(ItemStack, World, EntityPlayer, int).<br>
* {@link ItemBow#onPlayerStoppedUsing(ItemStack, World, EntityLivingBase, int)}.<br>
* <br>
* {@link #bow} contains the ItemBow ItemStack that was used in this event.<br>
* {@link #charge} contains the value for how much the player had charged before stopping the shot.<br>
@@ -1,15 +1,17 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
/**
* ArrowNockEvent is fired when a player begins using a bow.<br>
* This event is fired whenever a player begins using a bow in
* ItemBow#onItemRightClick(ItemStack, World, EntityPlayer).<br>
* {@link ItemBow#onItemRightClick(ItemStack, World, EntityPlayer, EnumHand)}.<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@@ -1,5 +1,6 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -7,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
/**
* AttackEntityEvent is fired when a player attacks an Entity.<br>
* This event is fired whenever a player attacks an Entity in
* EntityPlayer#attackTargetEntityWithCurrentItem(Entity).<br>
* {@link EntityPlayer#attackTargetEntityWithCurrentItem(Entity)}.<br>
* <br>
* {@link #target} contains the Entity that was damaged by the player. <br>
* <br>
@@ -1,5 +1,19 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.CPacketPlayerBlockPlacement;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -8,12 +22,13 @@ import net.minecraft.util.EnumHand;
/**
* PlayerDestroyItemEvent is fired when a player destroys an item.<br>
* This event is fired whenever a player destroys an item in
* PlayerControllerMP#onPlayerRightClick(EntityPlayer, World, ItemStack, int, int, int, int, Vec3),
* PlayerControllerMP#sendUseItem(EntityPlayer, World, ItemStack),
* EntityPlayer#destroyCurrentEquippedItem(),
* SlotCrafting#onPickupFromSlot(EntityPlayer, ItemStack),
* ItemInWorldManager#tryUseItem(EntityPlayer, World, ItemStack),
* and ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float).<br>
* {@link PlayerControllerMP#processRightClick(EntityPlayer, World, ItemStack, EnumHand)},
* {@link PlayerControllerMP#processRightClickBlock(EntityPlayerSP, WorldClient, ItemStack, BlockPos, EnumFacing, Vec3d, EnumHand)},
* {@link EntityPlayer#damageShield(float)},
* {@link ForgeHooks#getContainerItem(ItemStack)},
* {@link PlayerInteractionManager#processRightClick(EntityPlayer, World, ItemStack, EnumHand)},
* {@link NetHandlerPlayServer#processPlayerBlockPlacement(CPacketPlayerBlockPlacement)}
* and {@link NetHandlerPlayServer#processRightClickBlock(CPacketPlayerTryUseItem)}.<br>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
* (@link #hand) contains the hand that the current item was held in.<br>
@@ -22,6 +37,7 @@ import net.minecraft.util.EnumHand;
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired from {@link ForgeEventFactory#onPlayerDestroyItem(EntityPlayer, ItemStack, EnumHand)}.<br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class PlayerDestroyItemEvent extends PlayerEvent
@@ -1,6 +1,9 @@
package net.minecraftforge.event.entity.player;
import java.io.File;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -8,6 +11,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* PlayerEvent is fired whenever an event involving Living entities occurs. <br>
@@ -33,11 +37,11 @@ public class PlayerEvent extends LivingEvent
/**
* HarvestCheck is fired when a player attempts to harvest a block.<br>
* This event is fired whenever a player attempts to harvest a block in
* EntityPlayer#canHarvestBlock(Block).<br>
* {@link EntityPlayer#canHarvestBlock(IBlockState)}.<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#doPlayerHarvestCheck(EntityPlayer, Block, boolean)}.<br>
* This event is fired via the {@link ForgeEventFactory#doPlayerHarvestCheck(EntityPlayer, IBlockState, boolean)}.<br>
* <br>
* {@link #block} contains the Block that is being checked for harvesting. <br>
* {@link #state} contains the {@link IBlockState} that is being checked for harvesting. <br>
* {@link #success} contains the boolean value for whether the Block will be successfully harvested. <br>
* <br>
* This event is not {@link Cancelable}.<br>
@@ -66,7 +70,7 @@ public class PlayerEvent extends LivingEvent
/**
* BreakSpeed is fired when a player attempts to harvest a block.<br>
* This event is fired whenever a player attempts to harvest a block in
* EntityPlayer#canHarvestBlock(Block).<br>
* {@link EntityPlayer#canHarvestBlock(IBlockState)}.<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, IBlockState, float, BlockPos)}.<br>
* <br>
@@ -109,7 +113,7 @@ public class PlayerEvent extends LivingEvent
/**
* NameFormat is fired when a player's display name is retrieved.<br>
* This event is fired whenever a player's name is retrieved in
* EntityPlayer#getDisplayName() or EntityPlayer#refreshDisplayName().<br>
* {@link EntityPlayer#getDisplayName()} or {@link EntityPlayer#refreshDisplayName()}.<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String)}.<br>
* <br>
@@ -3,12 +3,14 @@ package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* PlayerSleepInBedEvent is fired when a player sleeps in a bed.
* <br>
* This event is fired whenever a player sleeps in a bed in
* EntityPlayer#sleepInBedAt(BlockPos).<br>
* {@link EntityPlayer#trySleep(BlockPos)}.<br>
* <br>
* {@link #result} contains whether the player is able to sleep. <br>
* <br>
@@ -1,7 +1,11 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
/**
@@ -11,7 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
* This event has a result. {@link HasResult}<br>
*
* setResult(ALLOW) informs game that player is still "in bed"<br>
* setResult(DEFAULT) causes game to check {@link net.minecraft.block.Block#isBed(net.minecraft.world.IBlockAccess, BlockPos, net.minecraft.entity.Entity)} instead
* setResult(DEFAULT) causes game to check {@link Block#isBed(IBlockState, IBlockAccess, BlockPos, Entity)} instead
*/
@HasResult
public class SleepingLocationCheckEvent extends PlayerEvent
@@ -1,5 +1,7 @@
package net.minecraftforge.event.terraingen;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.block.state.IBlockState;
import net.minecraft.world.biome.BiomeDecorator;
@@ -29,7 +31,7 @@ public class BiomeEvent extends Event
/**
* CreateDecorator is fired when a BiomeDecorator is created.<br>
* This event is fired whenever a BiomeDecorator is created in
* DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase).<br>
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase)}.<br>
* <br>
* {@link #originalBiomeDecorator} contains the original BiomeDecorator that would be used in vanilla.
* {@link #newBiomeDecorator} contains the new BiomeDecoration to be used by Minecraft.
@@ -1,6 +1,10 @@
package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.util.math.BlockPos;
@@ -9,7 +13,7 @@ import net.minecraft.world.World;
/**DecorateBiomeEvent is fired when a BiomeDecorator is created.
* <br>
* This event is fired whenever a BiomeDecorator is created in
* DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase).<br>
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase)}.<br>
* <br>
* {@link #world} contains the world that is being decorated. <br>
* {@link #rand} contains an instance of Random to be used. <br>
@@ -1,6 +1,10 @@
package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.util.math.BlockPos;
@@ -49,7 +53,7 @@ public class OreGenEvent extends Event
/**
* OreGenEvent.Pre is fired just before a chunk is populated with ores.<br>
* This event is fired just before ore generation in
* BiomeDecorator#generateOres().<br>
* {@link BiomeDecorator#generateOres(World, Random)}.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -68,7 +72,7 @@ public class OreGenEvent extends Event
/**
* OreGenEvent.Post is fired just after a chunk is populated with ores.<br>
* This event is fired just after ore generation in
* BiomeDecorator#generateOres().<br>
* {@link BiomeDecorator#generateOres(World, Random)}.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -87,7 +91,7 @@ public class OreGenEvent extends Event
/**
* GenerateMinable is fired when a mineable block is generated in a chunk.<br>
* This event is fired just after ore generation in
* BiomeDecorator#generateOres().<br>
* {@link BiomeDecorator#generateOres(World, Random)}.<br>
* <br>
* {@link #type} contains the enum value for the Ore attempting to be generated.<br>
* {@link #generator} contains the WorldGenerator generating this ore. <br>
@@ -4,6 +4,9 @@ import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.ChunkProviderEnd;
import net.minecraft.world.gen.ChunkProviderHell;
import net.minecraft.world.gen.ChunkProviderOverworld;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -47,9 +50,9 @@ public class PopulateChunkEvent extends ChunkGeneratorEvent
/**
* PopulateChunkEvent.Pre is fired just before a chunk is populated a terrain feature.<br>
* This event is fired just before terrain feature generation in
* ChunkProviderEnd#populate(IChunkProvider, int, int),
* ChunkProviderGenerate#populate(IChunkProvider, int, int),
* and ChunkProviderHell#populate(IChunkProvider, int, int). <br>
* {@link ChunkProviderEnd#populate(int, int)},
* {@link ChunkProviderOverworld#populate(int, int)},
* and {@link ChunkProviderHell#populate(int, int)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -68,9 +71,9 @@ public class PopulateChunkEvent extends ChunkGeneratorEvent
/**
* PopulateChunkEvent.Post is fired just after a chunk is populated with a terrain feature.<br>
* This event is fired just after terrain feature generation in
* ChunkProviderEnd#populate(IChunkProvider, int, int),
* ChunkProviderGenerate#populate(IChunkProvider, int, int),
* and ChunkProviderHell#populate(IChunkProvider, int, int). <br>
* {@link ChunkProviderEnd#populate(int, int)},
* {@link ChunkProviderOverworld#populate(int, int)},
* and {@link ChunkProviderHell#populate(int, int)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -89,9 +92,9 @@ public class PopulateChunkEvent extends ChunkGeneratorEvent
/**
* PopulateChunkEvent.Populate is fired when a chunk is populated with a terrain feature.<br>
* This event is fired during terrain feature generation in
* ChunkProviderEnd#populate(IChunkProvider, int, int),
* ChunkProviderGenerate#populate(IChunkProvider, int, int),
* and ChunkProviderHell#populate(IChunkProvider, int, int). <br>
* {@link ChunkProviderEnd#populate(int, int)},
* {@link ChunkProviderOverworld#populate(int, int)},
* and {@link ChunkProviderHell#populate(int, int)}. <br>
* <br>
* {@link #type} contains the enum value for the terrain feature being generated. <br>
* <br>
@@ -1,6 +1,11 @@
package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.state.IBlockState;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -9,7 +14,7 @@ import net.minecraftforge.event.world.WorldEvent;
/**
* SaplingGrowTreeEvent is fired when a sapling grows into a tree.<br>
* This event is fired during sapling growth in
* BlockSapling#func_149878_d(World, BlockPos, Random).<br>
* {@link BlockSapling#generateTree(World, BlockPos, IBlockState, Random)}.<br>
* <br>
* {@link #pos} contains the coordinates of the growing sapling. <br>
* {@link #rand} contains an instance of Random for use. <br>
@@ -1,5 +1,8 @@
package net.minecraftforge.event.terraingen;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.WorldType;
@@ -30,7 +33,7 @@ public class WorldTypeEvent extends Event
/**
* BiomeSize is fired when vanilla Minecraft attempts to generate biomes.<br>
* This event is fired during biome generation in
* GenLayer#initializeAllBiomeGenerators(long, WorldType). <br>
* {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, String)}. <br>
* <br>
* {@link #originalSize} the original size of the Biome. <br>
* {@link #newSize} the new size of the biome. Initially set to the {@link #originalSize}. <br>
@@ -71,9 +74,9 @@ public class WorldTypeEvent extends Event
}
/**
* InitBiomeGens is fired when vanilla Minecraft attempts to initialize the biome generators.<br>
* This event is fired just during biome generator initialization in
* WorldChunkManager#WorldChunkManager(long, WorldType). <br>
* InitBiomeGens is fired when vanilla Minecraft attempts to initialize the biome providers.<br>
* This event is fired just during biome provider initialization in
* {@link BiomeProvider#BiomeProvider(long, WorldType, String)}. <br>
* <br>
* {@link #seed} the seed of the world. <br>
* {@link #originalBiomeGens} the array of GenLayers original intended for this Biome generation. <br>
@@ -1,7 +1,12 @@
package net.minecraftforge.event.world;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* ChunkDataEvent is fired when an event involving chunk data occurs.<br>
@@ -30,7 +35,7 @@ public class ChunkDataEvent extends ChunkEvent
/**
* ChunkDataEvent.Load is fired when vanilla Minecraft attempts to load Chunk data.<br>
* This event is fired during chunk loading in
* ChunkIOProvider#callStage2(QueuedChunk, Chunk). <br>
* {@link net.minecraftforge.common.chunkio.ChunkIOProvider#syncCallback()}.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -49,7 +54,7 @@ public class ChunkDataEvent extends ChunkEvent
/**
* ChunkDataEvent.Save is fired when vanilla Minecraft attempts to save Chunk data.<br>
* This event is fired during chunk saving in
* AnvilChunkLoader#saveChunk(World, Chunk). <br>
* {@link AnvilChunkLoader#saveChunk(World, Chunk)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -1,6 +1,10 @@
package net.minecraftforge.event.world;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* ChunkEvent is fired when an event involving a chunk occurs.<br>
@@ -29,7 +33,7 @@ public class ChunkEvent extends WorldEvent
/**
* ChunkEvent.Load is fired when vanilla Minecraft attempts to load a Chunk into the world.<br>
* This event is fired during chunk loading in <br>
* ChunkProviderClient#loadChunk(int, int), <br>
* {@link ChunkProviderClient#loadChunk(int, int)}, <br>
* Chunk.onChunkLoad(). <br>
* <br>
* This event is not {@link Cancelable}.<br>
@@ -1,5 +1,8 @@
package net.minecraftforge.event.world;
import net.minecraft.server.management.PlayerManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -38,7 +41,7 @@ public class ChunkWatchEvent extends Event
/**
* ChunkWatchEvent.Watch is fired when an EntityPlayer begins watching a chunk.<br>
* This event is fired when a chunk is added to the watched chunks of an EntityPlayer in
* EntityPlayerMP#onUpdate(). <br>
* {@link EntityPlayerMP#onUpdate()}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -54,7 +57,7 @@ public class ChunkWatchEvent extends Event
/**
* ChunkWatchEvent.UnWatch is fired when an EntityPlayer stops watching a chunk.<br>
* This event is fired when a chunk is removed from the watched chunks of an EntityPlayer in
* PlayerInstance#removePlayer(EntityPlayerMP). <br>
* {@link PlayerManager.PlayerInstance#removePlayer(EntityPlayerMP)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -2,6 +2,7 @@ package net.minecraftforge.event.world;
import java.util.List;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.entity.Entity;
@@ -1,13 +1,27 @@
package net.minecraftforge.event.world;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.profiler.Profiler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeInternalHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -37,10 +51,11 @@ public class WorldEvent extends Event
/**
* WorldEvent.Load is fired when Minecraft loads a world.<br>
* This event is fired when a world is loaded in
* WorldClient#WorldClient(NetHandlerPlayClient, WorldSettings, int, EnumDifficulty, Profiler),
* MinecraftServer#loadAllWorlds(String, String, long, WorldType, String),
* DimensionManager#initDimension(int),
* and ForgeInternalHandler#onDimensionLoad(Load). <br>
* {@link WorldClient#WorldClient(NetHandlerPlayClient, WorldSettings, int, EnumDifficulty, Profiler)},
* {@link MinecraftServer#loadAllWorlds(String, String, long, WorldType, String)},
* {@link IntegratedServer#loadAllWorlds(String, String, long, WorldType, String)}
* {@link DimensionManager#initDimension(int)},
* and {@link ForgeInternalHandler#onDimensionLoad(Load)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -56,11 +71,10 @@ public class WorldEvent extends Event
/**
* WorldEvent.Unload is fired when Minecraft unloads a world.<br>
* This event is fired when a world is unloaded in
* Minecraft#loadWorld(WorldClient, String),
* MinecraftServer#deleteWorldAndStopServer(),
* MinecraftServer#stopServer(),
* DimensionManager#unloadWorlds(Hashtable<Integer, long[]>),
* ForgeInternalHandler#onDimensionUnload(Unload). <br>
* {@link Minecraft#loadWorld(WorldClient, String)},
* {@link MinecraftServer#stopServer()},
* {@link DimensionManager#unloadWorlds(Hashtable)},
* {@link ForgeInternalHandler#onDimensionUnload(Unload)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -76,8 +90,8 @@ public class WorldEvent extends Event
/**
* WorldEvent.Save is fired when Minecraft saves a world.<br>
* This event is fired when a world is saved in
* WorldServer#saveAllChunks(boolean, IProgressUpdate),
* ForgeInternalHandler#onDimensionSave(Save). <br>
* {@link WorldServer#saveAllChunks(boolean, IProgressUpdate)},
* {@link ForgeInternalHandler#onDimensionSave(Save)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -93,8 +107,8 @@ public class WorldEvent extends Event
/**
* Called by WorldServer to gather a list of all possible entities that can spawn at the specified location.
* If an entry is added to the list, it needs to be a globally unique instance.
* The event is called in WorldServer#getSpawnListEntryForTypeAt(EnumCreatureType, BlockPos) as well as
* WorldServer#canCreatureTypeSpawnHere(EnumCreatureType creatureType, BiomeGenBase.SpawnListEntry spawnListEntry, BlockPos pos)
* The event is called in {@link WorldServer#getSpawnListEntryForTypeAt(EnumCreatureType, BlockPos)} as well as
* {@link WorldServer#canCreatureTypeSpawnHere(EnumCreatureType, SpawnListEntry, BlockPos)}
* where the latter checks for identity, meaning both events must add the same instance.
* Canceling the event will result in a empty list, meaning no entity will be spawned.
*/
@@ -2,6 +2,9 @@ package net.minecraftforge.fluids;
import java.util.Locale;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.util.ResourceLocation;
@@ -36,6 +39,9 @@ public class Fluid
protected final ResourceLocation still;
protected final ResourceLocation flowing;
private SoundEvent fillSound;
private SoundEvent emptySound;
/**
* The light level emitted by this fluid.
*
@@ -158,6 +164,18 @@ public class Fluid
return this;
}
public Fluid setFillSound(SoundEvent fillSound)
{
this.fillSound = fillSound;
return this;
}
public Fluid setEmptySound(SoundEvent emptySound)
{
this.emptySound = emptySound;
return this;
}
public final String getName()
{
return this.fluidName;
@@ -244,6 +262,40 @@ public class Fluid
return flowing;
}
public SoundEvent getFillSound()
{
if(fillSound == null)
{
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.lava)
{
fillSound = SoundEvents.item_bucket_fill_lava;
}
else
{
fillSound = SoundEvents.item_bucket_fill;
}
}
return fillSound;
}
public SoundEvent getEmptySound()
{
if(emptySound == null)
{
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.lava)
{
emptySound = SoundEvents.item_bucket_empty_lava;
}
else
{
emptySound = SoundEvents.item_bucket_empty;
}
}
return emptySound;
}
/* Stack-based Accessors */
public int getLuminosity(FluidStack stack){ return getLuminosity(); }
public int getDensity(FluidStack stack){ return getDensity(); }
@@ -254,6 +306,8 @@ public class Fluid
public int getColor(FluidStack stack){ return getColor(); }
public ResourceLocation getStill(FluidStack stack) { return getStill(); }
public ResourceLocation getFlowing(FluidStack stack) { return getFlowing(); }
public SoundEvent getFillSound(FluidStack stack) { return getFillSound(); }
public SoundEvent getEmptySound(FluidStack stack) { return getEmptySound(); }
/* World-based Accessors */
public int getLuminosity(World world, BlockPos pos){ return getLuminosity(); }
@@ -265,5 +319,7 @@ public class Fluid
public int getColor(World world, BlockPos pos){ return getColor(); }
public ResourceLocation getStill(World world, BlockPos pos) { return getStill(); }
public ResourceLocation getFlowing(World world, BlockPos pos) { return getFlowing(); }
public SoundEvent getFillSound(World world, BlockPos pos) { return getFillSound(); }
public SoundEvent getEmptySound(World world, BlockPos pos) { return getEmptySound(); }
}
@@ -1,26 +1,17 @@
package net.minecraftforge.fluids;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ReportedException;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
import java.util.concurrent.Callable;
public class FluidUtil
{
@@ -31,7 +22,7 @@ public class FluidUtil
/** Returns true if interaction was successful. */
public static boolean interactWithTank(ItemStack stack, EntityPlayer player, IFluidHandler tank, EnumFacing side)
{
if (stack == null || player.worldObj.isRemote)
if (stack == null)
{
return true;
}
@@ -40,8 +31,8 @@ public class FluidUtil
// regular bucket?
int slot = player.inventory.currentItem;
if ((result = FluidUtil.tryFillBucket(stack, tank, side)) != null ||
(result = FluidUtil.tryEmptyBucket(stack, tank, side)) != null)
if ((result = FluidUtil.tryFillBucket(stack, tank, side, player)) != null ||
(result = FluidUtil.tryEmptyBucket(stack, tank, side, player)) != null)
{
// "use up" the input item if the player is not in creative
if (!player.capabilities.isCreativeMode)
@@ -60,7 +51,9 @@ public class FluidUtil
else
{
// copy of the original item for creative mode
ItemStack original = stack; // needed for how minecraft manages inventory with interaction
ItemStack copy = stack.copy();
stack = stack.copy(); // needed so we don't affect itemstacks outside of this function
boolean changedBucket = false;
// convert to fluidcontainer-bucket if it's a regular empty bucket
if (ItemStack.areItemsEqual(stack, FluidContainerRegistry.EMPTY_BUCKET) && FluidRegistry.isUniversalBucketEnabled())
@@ -74,6 +67,7 @@ public class FluidUtil
if (FluidUtil.tryFillFluidContainerItem(stack, tank, side, player) ||
FluidUtil.tryEmptyFluidContainerItem(stack, tank, side, player))
{
original.stackSize--; // this tells the player that the item he held was "used up" and the inventory syncing will then play the correct animation
if (player.capabilities.isCreativeMode)
{
// reset the stack that got modified
@@ -117,6 +111,12 @@ public class FluidUtil
return false;
}
@Deprecated
public static ItemStack tryFillBucket(ItemStack bucket, IFluidHandler tank, EnumFacing side)
{
return tryFillBucket(bucket, tank, side, null);
}
/**
* Fill an empty bucket from the given tank. Uses the FluidContainerRegistry.
*
@@ -125,7 +125,7 @@ public class FluidUtil
* @param side Side to access the tank from
* @return The filled bucket or null if the liquid couldn't be taken from the tank.
*/
public static ItemStack tryFillBucket(ItemStack bucket, IFluidHandler tank, EnumFacing side)
public static ItemStack tryFillBucket(ItemStack bucket, IFluidHandler tank, EnumFacing side, EntityPlayer player)
{
FluidTankInfo[] info = tank.getTankInfo(side);
// check for fluid in the tank
@@ -144,6 +144,13 @@ public class FluidUtil
FluidStack liquid = tank.drain(side, FluidContainerRegistry.getContainerCapacity(inTank, bucket), false);
if (liquid != null && liquid.amount > 0)
{
// play sound
if(player != null)
{
SoundEvent soundevent = liquid.getFluid().getFillSound(liquid);
player.playSound(soundevent, 1f, 1f);
}
// success, return filled bucket
tank.drain(side, FluidContainerRegistry.getContainerCapacity(liquid, bucket), true);
return FluidContainerRegistry.fillFluidContainer(liquid, bucket);
@@ -152,15 +159,22 @@ public class FluidUtil
return null;
}
@Deprecated
public static ItemStack tryEmptyBucket(ItemStack bucket, IFluidHandler tank, EnumFacing side)
{
return tryEmptyBucket(bucket, tank, side, null);
}
/**
* Takes a filled bucket and tries to empty it into the given tank. Uses the FluidContainerRegistry.
*
* @param bucket The filled bucket
* @param tank The tank to fill with the bucket
* @param side Side to access the tank from
* @param player
* @return The empty bucket if successful, null if the tank couldn't be filled.
*/
public static ItemStack tryEmptyBucket(ItemStack bucket, IFluidHandler tank, EnumFacing side)
public static ItemStack tryEmptyBucket(ItemStack bucket, IFluidHandler tank, EnumFacing side, EntityPlayer player)
{
// not a filled bucket
if (!FluidContainerRegistry.isFilledContainer(bucket))
@@ -177,6 +191,12 @@ public class FluidUtil
// not everything?
if (amount == liquid.amount)
{
// play sound
if(player != null)
{
SoundEvent soundevent = liquid.getFluid().getEmptySound(liquid);
player.playSound(soundevent, 1f, 1f);
}
// success, fully filled it into the tank, return empty bucket
tank.fill(side, liquid, true);
return FluidContainerRegistry.drainFluidContainer(bucket);
@@ -263,18 +283,21 @@ public class FluidUtil
return false;
}
// check if we can give the itemstack to the inventory
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, toFill, true);
if (remainder != null && player == null)
if(player == null || !player.worldObj.isRemote)
{
// couldn't add to the inventory and don't have a player to drop the item at
return false;
}
remainder = ItemHandlerHelper.insertItemStacked(inventory, toFill, false);
// give it to the player or drop it at his feet
if (remainder != null && player != null)
{
ItemHandlerHelper.giveItemToPlayer(player, remainder);
// check if we can give the itemstack to the inventory
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, toFill, true);
if (remainder != null && player == null)
{
// couldn't add to the inventory and don't have a player to drop the item at
return false;
}
remainder = ItemHandlerHelper.insertItemStacked(inventory, toFill, false);
// give it to the player or drop it at his feet
if (remainder != null && player != null)
{
ItemHandlerHelper.giveItemToPlayer(player, remainder);
}
}
// the result has been given to the player, drain the tank since everything is ok
@@ -300,6 +323,13 @@ public class FluidUtil
tank.drain(side, filled, true);
}
// play sound
if(player != null)
{
SoundEvent soundevent = liquid.getFluid().getFillSound(liquid);
player.playSound(soundevent, 1f, 1f);
}
return true;
}
@@ -356,18 +386,21 @@ public class FluidUtil
toEmpty.stackSize = 1;
drained = fluidContainer.drain(toEmpty, filled, true); // modifies the container!
// try adding the drained container to the inventory
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, toEmpty, true);
if (remainder != null && player == null)
if(player == null || !player.worldObj.isRemote)
{
// couldn't add to the inventory and don't have a player to drop the item at
return false;
}
remainder = ItemHandlerHelper.insertItemStacked(inventory, toEmpty, false);
// give it to the player or drop it at his feet
if (remainder != null && player != null)
{
ItemHandlerHelper.giveItemToPlayer(player, remainder);
// try adding the drained container to the inventory
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, toEmpty, true);
if (remainder != null && player == null)
{
// couldn't add to the inventory and don't have a player to drop the item at
return false;
}
remainder = ItemHandlerHelper.insertItemStacked(inventory, toEmpty, false);
// give it to the player or drop it at his feet
if (remainder != null && player != null)
{
ItemHandlerHelper.giveItemToPlayer(player, remainder);
}
}
// the result has been given to the player, fill the tank since everything is ok
@@ -383,6 +416,13 @@ public class FluidUtil
drained = fluidContainer.drain(container, filled, true); // modifies the container!
tank.fill(side, drained, true);
}
// play sound
if(player != null)
{
SoundEvent soundevent = drained.getFluid().getEmptySound(drained);
player.playSound(soundevent, 1f, 1f);
}
return true;
}
}
@@ -391,175 +431,4 @@ public class FluidUtil
return false;
}
private static boolean insertItemInto(ItemStack stack, IInventory inventory, World world, BlockPos pos, boolean isCreative)
{
if (stack == null)
{
return false;
}
// add it to the inventory
if (inventory != null && addItemStackToInventory(stack, inventory, isCreative))
{
if (world != null && pos != null)
{
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.entity_item_pickup, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
return true;
}
else if (world != null && pos != null)
{
double d0 = pos.getY() + 0.5d;
EntityItem entityitem = new EntityItem(world, pos.getX(), d0, pos.getZ(), stack);
entityitem.setPickupDelay(40);
entityitem.motionX = 0;
//entityitem.motionY = 0;
entityitem.motionZ = 0;
if (!world.isRemote)
{
world.spawnEntityInWorld(entityitem);
}
return true;
}
return false;
}
// generalized copy of InventoryPlayer.addItemStackToInventory without regarding itemstack sizes > 1
private static boolean addItemStackToInventory(final ItemStack itemstack, IInventory inventory, boolean isCreative)
{
if (itemstack != null && itemstack.stackSize == 1 && itemstack.getItem() != null)
{
try
{
int sizeInventory = inventory.getSizeInventory();
// player inventory requires hardcoding because we don't want to add to the armor slots
if (inventory instanceof InventoryPlayer)
{
sizeInventory -= 4;
}
if (itemstack.isItemDamaged())
{
int j = 0;
for (; j < sizeInventory; ++j)
{
if (inventory.getStackInSlot(j) == null)
{
break;
}
}
// found empty slot
if (j < sizeInventory)
{
ItemStack copy = ItemStack.copyItemStack(itemstack);
copy.animationsToGo = 5;
inventory.setInventorySlotContents(j, copy);
itemstack.stackSize = 0;
return true;
}
else if (isCreative)
{
itemstack.stackSize = 0;
return true;
}
else
{
return false;
}
}
else
{
int origSize = itemstack.stackSize;
// go through the inventory and try to fill up already existing items
for (int i = 0; i < sizeInventory; i++)
{
ItemStack slot = inventory.getStackInSlot(i);
if (slot != null && slot.getItem() == itemstack.getItem() &&
slot.isStackable() && slot.stackSize < slot.getMaxStackSize() &&
slot.stackSize < inventory.getInventoryStackLimit() &&
(!slot.getHasSubtypes() || slot.getMetadata() == itemstack.getMetadata()) &&
ItemStack.areItemStackTagsEqual(slot, itemstack))
{
// stackable
int dif = itemstack.stackSize;
if (dif > slot.getMaxStackSize() - slot.stackSize)
{
dif = slot.getMaxStackSize() - slot.stackSize;
}
if (dif > inventory.getInventoryStackLimit())
{
dif = inventory.getInventoryStackLimit();
}
slot.stackSize += dif;
slot.animationsToGo = 5;
itemstack.stackSize -= dif;
inventory.setInventorySlotContents(i, slot);
if (itemstack.stackSize <= 0)
{
break;
}
}
}
if (itemstack.stackSize > 0)
{
// find empty slot
for (int i = 0; i < sizeInventory; i++)
{
if (inventory.getStackInSlot(i) == null)
{
ItemStack slot = ItemStack.copyItemStack(itemstack);
if (slot.stackSize > inventory.getInventoryStackLimit())
{
slot.stackSize = inventory.getInventoryStackLimit();
}
slot.animationsToGo = 5;
inventory.setInventorySlotContents(i, slot);
itemstack.stackSize -= slot.stackSize;
}
if (itemstack.stackSize <= 0)
{
break;
}
}
}
if (itemstack.stackSize > 0 && isCreative)
{
itemstack.stackSize = 0;
return true;
}
else
{
return itemstack.stackSize < origSize;
}
}
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Adding item to inventory");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being added");
crashreportcategory.addCrashSection("Item ID", Item.getIdFromItem(itemstack.getItem()));
crashreportcategory.addCrashSection("Item data", itemstack.getMetadata());
crashreportcategory.addCrashSectionCallable("Item name", new Callable<String>()
{
public String call() throws Exception
{
return itemstack.getDisplayName();
}
});
throw new ReportedException(crashreport);
}
}
else
{
return false;
}
}
}
@@ -31,8 +31,6 @@ public interface IFluidBlock
* Check to see if a block can be drained. This method should be called by devices such as
* pumps.
*
* @param doDrain
* If false, the drain will only be simulated.
* @return
*/
boolean canDrain(World world, BlockPos pos);
@@ -48,7 +48,7 @@ public interface IFluidContainerItem
* ItemStack which is the fluid container.
* @param maxDrain
* Maximum amount of fluid to be removed from the container.
* @param doFill
* @param doDrain
* If false, the drain will only be simulated.
* @return Amount of fluid that was (or would have been, if simulated) drained from the
* container.
@@ -46,8 +46,8 @@ public interface IFluidTank
*
* @param maxDrain
* Maximum amount of fluid to be removed from the container.
* @param doFill
* If false, the fill will only be simulated.
* @param doDrain
* If false, the drain will only be simulated.
* @return Amount of fluid that was removed from the tank.
*/
FluidStack drain(int maxDrain, boolean doDrain);
@@ -11,14 +11,10 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatList;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -112,39 +108,42 @@ public class UniversalBucket extends Item implements IFluidContainerItem
// clicked on a block?
RayTraceResult mop = this.getMovingObjectPositionFromPlayer(world, player, false);
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK)
if(mop == null || mop.typeOfHit != RayTraceResult.Type.BLOCK)
{
BlockPos clickPos = mop.getBlockPos();
// can we place liquid there?
if (world.isBlockModifiable(player, clickPos))
return ActionResult.newResult(EnumActionResult.PASS, itemstack);
}
BlockPos clickPos = mop.getBlockPos();
// can we place liquid there?
if (world.isBlockModifiable(player, clickPos))
{
// the block adjacent to the side we clicked on
BlockPos targetPos = clickPos.offset(mop.sideHit);
// can the player place there?
if (player.canPlayerEdit(targetPos, mop.sideHit, itemstack))
{
// the block adjacent to the side we clicked on
BlockPos targetPos = clickPos.offset(mop.sideHit);
// can the player place there?
if (player.canPlayerEdit(targetPos, mop.sideHit, itemstack))
// try placing liquid
if (this.tryPlaceFluid(player, player.getEntityWorld(), fluidStack.getFluid().getBlock(), targetPos)
&& !player.capabilities.isCreativeMode)
{
// try placing liquid
if (this.tryPlaceFluid(fluidStack.getFluid().getBlock(), world, targetPos)
&& !player.capabilities.isCreativeMode)
// success!
player.addStat(StatList.func_188057_b(this));
itemstack.stackSize--;
ItemStack emptyStack = getEmpty() != null ? getEmpty().copy() : new ItemStack(this);
// check whether we replace the item or add the empty one to the inventory
if (itemstack.stackSize <= 0)
{
// success!
player.addStat(StatList.func_188057_b(this));
itemstack.stackSize--;
ItemStack emptyStack = getEmpty() != null ? getEmpty().copy() : new ItemStack(this);
// check whether we replace the item or add the empty one to the inventory
if (itemstack.stackSize <= 0)
{
return ActionResult.newResult(EnumActionResult.SUCCESS, emptyStack);
}
else
{
// add empty bucket to player inventory
ItemHandlerHelper.giveItemToPlayer(player, emptyStack);
return ActionResult.newResult(EnumActionResult.SUCCESS, itemstack);
}
return ActionResult.newResult(EnumActionResult.SUCCESS, emptyStack);
}
else
{
// add empty bucket to player inventory
ItemHandlerHelper.giveItemToPlayer(player, emptyStack);
return ActionResult.newResult(EnumActionResult.SUCCESS, itemstack);
}
}
}
@@ -154,13 +153,23 @@ public class UniversalBucket extends Item implements IFluidContainerItem
return ActionResult.newResult(EnumActionResult.FAIL, itemstack);
}
// compatibility
@Deprecated
public boolean tryPlaceFluid(Block block, World worldIn, BlockPos pos)
{
return tryPlaceFluid(null, worldIn, block, pos);
}
private boolean tryPlaceFluid(EntityPlayer player, World worldIn, Block block, BlockPos pos)
{
if (block == null)
{
return false;
}
if(worldIn == null && player != null)
{
worldIn = player.getEntityWorld();
}
Material material = worldIn.getBlockState(pos).getMaterial();
boolean isSolid = material.isSolid();
@@ -194,7 +203,16 @@ public class UniversalBucket extends Item implements IFluidContainerItem
worldIn.destroyBlock(pos, true);
}
worldIn.setBlockState(pos, block.getDefaultState(), 3);
if(player != null && block instanceof IFluidBlock)
{
Fluid fluid = ((IFluidBlock) block).getFluid();
if(fluid != null)
{
worldIn.setBlockState(pos, block.getDefaultState(), 3);
SoundEvent soundevent = fluid.getEmptySound(worldIn, pos);
worldIn.playSound(player, pos, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
}
}
return true;
}
@@ -247,6 +265,10 @@ public class UniversalBucket extends Item implements IFluidContainerItem
// set it as the result
event.setResult(Event.Result.ALLOW);
event.setFilledBucket(filledBucket);
// sound!
SoundEvent soundevent = drained.getFluid().getFillSound(drained);
event.getEntityPlayer().playSound(soundevent, 1.0F, 1.0F);
}
else
{
@@ -1694,18 +1694,18 @@ public class GuiConfigEntries extends GuiListExtended
public boolean enabled();
/**
* Handles user keystrokes for any GuiTextField objects in this entry. Call {@code GuiTextField.keyTyped()} for any GuiTextField
* Handles user keystrokes for any GuiTextField objects in this entry. Call {@link GuiTextField#textboxKeyTyped(char, int)} for any GuiTextField
* objects that should receive the input provided.
*/
public void keyTyped(char eventChar, int eventKey);
/**
* Call {@code GuiTextField.updateCursorCounter()} for any GuiTextField objects in this entry.
* Call {@link GuiTextField#updateCursorCounter()} for any GuiTextField objects in this entry.
*/
public void updateCursorCounter();
/**
* Call {@code GuiTextField.mouseClicked()} for and GuiTextField objects in this entry.
* Call {@link GuiTextField#mouseClicked(int, int, int)} for and GuiTextField objects in this entry.
*/
public void mouseClicked(int x, int y, int mouseEvent);
@@ -31,14 +31,26 @@ public interface IConfigElement
public boolean isProperty();
/**
* This method returns a class that implements {@code IConfigEntry} or null. This class MUST
* provide a constructor with the following parameter types: {@code GuiConfig}, {@code GuiConfigEntries}, {@code IConfigElement}
* This method returns a class that implements {@link IConfigEntry} or null. This class MUST
* provide a constructor with the following parameter types: {@link GuiConfig}, {@link GuiConfigEntries}, {@link IConfigElement}
*
* @see GuiConfigEntries.ListEntryBase
* @see GuiConfigEntries.StringEntry
* @see GuiConfigEntries.BooleanEntry
* @see GuiConfigEntries.DoubleEntry
* @see GuiConfigEntries.IntegerEntry
*/
public Class<? extends IConfigEntry> getConfigEntryClass();
/**
* This method returns a class that implements {@code IArrayEntry}. This class MUST provide a constructor with the
* following parameter types: {@code GuiEditArray}, {@code GuiEditArrayEntries}, {@code IConfigElement}, {@code Object}
* This method returns a class that implements {@link IArrayEntry}. This class MUST provide a constructor with the
* following parameter types: {@link GuiEditArray}, {@link GuiEditArrayEntries}, {@link IConfigElement}, {@link Object}
*
* @see GuiEditArrayEntries.BaseEntry
* @see GuiEditArrayEntries.StringEntry
* @see GuiEditArrayEntries.BooleanEntry
* @see GuiEditArrayEntries.DoubleEntry
* @see GuiEditArrayEntries.IntegerEntry
*/
public Class<? extends IArrayEntry> getArrayEntryClass();
@@ -49,9 +49,6 @@ public class RenderingRegistry
* Register an entity rendering handler. This will, after mod initialization, be inserted into the main
* render map for entities.
* Call this during Preinitialization phase.
*
* @param entityClass
* @param renderer
*/
public static <T extends Entity> void registerEntityRenderingHandler(Class<T> entityClass, IRenderFactory<? super T> renderFactory)
{
@@ -942,10 +942,12 @@ public class Loader
* Fire a FMLMissingMappingsEvent to let mods determine how blocks/items defined in the world
* save, but missing from the runtime, are to be handled.
*
* @param missing Map containing missing names with their associated id, blocks need to come before items for remapping.
* @param missingBlocks Map containing the missing block names with their associated id. Remapped blocks will be removed from it.
* @param missingItems Map containing the missing block names with their associated id. Remapped items will be removed from it.
* @param isLocalWorld Whether this is executing for a world load (local/server) or a client.
* @param gameData GameData instance where the new map's config is to be loaded into.
* @return List with the mapping results.
* @param remapBlocks Returns a map containing the remapped block names and an array containing the original and new id for the block.
* @param remapItems Returns a map containing the remapped item names and an array containing the original and new id for the item.
* @return List with the names of the failed remappings.
*/
public List<String> fireMissingMappingEvent(Map<ResourceLocation, Integer> missingBlocks, Map<ResourceLocation, Integer> missingItems, boolean isLocalWorld, Map<ResourceLocation, Integer[]> remapBlocks, Map<ResourceLocation, Integer[]> remapItems)
{
@@ -9,7 +9,7 @@ import net.minecraftforge.fml.relauncher.Side;
/**
* A method annotated with this will be called when a remote network connection is offered.
* The method should have two parameters, of types {@link Map<String,String>} and {@link Side}. It should return a boolean
* The method should have two parameters, of types Map<String,String> and {@link Side}. It should return a boolean
* true indicating that the remote party is acceptable, or false if not.
*
* <p>
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff. Show more