Compare commits

..
183 Commits
Author SHA1 Message Date
mezz d06e0ad71b Fix log4j configuration 2017-06-07 20:53:27 -07:00
cpw 8182c93525 Fix up release jsons to clean up extraneous netty references 2016-05-11 11:19:23 -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
LexManos ba80ead005 Merge pull request #2539 from bonii-xx/bugfix
Fix CombinedInvWrapper accessing incorrect slots
2016-03-12 16:33:06 -08:00
Bernhard Bonigl bcab92daf6 Fix CombinedInvWrapper accessing incorrect slots
Closes #2533
2016-03-12 22:17:57 +01:00
Choonster TheMage 9ca3ede736 Allow finite fluids to be drained correctly 2016-03-07 21:31:27 +11:00
LexManos 250a77b359 Merge pull request #2476 from Abastro/fovfixes
Added Event: EntityViewRenderEvent#FOVModifier
2016-02-29 13:20:46 -08:00
LexManos 0e35c3125a Merge pull request #2500 from me4502/master
Added local click position to PlayerInteractEvent. Fixes #2482
2016-02-27 01:21:25 -08:00
Matthew Miller (Me4502) f1ad05dd8e Added local click position to PlayerInteractEvent. 2016-02-27 11:27:21 +10:00
Abastro c4ca8270b9 Added EntityViewRenderEvent#FOVModifier
Enables mods to modify raw FOV directly.
Avoids modifier limit from FOVUpdateEvent.
Aware of blocks which are needed for fov change related with materials.
2016-02-27 09:25:19 +09:00
LexManos ecfb9accaa Fixed dummy blocks not being removed from registry on dedicated server correctly. Closes #2487
Also added some more debug logs!
2016-02-24 16:56:20 -08:00
LexManos 0dd796fb16 Merge pull request #2497 from bonii-xx/universal_bucket
Fix WordServer.canCreatureTypeSpawnHere not using Forge Events.
2016-02-23 01:04:09 -08:00
Bernhard Bonigl 17e960c158 Fix WordServer.canCreatureTypeSpawnHere not using Forge Events.
Followup of #2496
2016-02-23 09:53:26 +01:00
LexManos 76f867561d Merge pull request #2495 from elix-x/master
Increased actual maximum fuel burn time
2016-02-22 11:31:39 -08:00
LexManos b009546a94 Merge pull request #2496 from bonii-xx/universal_bucket
Fix WorldEvent.PotentialSpawns Event passing the list instance of the…
2016-02-22 11:16:55 -08:00
Bernhard Bonigl de1c270644 Fix WorldEvent.PotentialSpawns Event passing the list instance of the ChunkProvider to users 2016-02-22 18:45:31 +01:00
elix-x 0ddd897446 Increased actual maximum fuel burn time
Increased actual maximum fuel burn time from 32767 to 2147483647.
Backwards compatible.
2016-02-22 18:16:45 +01:00
RainWarrior e495b7599c ModelLoader: added verbose error logging showing items/blockstates associated with model locations; removed redundant cast leftover from ungenerified code; fixed up a couple of warnings. 2016-02-22 03:53:26 +03:00
cpw 3e4107a222 Fix race condition when using indexed codec in a LAN server. Fixes spurious crash when LAN server is running. 2016-02-20 16:04:31 -05:00
cpw c88bc769ef Log when it's likely the indexedcodec is gonna fail, because of LAN server derps likely. Try and give some context for debuggers. 2016-02-19 23:18:46 -05:00
Fry 34382745ab Merge pull request #2488 from bonii-xx/universal_bucket
Fix universal bucket logging an exception
2016-02-19 13:27:59 +03:00
Bernhard Bonigl 9b128aaed2 Fix universal bucket logging an exception 2016-02-19 11:17:23 +01:00
LexManos fe340a213f Merge pull request #2485 from AlgorithmX2/world_getLightOpacity
Test getLightOpacity(world,pos) in World as well as the chunk.
2016-02-18 19:11:55 -08:00
AlgorithmX2 9eb22c3154 Test getLightOpacity(world,pos) in World as well as the chunk. 2016-02-18 20:43:24 -06:00
LexManos ad69f0f447 Merge pull request #2443 from AlgorithmX2/cap_pickup_entityitem
Preserve ItemStack Caps when picking Items up.
2016-02-18 14:10:32 -08:00
AlgorithmX2 e6b3c7ba64 Preserve ItemStack Caps when picking Items up. 2016-02-18 16:08:23 -06:00
LexManos c0915526ff Merge pull request #2429 from AlgorithmX2/in_material_hooks
In Material Hooks - For Swimming, Overlays, Boats, and Fishing.
2016-02-18 13:40:41 -08:00
AlgorithmX2 3c4a2b0f42 In material Liquid Hooks. 2016-02-18 14:41:15 -06:00
LexManos 1b3699d90b Merge pull request #2481 from diesieben07/potion-draw-fix
Fix Potion.shouldRenderInvText
2016-02-17 17:50:18 -06:00
Take Weiland 50f77a71ae Fix Potion.shouldRenderInvText 2016-02-18 00:37:57 +01:00
LexManos 6f9e63e3ee Merge pull request #2478 from AlgorithmX2/pre_getLightOpacity
Fix bug with getLightOpacity based on TileEntities,
2016-02-17 14:16:50 -06:00
AlgorithmX2 5c229dd6c7 Fix bug with getLightOpacity based on TileEntities,
Capture getLightOpacity prior to removing the tile entity.
2016-02-17 14:14:18 -06:00
LexManos f77d50b48c Fix loading of world ID maps for worlds without dummy data. Closes #2477 2016-02-17 12:06:57 -08:00
LexManos 13a25ee0ba Merge pull request #2474 from bonii-xx/universal_bucket
Fix customized bucket names not getting translated correctly
2016-02-17 13:31:12 -06:00
RainWarrior e8915b6a55 Added default levels for fluid extended properties in fluid model. 2016-02-16 14:13:19 +03:00
Bernhard Bonigl eb879b3020 Fix customized bucket names not getting translated correctly 2016-02-16 09:39:33 +01:00
LexManos 6b51665c42 Merge pull request #2333 from bonii-xx/universal_bucket
Add an universal bucket.
2016-02-15 17:56:05 -06:00
Bernhard Bonigl 1055206ba8 Add universal bucket 2016-02-16 00:49:01 +01:00
LexManos 74fe690227 Fix chat formatting not surviving line wraps in chat messages. 2016-02-15 14:30:24 -08:00
Fry 9760b3b52f Merge pull request #2470 from diesieben07/shader-fix
Fix the entity shader hook
2016-02-14 17:51:55 +03:00
Take Weiland b875274c4f Fix the entity shader hook 2016-02-14 15:25:11 +01:00
Fry 4d33fe6b26 Merge pull request #2467 from iLexiconn/master
Added hook to add entity spectator shader
2016-02-14 12:26:47 +03:00
LexManos 94f99faf87 Merge pull request #2468 from nallar/master
Workaround JDK-8087309: Constant folding "static final boolean" is incomplete
2016-02-13 15:23:24 -06:00
Ross Allan ccf5da2113 Workaround JDK-8087309: Constant folding "static final boolean" in boolean expressions is incomplete 2016-02-13 14:43:37 +00:00
iLexiconn 776f5b91d5 Added hook to add entity spectator shader 2016-02-13 00:09:04 +01:00
LexManos 06130912c5 Protect BlockSnapshot and Chunk.getTileEntity from mutible BlockPos instances. Closes #2438 2016-02-11 16:48:32 -08:00
LexManos 70fe18c163 Fixed Block.onNeighborChange not being called for all axises. Closes #2428 2016-02-11 16:29:07 -08:00
LexManos f4b0506515 Add missing classes to CrashReport preloading. Closes #2421 2016-02-11 16:28:25 -08:00
LexManos fa6610b3c8 Fixed invalid item being passed to gatherCapabilities when itemstacks changed item. Closes #2445 2016-02-11 16:27:38 -08:00
LexManos bd6af1e49a Fixed implementation of RenderEntityItem.shouldSpreadItems. Closes #2448 2016-02-11 16:26:48 -08:00
LexManos 53301e1aeb Fixed vanilla bug where network clients would see incorrect break progress on blocks. Closes #2462 2016-02-11 16:26:12 -08:00
LexManos a607a48719 Fixed Block/Item.setRegistryName printing a incorrect warning when used. Closes #2398 2016-02-11 16:25:25 -08:00
LexManos a9ea634141 Fixed Entity.shouldRiderSit modifying game logic and not just rendering. Closes #2402 2016-02-11 16:24:38 -08:00
LexManos 124799d633 Fixed invalid parameters being sent to LivingSpawnEvent.CheckSpawn. Closes #2453 2016-02-11 16:23:49 -08:00
LexManos 9070ab56e3 Potential fix for NPE when using an item to open a slotless inventory. Closes #1354 2016-02-10 11:25:41 -08:00
RainWarrior ed9517a8b4 Fix custom model loader reload hook not firing during registration. 2016-02-10 10:20:13 +03:00
RainWarrior a9a022f45e Fix incorrectly updated patch to ChunkCache. Related to #2451. 2016-02-10 10:11:53 +03:00
RainWarrior 7e7b855ddf Fix multiple registrations of reloading hooks in custom model loaders. 2016-02-09 16:09:55 +03:00
LexManos 2c6af18a81 Remove Mojang logger spam in EntityItem. 2016-02-07 15:45:06 -08:00
LexManos 32a2bd1dea Fix jar signer not applying to universal packed in the installer. 2016-02-07 15:44:46 -08:00
RainWarrior 12c924751a Fix TRSRTransformation.toItemTransform. Closes #2425. 2016-02-07 17:49:06 +03:00
Fry 4ae2a1fa35 Merge pull request #2437 from pau101/master
Fix #2321
2016-02-07 15:16:22 +03:00
pau101 cb70f1378c Fix #2321 2016-02-04 22:58:21 -08:00
LexManos 8af1624f9e Merge pull request #2423 from Mumfrey/fix/jdt
Fix ASM SignatureReader choking on invalid lambda local var signatures emitted by JDT
2016-02-04 12:34:04 -06:00
RainWarrior 085b28ba35 Revert binary-incompatible changes in models. 2016-02-04 13:34:40 +03:00
RainWarrior e611162de5 Fix droppers not dropping. 2016-02-03 19:11:33 +03:00
RainWarrior bfa17d2f0d One day I will learn to include all required classes in the commit. 2016-02-02 12:42:41 +03:00
RainWarrior 3bdc75ad49 Added "gui3d" and "smooth_lighting" options to the forge blockstate. Implemented them for vanilla and B3D models. Added generic types to IModel subinterfaces, to simplify chaining. 2016-02-02 12:23:26 +03:00
LexManos 7103862bf9 Merge pull request #2434 from matthewprenger/logcommandexceptions
Log unknown exceptions in commands. Resolves #2433
2016-02-01 18:36:39 -06:00
Matthew Prenger 76f659c02e Log unknown exceptions in commands. Resolves #2433 2016-02-01 18:25:40 -06:00
Mumfrey 63798d6a8f Fix ASM SignatureReader choking on lambda signatures generated by JDT 2016-01-29 00:19:59 +00:00
RainWarrior 741fdd0a85 Fixed incorrect patch to GenLayer, causing large vanilla biomes to not work properly. 2016-01-28 08:00:27 +03:00
RainWarrior 7b7d18f676 Provide original armor model in the custom armor model hook. 2016-01-28 07:43:55 +03:00
RainWarrior be6c2bd588 Fixed small bug in item extraction code. 2016-01-27 13:29:07 +03:00
RainWarrior a0bf0155ac Fix NoSuchElementException in ModelBlockAnimation caused by empty event list. 2016-01-26 01:22:21 +03:00
LexManos e45d111685 Bump version in prep for new Recomended Build. 2016-01-25 11:32:41 -08:00
LexManos b71b963301 Loosen TileEntity's default hasCapability implementation. Modders should specifically opt in. 2016-01-25 11:27:08 -08:00
LexManos 7a0a801740 Merge pull request #2336 from VikeStep/master
[1.8.9] Add EntityTravelToDimensionEvent
2016-01-25 11:07:19 -08:00
RainWarrior 960717eb0c Fixed minor race condition between mouse clicks and TESR in the animation example. 2016-01-25 17:39:43 +03:00
VikeStep 026d179c0d Add EntityTravelToDimensionEvent
Resolve Merge Conflict

Move event call inside conditional
2016-01-25 17:57:52 +10:00
RainWarrior e929199758 Sometimes I forget how much trivial things are missing from Java 6. 2016-01-24 10:10:21 +03:00
Fry e9be24700e Merge pull request #2331 from RainWarrior/model-animation
Model animation system
2016-01-24 10:01:58 +03:00
RainWarrior 0710bdf3f5 Model animation system.
Main things of interest:
  * IAnimationStateMachine - state machine for animations; can load
    from json.
  * AnimationTESR - automatic TESR for animated models.
  * AnimationModelBase - same for entities.
  * ITimeValue - time-varying value, used to control animation
    parameters from code.

  * TESRs can now be batched - look at TESR.renderTileEntityFast +
    TE.hasFastRenderer.
  * RegionRenderCache is not accessible to TESRs and other client-side
    logic - MinecraftForgeClient.getRegionRenderCache.
2016-01-24 09:59:38 +03:00
LexManos 01919e4eed Fix J6 compile error in IItemHandler PR. 2016-01-23 22:52:32 -08:00
LexManos 5257739d06 Merge pull request #2401 from ShetiPhian/Fix-isBeaconBase-BlockPos
Fixed: the BlockPos passed to isBeaconBase
2016-01-23 22:07:31 -08:00
LexManos e9a86f27fb Merge pull request #2385 from rwtema/master
Add IItemHandler capability
2016-01-23 22:06:29 -08:00
rwtema a1e41f5464 Add IItemHandler capability
Add the actual patches that I forgot.

Add simple implementations of IStorage and the factory methods.

Add ItemStackHandler. A simple IItemHandler implementaton.

return nulls, not throw nulls.

Move the vanilla wrappers to a separate class for now.

Minor clean ups of VanillaWrapper code.

Inline static methods.

Add comments.

Minor cleanup of code.

Remove redundant size field and add a validate slot index method.

Minor formatting issues.

Break early If stacksize to insert is 0.

Remove setByte() methods.

Throw exception if IItemHandler can't be modifyed in NBT loading.

Replace event handler with patches

Add capability to mine cart inventory entities.

Change formatting and registration of capability.

Make InventoryPlayer implements IItemHandler because why not. Also added a field to allow mods that add additional player inventory space to publicly expose them.

Reduce patch sizes

Lazy initialization of the item handler for vanilla tiles.

Minor formatting changes.

Create a single vanilla chest item handler that will merge with adjacent chests when detected. Added hooks to reset the cached adjacent value when a block update is detected and when a chunk loads.

Revert "Make InventoryPlayer implements IItemHandler because why not. Also added a field to allow mods that add additional player inventory space to publicly expose them."

This reverts commit 306d4a37fd0e8c8a0754411c013b750dfe8e2c87.

Fix furnace derp

Replace double chest code with a simpler method.

Vanilla wrappers implement IItemHandlerModifiable (since they are modifiable)

Minor code cleanups

Add an onContentsChanged() and onLoad() callback methods.to the default implementation.

Add slot as a parameter in the callback method.

Change IItemHandlerModifiable.setStackInSlot() to void, and added a note about not being intended for cross-mod use.

Improve ItemStackHandler handling of errored NBT.

Make the stacks array protected.

Fix a lot of derps in SlotItemHandler.

Fix derp in ItemStackHandler

Clarify comments on IItemHandler

ItemStackHandler no longer caches the stack array in local variable.

Clean up the Chests code to make intentions clearer

Vanilla hoppers have their cooldown activated when an item is inserted. Made this behavior part of an item handler (rather than the insertion code)

Fix mistake in ItemStackHandler

More documentation of potential edge cases in getStackInSlot()

Make limit checking more resiliant.
2016-01-24 05:20:58 +00:00
Timothy Tomkins 3b9741613c Fixed: BlockPos passed to isBeaconBase 2016-01-22 09:25:55 -05:00
LexManos d480ae5380 Merge pull request #2378 from blay09/bugfix/slotdrop
Fix items being dropped through slots outside GUI boundaries
2016-01-21 13:49:32 -08:00
LexManos bce7c6d61f Merge pull request #2399 from asiekierka/fix-2388
Fixed ItemStack.splitStack not preserving capabilities, Closes #2388
2016-01-21 13:42:13 -08:00
LexManos 82647f5b66 Restore OreDictionary.getOres(String, boolean) and doeOreNameExist(String) functions that went MIA in git merge issue.
Original Commit: https://github.com/MinecraftForge/MinecraftForge/commit/cd3bbfb02c9fcd4ce4bbf00f460dfdd6a386d107
2016-01-21 13:41:26 -08:00
LexManos be6577b9ce Fix invalid ServerHangWatchdog patch causing it to not apply. 2016-01-21 13:40:00 -08:00
asiekierka 568061864f Fix #2388 2016-01-21 22:09:23 +01:00
LexManos c7dafeed5f Merge pull request #2396 from Minecrell/patch-3
Strip console formatting codes for Vanilla log file
2016-01-21 13:02:34 -08:00
LexManos be8eb484d1 Merge pull request #2394 from iLexiconn/master
Fixed makeItemStack ignoring stackSize
2016-01-21 13:00:34 -08:00
Minecrell 66340a7ec9 Strip console formatting codes for Vanilla log file 2016-01-21 20:00:41 +01:00
iLexiconn a3d4fe5d25 Fixed makeItemStack ignoring stackSize
Fixes #2376
2016-01-21 15:31:39 +01:00
RainWarrior 17e8de8a3a Fixed error detection login in ModelLoader, reduced the maximum number of printed stack traces to 5 per domain. 2016-01-20 01:20:26 +03:00
LexManos 447a87c0c7 Fix forge logging not working correctly in ForgeDev. 2016-01-19 02:14:40 -08:00
LexManos f3c2eb8e9c Fix Deobfusication transformer throwing verification errores in Eclipse development environments. 2016-01-19 02:14:22 -08:00
RainWarrior 968b7cae40 Correctly handle error caused by missing/malformed bucket model definition file. 2016-01-18 21:35:23 +03:00
LexManos 812e69cee3 Call deserialze on capabilities in ItemStack.setItem. Closes #2384 2016-01-17 14:19:59 -08:00
LexManos 3c5103acfb Fix ItemStacks not getting the parent capability provider from items. Closes #2383 2016-01-17 13:37:57 -08:00
cpw b8238e7f22 Merge pull request #2367 from kashike/feature/quiet-watchdog
Skip hang detection on first run of the server hang watchdog
2016-01-16 19:16:23 -05:00
cpw 7574b32b47 Merge pull request #2358 from boq/bedless
Allow sleeping without bed block under player
2016-01-16 19:10:59 -05:00
Bartek Bok fae5ff67ed Allow sleeping without bed 2016-01-17 00:43:29 +01:00
RainWarrior accf6cf218 Fixed missing model error reporting, made block and item variants sort before loading, to make the splash screen info more useful. 2016-01-17 01:57:06 +03:00
cpw 90d1abebd4 Fix spruce not growing properly 2016-01-16 17:04:16 -05:00
cpw cc593d4b54 Fixed problem with LAN connections seeing the original ProxyPacket and consuming the first byte. Closes #2373 2016-01-16 16:34:02 -05:00
cpw 66895a520a Fix shouldRefresh not to be so over-eager about modded TEs. Should fix Packet21 causing a TE reset. 2016-01-16 16:11:34 -05:00
Blay09 30ac80f978 Fix items being dropped out of a GuiContainer when dealing with a slot outside of the xSize/ySize boundaries. 2016-01-16 06:34:07 +01:00
LexManos 7b92a27908 Clone FML packet indexes if channel is not open. Fixes potential threading issue. 2016-01-14 13:35:19 -08:00
Fry dad870ea0b Merge pull request #2375 from bonii-xx/dynbucket
Default bucket model is empty, allow bucket model without fluid.
2016-01-15 00:16:26 +03:00
Bernhard Bonigl 2857b710f8 Default bucket model is empty, allow bucket model without fluid.
This allows capsules, cans, bottles,... to use the same item model for their item variant. Also it's makes much more sense.
2016-01-14 22:13:31 +01:00
LexManos 38531a5ba8 Merge pull request #2370 from mezz/screenBackground
Add DrawScreenBackgroundEvent
2016-01-13 14:26:56 -08:00
mezz aee1bd6014 Add GuiScreenEvent.BackgroundDrawnEvent 2016-01-13 13:01:16 -08:00
cpw 9a737b0c90 Fix problem which meant runtime deobf to MCP names wasn't working. SRG named mods located in the mods dir of a dev
environment will now load normally.
2016-01-13 00:26:52 -05:00
kashike 2ba595b207 Skip hang detection on first run of the server hang watchdog 2016-01-12 04:15:11 -08:00
LexManos 17db34ae31 New Capability system allowing for more manageable world object features.
When combined with @Optional this should address all issues of soft dependancy on mods/apis.
This also addresses the issue of dynamic functionality in TileEntities/Entities.

Current capability providers: TileEntity, Entity, ItemStack

Also added INBTSerializeable, a generic interface for game objects that can be written to/from NBT tags.

Vanilla capabilities will be coming soon, mostly on request and review.
So start requesting capabiliteis on vanilla/Forge features.
2016-01-11 16:04:22 -08:00
LexManos 4672f7bab0 Fixed banners not droping the correct item when harvested using modded mechanics. Closes #2258 2016-01-10 21:34:52 -08:00
LexManos aff6b0004c Fix jline server console not showing colored text. Closes #2334 2016-01-10 20:39:22 -08:00
LexManos 2594196c15 Fixed GuiWrongMinecraft having wrong Log file name. Closes #2348 2016-01-10 20:31:55 -08:00
LexManos afc46fa59a Made WrongMinecraftVersionException and ModSortingException a bit easier to read in log files. Closes: #2345 2016-01-10 11:07:12 -08:00
LexManos 76c40896e4 Remove dead code in JarDiscoverer. Closes #2346 2016-01-10 11:06:37 -08:00
RainWarrior 4dbf1965df Catch GROUND item transform type with the forge hook too. 2016-01-10 13:07:07 +03:00
RainWarrior f42137907e Implemented face culling for item models, improves performance slightly. Closes #2326 2016-01-09 19:05:18 +03:00
LexManos 0921473f53 Merge pull request #2355 from williewillus/fixentityitemdupe
Fix bug with /give command and items with larger than default lifespans
2016-01-08 19:13:52 -08:00
Vincent Lee 591cd5c1b0 Fix visual effect entity persisting longer than it should
Fix derp
2016-01-08 18:51:08 -06:00
LexManos c78a7ce41e Fixed issue with WorldServer.getTileEntities when being called with ranges that overlap chunks oddly. Closes #2350 2016-01-08 14:42:29 -08:00
RainWarrior 5c5d946ff5 Made block model loading bar more robust, and fixed the count. 2016-01-07 02:09:29 +03:00
RainWarrior 95615cb4bf Added progress bar for the ModelLoader. 2016-01-06 22:53:34 +03:00
RainWarrior 68339f51cf Derp. 2016-01-06 22:06:36 +03:00
RainWarrior 949e77b46a Model loader improvements: adding custom data/textures to models that don't need them doesn't cause a error now, since it's common to put those in the defaults section of the blockstate json; you can get IModel associated with the variant now - using ModelLoaderRegistry.getModel; MultiLayerModel should now respect transformations applied to it, and respect part transformations. 2016-01-06 22:00:43 +03:00
cpw 632d8e553d STFU I know how to code. *shouts* get off my lawn! 2016-01-04 16:18:44 -05:00
cpw 035dd4c245 Make the parent dir tree for the dep extractor 2016-01-04 09:07:28 -05:00
RainWarrior d8440de49b Changed default implementation of Block.getExtendedState. Closes #2309. 2016-01-04 15:31:03 +03:00
RainWarrior 4732acc1c4 Java6 + Eclipse + Gradle strike again. 2016-01-04 15:18:36 +03:00
RainWarrior b8dd4c54e1 Fixed implementation if IRetexturableModel in ItemLayerModel. Closes #2244. 2016-01-04 14:21:31 +03:00
RainWarrior f562579054 Don't crash on exception during loading of item variants from blockstate jsons. 2016-01-04 14:08:52 +03:00
RainWarrior 856a9c3cdd Fixed perspective transformation handling for fluid models, changed inventory fluid model to use unrotated still texture. 2016-01-04 13:54:45 +03:00
RainWarrior 826b1d20f8 Fixed invalid flow vector caching of still fluids. 2016-01-04 12:48:10 +03:00
RainWarrior 686b32bfd0 Fixed random offset not working properly for flatly-lit models. 2016-01-04 12:04:30 +03:00
cpw 3c08c104cc Explicitly close the file. 2016-01-03 10:06:25 -05:00
cpw dc4dc55dcd Add a simple ContainedDep mechanic- mods can contain other mods or libs, and can specify them using a manifest tag: "ContainedDeps".
This is a space separated (manifest standard) list of jar files that are to be extracted into the version specific directory.

There's also a special system property "fml.skipContainedDeps" that will allow for runtime skipping of extraction of contained deps (a comma separated list, based on the file name).
2016-01-02 17:28:35 -05:00
LexManos 1a31ff9f06 Added new get/setRegistryName functions to Item and Block.
And helper functions in GameRegistry to allow for registering using those names automatically.
This is to simplify registration and get rid of the horrible hacks users are doing now with 'unlocalised names'.
2016-01-02 12:58:57 -08:00
cpw fb54ea94c0 Move substitution activation after id loading. This should fix the problem of null for existing object. 2016-01-02 12:06:53 -05:00
RainWarrior d105c444ee SidedProxy now has sensible default values - nested ClientProxy and ServerProxy classes. 2016-01-02 09:59:14 +03:00
LexManos 40a124d571 Merge pull request #2332 from killjoy1221/master
Add links for messages and other commands
2016-01-01 20:00:52 -08:00
Matthew Messinger 577f607b5f Add links for messages and other commands 2016-01-01 21:20:27 -05:00
RainWarrior 104feb2973 Reverted Render registration changes due to them working. 2016-01-01 08:51:56 +03:00
RainWarrior a4123580b1 Nobody is left behind. 2016-01-01 02:17:10 +03:00
RainWarrior cf2bbd1353 Fixed RenderingRegistry not working. Closes #2312. 2016-01-01 02:01:03 +03:00
cpw 6e90348dc5 Fix that the dummy registry entries don't allow clients connecting to servers. Also fix that it repeatedly nags about missing stuff in the world. 2015-12-31 17:59:11 -05:00
LexManos 50f235c81b Fix boss health bar rendering when debug overlay is enabled. Closes #2328 2015-12-31 14:48:54 -08:00
LexManos 755df95c96 Swap Mod and Realms button to fix new realms 'notification' icon. 2015-12-31 14:41:08 -08:00
LexManos e0f0273c5e Fix J6 compile issue with ModelFluid. 2015-12-31 14:40:32 -08:00
LexManos 3665d7bf73 Allow for default 1.8.8 mods to be loaded. Should be SRG compatible. 2015-12-31 14:40:17 -08:00
RainWarrior ea2beba5ca Restored transparency to the Forge logo. 2015-12-30 19:35:32 +03:00
RainWarrior 6c40b15d04 Updated the forge logo to a higher-quality GIF file. Closes #2276. 2015-12-30 19:10:33 +03:00
RainWarrior 23a2316157 Fixed wrong import. 2015-12-30 16:14:27 +03:00
RainWarrior 10658f682e Fixed broken leaky caching of OBJ models. 2015-12-30 16:08:08 +03:00
RainWarrior 33b1f8f30f Caching of fluid models. Fixes #2145. 2015-12-30 13:31:36 +03:00
RainWarrior db3e039b31 TESRs registering in preinit don't break pistons anymore. Fixes #2298. 2015-12-30 11:37:32 +03:00
RainWarrior 09e9a181ee Fixed color disabling not working for forge pipeline. Closes #2286. 2015-12-30 11:22:22 +03:00
RainWarrior 56eba05237 1.8.9 update 2015-12-30 07:15:03 +03:00
LexManos 6644e8c9ed Merge remote-tracking branch 'origin/1.8.8' 2015-12-29 19:25:38 -08:00
225 changed files with 10869 additions and 1265 deletions

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@
*.java text eol=lf
*.gradle text eol=crlf
*.png binary
*.gif binary
*.exe binary
*.dll binary
*.jar binary
@@ -11,4 +12,4 @@
*.zip binary
*.pyd binary
*.cfg text eol=lf
*.py text eol=lf
*.py text eol=lf
+7 -5
View File
@@ -26,11 +26,11 @@ apply plugin: "net.minecraftforge.gradle.patcher"
apply plugin: "net.minecraftforge.gradle.launch4j"
minecraft {
version = "1.8.8"
//mappings = 'stable_16'
mappings = "snapshot_nodoc_20151122"
version = "1.8.9"
mappings = 'stable_20'
//mappings = "snapshot_nodoc_20151122"
workspaceDir = "projects"
versionJson = "jsons/1.8.8-dev.json"
versionJson = "jsons/1.8.9-dev.json"
buildUserdev = true
buildInstaller = true
installerVersion = "1.4"
@@ -61,11 +61,12 @@ group = 'net.minecraftforge'
version = getVersionFromJava(file("src/main/java/net/minecraftforge/common/ForgeVersion.java"))
extractForgeSources { exclude "**/SideOnly.java", "**/Side.java" }
extractForgeResources { exclude "**/log4j2.xml" }
genGradleProjects { addTestCompileDep "junit:junit:4.12" }
processJson {
releaseJson = "jsons/1.8.8-rel.json"
releaseJson = "jsons/1.8.9-rel.json"
addReplacements([
"@minecraft_version@": project.minecraft.version,
"@version@": project.version,
@@ -156,6 +157,7 @@ task signUniversal(type: SignJar, dependsOn: 'outputJar') {
}
uploadArchives.dependsOn signUniversal
build.dependsOn signUniversal
installer.dependsOn signUniversal
// MDK package
+95
View File
@@ -0,0 +1,95 @@
{
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"inheritsFrom": "1.8.9",
"minecraftArguments": "--version FML_DEV --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker",
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.12"
},
{
"name": "jline:jline:2.13",
"children": ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "com.google.code.findbugs:jsr305:1.3.9",
"children": ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.ow2.asm:asm-debug-all:5.0.3",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "com.typesafe.akka:akka-actor_2.11:2.3.3",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "com.typesafe:config:1.2.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-actors-migration_2.11:1.1.0",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-compiler:2.11.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-library:2.11.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.modules:scala-parser-combinators_2.11:1.0.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang:scala-reflect:2.11.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.modules:scala-swing_2.11:1.0.1",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "org.scala-lang.modules:scala-xml_2.11:1.0.2",
"children" : ["sources"],
"url" : "http://repo.maven.apache.org/maven2"
},
{
"name": "lzma:lzma:0.0.1"
},
{
"name": "java3d:vecmath:1.5.2"
},
{
"name": "net.sf.trove4j:trove4j:3.0.3"
}
],
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 14,
"assets": "1.8"
}
+141
View File
@@ -0,0 +1,141 @@
{
"install": {
"profileName": "@project@",
"target":"@minecraft_version@-@project@@version@",
"path":"@artifact@",
"version":"@project@ @version@",
"filePath":"@universal_jar@",
"welcome":"Welcome to the simple @project@ installer.",
"minecraft":"@minecraft_version@",
"mirrorList" : "http://files.minecraftforge.net/mirror-brand.list",
"logo":"/big_logo.png"
},
"versionInfo": {
"id": "@minecraft_version@-@project@@version@",
"time": "@timestamp@",
"releaseTime": "1960-01-01T00:00:00-0700",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker",
"mainClass": "net.minecraft.launchwrapper.Launch",
"minimumLauncherVersion": 14,
"assets": "1.8",
"inheritsFrom": "1.8.9",
"jar": "1.8.9",
"libraries": [
{
"name": "@artifact@",
"url": "http://files.minecraftforge.net/maven/"
},
{
"name": "net.minecraft:launchwrapper:1.12",
"serverreq":true
},
{
"name": "org.ow2.asm:asm-all:5.0.3",
"serverreq":true
},
{
"name": "jline:jline:2.13",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "2d9530d0a25daffaffda7c35037b046b627bb171" ],
"serverreq":true,
"clientreq":false
},
{
"name": "com.typesafe.akka:akka-actor_2.11:2.3.3",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "ed62e9fc709ca0f2ff1a3220daa8b70a2870078e", "25a86ccfdb6f6dfe08971f4825d0a01be83a6f2e" ],
"serverreq":true,
"clientreq":true
},
{
"name": "com.typesafe:config:1.2.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "f771f71fdae3df231bcd54d5ca2d57f0bf93f467", "7d7bc36df0989d72f2d5d057309675777acc528b" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-actors-migration_2.11:1.1.0",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "dfa8bc42b181d5b9f1a5dd147f8ae308b893eb6f", "8c9aaeeb68487ca519411a14068e1b4d69739207" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-compiler:2.11.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "56ea2e6c025e0821f28d73ca271218b8dd04926a", "1444992390544ba3780867a13ff696a89d7d1639" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "87213338cd5a153a7712cb574c0ddd2edfee0386", "0b4c1bf8d48993f138d6e10c0c144e50acfff581" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "1f7371605d4ba42aa26d3443440c0083c587b4e9", "1ea655dda4504ae0a367327e2340cd3beaee6c73" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-library:2.11.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "0e11da23da3eabab9f4777b9220e60d44c1aab6a", "1e4df76e835201c6eabd43adca89ab11f225f134" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-parser-combinators_2.11:1.0.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "f05d7345bf5a58924f2837c6c1f4d73a938e1ff0", "a1cbbcbde1dcc614f4253ed1aa0b320bc78d8f1d" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-reflect:2.11.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "6580347e61cc7f8e802941e7fde40fa83b8badeb", "91ce0f0be20f4a536321724b4b3bbc6530ddcd88" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-swing_2.11:1.0.1",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "b1cdd92bd47b1e1837139c1c53020e86bb9112ae", "d77152691dcf5bbdb00529af37aa7d3d887b3e63" ],
"serverreq":true,
"clientreq":true
},
{
"name": "org.scala-lang:scala-xml_2.11:1.0.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "7a80ec00aec122fba7cd4e0d4cdd87ff7e4cb6d0", "62736b01689d56b6d09a0164b7ef9da2b0b9633d" ],
"serverreq":true,
"clientreq":true
},
{
"name": "lzma:lzma:0.0.1",
"serverreq":true
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.6",
"serverreq":true
},
{
"name": "java3d:vecmath:1.5.2",
"clientreq":true,
"serverreq":true
},
{
"name": "net.sf.trove4j:trove4j:3.0.3",
"clientreq":true,
"serverreq":true
}
]
}
}
+244
View File
@@ -0,0 +1,244 @@
{
"id": "1.8.9",
"time": "2015-12-03T12:24:39+03:00",
"releaseTime": "2015-12-03T12:24:39+03:00",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}",
"libraries": [
{
"name": "oshi-project:oshi-core:1.1"
},
{
"name": "net.java.dev.jna:jna:3.4.0"
},
{
"name": "net.java.dev.jna:platform:3.4.0"
},
{
"name": "com.ibm.icu:icu4j-core-mojang:51.2"
},
{
"name": "net.sf.jopt-simple:jopt-simple:4.6"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "io.netty:netty-all:4.0.23.Final"
},
{
"name": "com.google.guava:guava:17.0"
},
{
"name": "org.apache.commons:commons-lang3:3.3.2"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "commons-codec:commons-codec:1.9"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.4"
},
{
"name": "com.mojang:authlib:1.5.21"
},
{
"name": "com.mojang:realms:1.7.48"
},
{
"name": "org.apache.commons:commons-compress:1.8.1"
},
{
"name": "org.apache.httpcomponents:httpclient:4.3.3"
},
{
"name": "commons-logging:commons-logging:1.1.3"
},
{
"name": "org.apache.httpcomponents:httpcore:4.3.2"
},
{
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822",
"rules": [
{
"action": "allow",
"os": {
"name": "osx"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch:6.5"
},
{
"name": "tv.twitch:twitch-platform:6.5",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows-${arch}",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "tv.twitch:twitch-external-platform:4.5",
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
],
"natives": {
"windows": "natives-windows-${arch}"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.client.main.Main",
"minimumLauncherVersion": 14,
"assets": "1.8"
}
@@ -188,7 +188,7 @@
}
protected ItemStack func_180643_i(IBlockState p_180643_1_)
@@ -1010,6 +1030,1065 @@
@@ -1010,6 +1030,1147 @@
return "Block{" + field_149771_c.func_177774_c(this) + "}";
}
@@ -1214,10 +1214,43 @@
+ */
+ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return func_176221_a(state, world, pos);
+ return state;
+ }
+
+ /**
+ * Called when the entity is inside this block, may be used to determined if the entity can breathing,
+ * display material overlays, or if the entity can swim inside a block.
+ *
+ * @param world that is being tested.
+ * @param blockpos position thats being tested.
+ * @param iblockstate state at world/blockpos
+ * @param entity that is being tested.
+ * @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
+ * @param materialIn to test for.
+ * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
+ * @return null for default behavior, true if the entity is within the material, false if it was not.
+ */
+ public Boolean isEntityInsideMaterial(World world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead)
+ {
+ return null;
+ }
+
+ /**
+ * Called when boats or fishing hooks are inside the block to check if they are inside
+ * the material requested.
+ *
+ * @param world world that is being tested.
+ * @param pos block thats being tested.
+ * @param boundingBox box to test, generally the bounds of an entity that are besting tested.
+ * @param materialIn to check for.
+ * @return null for default behavior, true if the box is within the material, false if it was not.
+ */
+ public Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
+ {
+ return null;
+ }
+
+ /**
+ * Queries if this block should render in a given layer.
+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer
+ */
@@ -1249,6 +1282,55 @@
+ return capturedDrops.get();
+ }
+ }
+
+ private ResourceLocation registryName = null;
+ /**
+ * Sets a unique name for this Block. This should be used for uniquely identify the instance of the Block.
+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
+ *
+ * The supplied name will be prefixed with the currently active mod's modId.
+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
+ *
+ * If a name already exists, or this Block is already registered in a registry, then an IllegalStateException is thrown.
+ *
+ * Returns 'this' to allow for chaining.
+ *
+ * @param name Unique registry name
+ * @return This instance
+ */
+ public final Block setRegistryName(String name)
+ {
+ if (getRegistryName() != null)
+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName());
+ int index = name.lastIndexOf(':');
+ String oldPrefix = index == -1 ? "" : name.substring(0, index);
+ name = index == -1 ? name : name.substring(index + 1);
+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer();
+ String prefix = mc == null ? "minecraft" : mc.getModId();
+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0)
+ {
+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name);
+ prefix = oldPrefix;
+ }
+ this.registryName = new ResourceLocation(prefix, name);
+ return this;
+ }
+ public final Block setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); }
+ public final Block setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); }
+
+ /**
+ * A unique identifier for this block, if this block is registered in the game registry it will return that name.
+ * Otherwise it will return the name set in setRegistryName().
+ * If neither are valid null is returned.
+ *
+ * @return Unique identifier or null.
+ */
+ public final String getRegistryName()
+ {
+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString();
+ return registryName != null ? registryName.toString() : null;
+ }
+ /* ========================================= FORGE END ======================================*/
+
public static void func_149671_p()
@@ -0,0 +1,54 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBanner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java
@@ -85,22 +85,7 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{
- TileEntity tileentity = p_180653_1_.func_175625_s(p_180653_2_);
-
- if (tileentity instanceof TileEntityBanner)
{
- ItemStack itemstack = new ItemStack(Items.field_179564_cE, 1, ((TileEntityBanner)tileentity).func_175115_b());
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- tileentity.func_145841_b(nbttagcompound);
- nbttagcompound.func_82580_o("x");
- nbttagcompound.func_82580_o("y");
- nbttagcompound.func_82580_o("z");
- nbttagcompound.func_82580_o("id");
- itemstack.func_77983_a("BlockEntityTag", nbttagcompound);
- func_180635_a(p_180653_1_, p_180653_2_, itemstack);
- }
- else
- {
super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_);
}
}
@@ -133,6 +118,28 @@
}
}
+ @Override
+ public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntity te = world.func_175625_s(pos);
+
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ if (te instanceof TileEntityBanner)
+ {
+ TileEntityBanner banner = (TileEntityBanner)te;
+ ItemStack item = new ItemStack(Items.field_179564_cE, 1, banner.func_175115_b());
+ NBTTagCompound nbt = new NBTTagCompound();
+ TileEntityBanner.func_181020_a(nbt, banner.func_175115_b(), banner.func_181021_d());
+ item.func_77983_a("BlockEntityTag", nbt);
+ ret.add(item);
+ }
+ else
+ {
+ ret.add(new ItemStack(Items.field_179564_cE, 1, 0));
+ }
+ return ret;
+ }
+
public static class BlockBannerHanging extends BlockBanner
{
public BlockBannerHanging()
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java
@@ -43,7 +43,7 @@
{
ItemStack itemstack = tileentitydispenser.func_70301_a(i);
- if (itemstack != null)
+ if (itemstack != null && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, tileentitydispenser, i, itemstack))
{
EnumFacing enumfacing = (EnumFacing)p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
BlockPos blockpos = p_176439_2_.func_177972_a(enumfacing);
@@ -9,7 +9,7 @@
}
protected BlockRailBase(boolean p_i45389_1_)
@@ -175,6 +175,81 @@
@@ -175,6 +175,98 @@
public abstract IProperty<BlockRailBase.EnumRailDirection> func_176560_l();
@@ -18,7 +18,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)
@@ -30,7 +30,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)
@@ -39,10 +39,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)
@@ -55,7 +72,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)
+ {
@@ -91,7 +108,7 @@
public static enum EnumRailDirection implements IStringSerializable
{
NORTH_SOUTH(0, "north_south"),
@@ -245,6 +320,7 @@
@@ -245,6 +337,7 @@
private IBlockState field_180366_e;
private final boolean field_150656_f;
private final List<BlockPos> field_150657_g = Lists.<BlockPos>newArrayList();
@@ -99,17 +116,19 @@
public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_)
{
@@ -253,7 +329,8 @@
@@ -252,8 +345,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(BlockRailBase.this.func_176560_l());
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.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_);
+ canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_);
this.func_180360_a(blockrailbase$enumraildirection);
}
@@ -439,7 +516,7 @@
@@ -439,7 +533,7 @@
}
}
@@ -118,7 +137,7 @@
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
{
@@ -452,7 +529,7 @@
@@ -452,7 +546,7 @@
}
}
@@ -127,7 +146,7 @@
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
{
@@ -595,7 +672,7 @@
@@ -595,7 +689,7 @@
}
}
@@ -136,7 +155,7 @@
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
{
@@ -608,7 +685,7 @@
@@ -608,7 +702,7 @@
}
}
@@ -170,7 +170,7 @@
int i = itemstack != null ? itemstack.field_77994_a : 0;
+
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b).isCanceled();
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f).isCanceled();
+ if (result) { //Forge: Kept separate to simplify patch
if (this.field_71442_b.func_178890_a(this.field_71439_g, this.field_71441_e, itemstack, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f))
{
@@ -186,7 +186,7 @@
ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g();
- if (itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1))
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, field_71441_e, null, null).isCanceled();
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, field_71441_e, null, null, null).isCanceled();
+ if (result && itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1))
{
this.field_71460_t.field_78516_c.func_78445_c();
@@ -8,7 +8,7 @@
+ {
+ for (int y = 0; y < height; y++)
+ {
+ if (func_175162_d(pos.func_177982_a(0, y, 0))) return false;
+ if (!func_175162_d(pos.func_177982_a(0, y, 0))) return false;
+ }
+ return true;
+ }
@@ -21,9 +21,9 @@
double d1 = p_145771_5_ - (double)blockpos.func_177952_p();
- if (!this.func_175162_d(blockpos))
+ int entHeight = Math.max(Math.round(this.field_70131_O), 1);
+ int entHeight = Math.max((int)Math.ceil(this.field_70131_O), 1);
+
+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight);
+ boolean inTranslucentBlock = !this.isHeadspaceFree(blockpos, entHeight);
+
+ if (inTranslucentBlock)
{
@@ -31,31 +31,40 @@
double d2 = 9999.0D;
- if (this.func_175162_d(blockpos.func_177976_e()) && d0 < d2)
+ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2)
{
d2 = d0;
i = 0;
}
- if (this.func_175162_d(blockpos.func_177974_f()) && 1.0D - d0 < d2)
+ if (!this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d0 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d0 < d2)
{
d2 = 1.0D - d0;
i = 1;
}
- if (this.func_175162_d(blockpos.func_177978_c()) && d1 < d2)
+ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2)
{
d2 = d1;
i = 4;
}
- if (this.func_175162_d(blockpos.func_177968_d()) && 1.0D - d1 < d2)
+ if (!this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d1 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d1 < d2)
{
d2 = 1.0D - d1;
i = 5;
@@ -415,7 +428,7 @@
private boolean func_175162_d(BlockPos p_175162_1_)
{
- return !this.field_70170_p.func_180495_p(p_175162_1_).func_177230_c().func_149721_r() && !this.field_70170_p.func_180495_p(p_175162_1_.func_177984_a()).func_177230_c().func_149721_r();
+ return !this.field_70170_p.func_180495_p(p_175162_1_).func_177230_c().func_149721_r();
}
public void func_70031_b(boolean p_70031_1_)
@@ -448,6 +461,12 @@
public void func_85030_a(String p_85030_1_, float p_85030_2_, float p_85030_3_)
@@ -1,18 +1,16 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java
@@ -197,6 +197,11 @@
@@ -223,7 +223,8 @@
{
this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0])));
this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0])));
this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0])));
+ GuiButton fmlModButton = new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("fml.menu.mods"));
+ fmlModButton.field_146128_h = this.field_146294_l / 2 + 2;
+ field_175372_K.field_146120_f = 98;
+ fmlModButton.field_146120_f = 98;
+ this.field_146292_n.add(fmlModButton);
- this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0])));
+ this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online", new Object[0]).replace("Minecraft", "").trim()));
+ this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("fml.menu.mods")));
}
private void func_73972_b(int p_73972_1_, int p_73972_2_)
@@ -244,6 +249,11 @@
@@ -271,6 +272,11 @@
this.field_146297_k.func_71400_g();
}
@@ -24,7 +22,7 @@
if (p_146284_1_.field_146127_k == 11)
{
this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a);
@@ -489,7 +499,16 @@
@@ -516,7 +522,16 @@
s = s + " Demo";
}
@@ -10,37 +10,22 @@
}
protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_)
@@ -153,6 +154,11 @@
@@ -153,7 +154,13 @@
protected void func_146283_a(List<String> p_146283_1_, int p_146283_2_, int p_146283_3_)
{
- if (!p_146283_1_.isEmpty())
+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q);
+ }
+
+ protected void drawHoveringText(List<String> p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font)
+ {
if (!p_146283_1_.isEmpty())
+ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146294_l, field_146295_m, -1, font);
+ if (false && !p_146283_1_.isEmpty())
{
GlStateManager.func_179101_C();
@@ -163,7 +169,7 @@
for (String s : p_146283_1_)
{
- int j = this.field_146289_q.func_78256_a(s);
+ int j = font.func_78256_a(s);
if (j > i)
{
@@ -208,7 +214,7 @@
for (int k1 = 0; k1 < p_146283_1_.size(); ++k1)
{
String s1 = (String)p_146283_1_.get(k1);
- this.field_146289_q.func_175063_a(s1, (float)l1, (float)i2, -1);
+ font.func_175063_a(s1, (float)l1, (float)i2, -1);
if (k1 == 0)
{
@@ -436,6 +442,7 @@
RenderHelper.func_74518_a();
@@ -436,6 +443,7 @@
{
this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_);
}
@@ -48,7 +33,7 @@
this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_);
}
@@ -450,9 +457,15 @@
@@ -450,9 +458,15 @@
if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_))
{
@@ -64,7 +49,7 @@
}
}
}
@@ -482,8 +495,12 @@
@@ -482,8 +496,12 @@
this.field_146289_q = p_146280_1_.field_71466_p;
this.field_146294_l = p_146280_2_;
this.field_146295_m = p_146280_3_;
@@ -76,8 +61,8 @@
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_146292_n));
}
public void func_73866_w_()
@@ -496,7 +513,9 @@
public void func_183500_a(int p_183500_1_, int p_183500_2_)
@@ -502,7 +520,9 @@
{
while (Mouse.next())
{
@@ -87,7 +72,7 @@
}
}
@@ -504,7 +523,9 @@
@@ -510,7 +530,9 @@
{
while (Keyboard.next())
{
@@ -97,3 +82,11 @@
}
}
}
@@ -570,6 +592,7 @@
public void func_146276_q_()
{
this.func_146270_b(0);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this));
}
public void func_146270_b(int p_146270_1_)
@@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
@@ -73,6 +73,7 @@
s3 = s4;
}
+ s3 = FontRenderer.func_78282_e(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping.
ChatComponentText chatcomponenttext2 = new ChatComponentText(s3);
chatcomponenttext2.func_150255_a(ichatcomponent1.func_150256_b().func_150232_l());
list1.add(j + 1, chatcomponenttext2);
@@ -30,7 +30,15 @@
this.func_175175_a(i, j, textureatlassprite, 16, 16);
GlStateManager.func_179145_e();
flag1 = true;
@@ -463,6 +465,7 @@
@@ -326,6 +328,7 @@
int j = this.field_147003_i;
int k = this.field_147009_r;
boolean flag1 = p_73864_1_ < j || p_73864_2_ < k || p_73864_1_ >= j + this.field_146999_f || p_73864_2_ >= k + this.field_147000_g;
+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int l = -1;
if (slot != null)
@@ -463,10 +466,12 @@
protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_)
{
@@ -38,7 +46,12 @@
Slot slot = this.func_146975_c(p_146286_1_, p_146286_2_);
int i = this.field_147003_i;
int j = this.field_147009_r;
@@ -685,4 +688,16 @@
boolean flag = p_146286_1_ < i || p_146286_2_ < j || p_146286_1_ >= i + this.field_146999_f || p_146286_2_ >= j + this.field_147000_g;
+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int k = -1;
if (slot != null)
@@ -685,4 +690,16 @@
this.field_146297_k.field_71439_g.func_71053_j();
}
}
@@ -1,6 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java
@@ -419,7 +419,7 @@
@@ -200,6 +200,7 @@
{
this.func_175069_a(new ResourceLocation("shaders/post/invert.json"));
}
+ else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_175066_1_, this);
}
}
@@ -419,7 +420,7 @@
if (d3 < d2 || d2 == 0.0D)
{
@@ -9,7 +17,16 @@
{
if (d2 == 0.0D)
{
@@ -576,14 +576,8 @@
@@ -512,7 +513,7 @@
f = f * 60.0F / 70.0F;
}
- return f;
+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, block, p_78481_1_, f);
}
}
@@ -576,14 +577,8 @@
{
BlockPos blockpos = new BlockPos(entity);
IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos);
@@ -25,7 +42,7 @@
GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F);
GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F);
}
@@ -650,17 +644,20 @@
@@ -650,17 +645,20 @@
if (!this.field_78531_r.field_71474_y.field_74325_U)
{
@@ -53,7 +70,7 @@
}
GlStateManager.func_179109_b(0.0F, -f, 0.0F);
@@ -1103,7 +1100,7 @@
@@ -1103,7 +1101,7 @@
try
{
@@ -62,7 +79,7 @@
}
catch (Throwable throwable)
{
@@ -1164,7 +1161,7 @@
@@ -1164,7 +1162,7 @@
if (this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR)
{
@@ -71,7 +88,7 @@
}
else
{
@@ -1314,7 +1311,9 @@
@@ -1314,7 +1312,9 @@
GlStateManager.func_179094_E();
RenderHelper.func_74519_b();
this.field_78531_r.field_71424_I.func_76318_c("entities");
@@ -81,7 +98,7 @@
RenderHelper.func_74518_a();
this.func_175072_h();
GlStateManager.func_179128_n(5888);
@@ -1326,6 +1325,7 @@
@@ -1326,6 +1326,7 @@
EntityPlayer entityplayer = (EntityPlayer)entity;
GlStateManager.func_179118_c();
this.field_78531_r.field_71424_I.func_76318_c("outline");
@@ -89,7 +106,7 @@
renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_);
GlStateManager.func_179141_d();
}
@@ -1339,6 +1339,7 @@
@@ -1339,6 +1340,7 @@
EntityPlayer entityplayer1 = (EntityPlayer)entity;
GlStateManager.func_179118_c();
this.field_78531_r.field_71424_I.func_76318_c("outline");
@@ -97,7 +114,7 @@
renderglobal.func_72731_b(entityplayer1, this.field_78531_r.field_71476_x, 0, p_175068_2_);
GlStateManager.func_179141_d();
}
@@ -1380,6 +1381,15 @@
@@ -1380,6 +1382,15 @@
GlStateManager.func_179103_j(7425);
this.field_78531_r.field_71424_I.func_76318_c("translucent");
renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity);
@@ -113,7 +130,7 @@
GlStateManager.func_179103_j(7424);
GlStateManager.func_179132_a(true);
GlStateManager.func_179089_o();
@@ -1392,8 +1402,12 @@
@@ -1392,8 +1403,12 @@
this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_);
}
@@ -126,7 +143,7 @@
if (this.field_175074_C)
{
GlStateManager.func_179086_m(256);
@@ -1505,6 +1519,13 @@
@@ -1505,6 +1520,13 @@
protected void func_78474_d(float p_78474_1_)
{
@@ -140,7 +157,7 @@
float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_);
if (f > 0.0F)
@@ -1830,6 +1851,13 @@
@@ -1830,6 +1852,13 @@
this.field_175081_S = f7;
}
@@ -154,7 +171,7 @@
GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F);
}
@@ -1848,6 +1876,10 @@
@@ -1848,6 +1877,10 @@
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78468_2_);
@@ -165,7 +182,7 @@
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q))
{
float f1 = 5.0F;
@@ -1925,6 +1957,7 @@
@@ -1925,6 +1958,7 @@
GlStateManager.func_179102_b(f * 0.05F);
GlStateManager.func_179153_c(Math.min(f, 192.0F) * 0.5F);
}
@@ -27,7 +27,7 @@
}
+ potion.renderInventoryEffect(i, j, potioneffect, field_146297_k);
+ if (!potion.shouldRenderInvText(potioneffect)) continue;
+ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; }
String s1 = I18n.func_135052_a(potion.func_76393_a(), new Object[0]);
if (potioneffect.func_76458_c() == 1)
@@ -56,7 +56,15 @@
flag2 = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.field_70153_n == this.field_72777_q.field_71439_g;
if (!flag2)
@@ -662,6 +673,7 @@
@@ -654,6 +665,7 @@
this.field_72769_h.field_72984_F.func_76318_c("blockentities");
RenderHelper.func_74519_b();
+ TileEntityRendererDispatcher.field_147556_a.preDrawBatch();
for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.field_72755_R)
{
List<TileEntity> list1 = renderglobal$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b();
@@ -662,6 +674,7 @@
{
for (TileEntity tileentity2 : list1)
{
@@ -64,7 +72,7 @@
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity2, p_180446_3_, -1);
}
}
@@ -671,6 +683,7 @@
@@ -671,9 +684,11 @@
{
for (TileEntity tileentity : this.field_181024_n)
{
@@ -72,7 +80,11 @@
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1);
}
}
@@ -700,7 +713,7 @@
+ TileEntityRendererDispatcher.field_147556_a.drawBatch(pass);
this.func_180443_s();
@@ -700,7 +715,7 @@
Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c();
@@ -81,7 +93,7 @@
{
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, destroyblockprogress.func_73106_e());
}
@@ -1161,6 +1174,12 @@
@@ -1161,6 +1176,12 @@
public void func_174976_a(float p_174976_1_, int p_174976_2_)
{
@@ -94,7 +106,7 @@
if (this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1)
{
this.func_180448_r();
@@ -1378,6 +1397,12 @@
@@ -1378,6 +1399,12 @@
public void func_180447_b(float p_180447_1_, int p_180447_2_)
{
@@ -107,7 +119,7 @@
if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d())
{
if (this.field_72777_q.field_71474_y.func_181147_e() == 2)
@@ -1793,8 +1818,11 @@
@@ -1793,8 +1820,11 @@
double d4 = (double)blockpos.func_177956_o() - d1;
double d5 = (double)blockpos.func_177952_p() - d2;
Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c();
@@ -120,7 +132,7 @@
{
if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
{
@@ -1949,13 +1977,16 @@
@@ -1949,13 +1979,16 @@
if (p_174961_1_ != null)
{
ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_);
@@ -1,6 +1,28 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java
@@ -578,6 +578,11 @@
@@ -506,15 +506,15 @@
break;
case USHORT:
case SHORT:
- this.field_179001_a.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535));
- this.field_179001_a.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535));
- this.field_179001_a.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535));
+ this.field_179001_a.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535));
+ this.field_179001_a.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535));
+ this.field_179001_a.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535));
break;
case UBYTE:
case BYTE:
- this.field_179001_a.put(i, (byte)((int)p_181663_1_ * 127 & 255));
- this.field_179001_a.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255));
- this.field_179001_a.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255));
+ this.field_179001_a.put(i, (byte)((int)(p_181663_1_ * 127) & 255));
+ this.field_179001_a.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255));
+ this.field_179001_a.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255));
}
this.func_181667_k();
@@ -578,6 +578,16 @@
}
}
@@ -8,6 +30,11 @@
+ {
+ this.func_181670_b(field_179011_q.func_177338_f()/* / 4 * 4 */);
+ }
+
+ public boolean isColorDisabled()
+ {
+ return field_78939_q;
+ }
+
@SideOnly(Side.CLIENT)
public class State
@@ -1,15 +1,17 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
@@ -131,7 +131,7 @@
@@ -131,7 +131,9 @@
return;
}
- iblockaccess = new RegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1);
+ iblockaccess = createRegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1);
+ RegionRenderCache cache = createRegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1);
+ net.minecraftforge.client.MinecraftForgeClient.onRebuildChunk(field_178588_d, field_178586_f, cache);
+ iblockaccess = cache;
p_178581_4_.func_178543_a(compiledchunk);
}
finally
@@ -158,7 +158,7 @@
@@ -158,7 +160,7 @@
lvt_10_1_.func_178606_a(blockpos$mutableblockpos);
}
@@ -18,7 +20,7 @@
{
TileEntity tileentity = iblockaccess.func_175625_s(new BlockPos(blockpos$mutableblockpos));
TileEntitySpecialRenderer<TileEntity> tileentityspecialrenderer = TileEntityRendererDispatcher.field_147556_a.<TileEntity>func_147547_b(tileentity);
@@ -174,7 +174,9 @@
@@ -174,7 +176,9 @@
}
}
@@ -29,7 +31,7 @@
int j = enumworldblocklayer1.ordinal();
if (block.func_149645_b() != -1)
@@ -189,6 +191,7 @@
@@ -189,6 +193,7 @@
aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer);
}
@@ -37,7 +39,7 @@
}
for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values())
@@ -385,6 +388,26 @@
@@ -385,6 +390,26 @@
return this.field_178593_n;
}
@@ -9,7 +9,44 @@
float f2 = p_177077_9_.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.y;
GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
@@ -157,4 +157,25 @@
@@ -110,7 +110,6 @@
for (int j = 0; j < i; ++j)
{
- if (ibakedmodel.func_177556_c())
{
GlStateManager.func_179094_E();
@@ -119,25 +118,15 @@
float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
- GlStateManager.func_179109_b(f, f1, f2);
+ GlStateManager.func_179109_b(shouldSpreadItems() ? f : 0.0F, shouldSpreadItems() ? f1 : 0.0F, f2);
}
+ if (ibakedmodel.func_177556_c())
GlStateManager.func_179152_a(0.5F, 0.5F, 0.5F);
- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND);
+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND);
this.field_177080_a.func_180454_a(itemstack, ibakedmodel);
GlStateManager.func_179121_F();
}
- else
- {
- GlStateManager.func_179094_E();
- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND);
- this.field_177080_a.func_180454_a(itemstack, ibakedmodel);
- GlStateManager.func_179121_F();
- float f3 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.x;
- float f4 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.y;
- float f5 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.z;
- GlStateManager.func_179109_b(0.0F * f3, 0.0F * f4, 0.046875F * f5);
- }
}
GlStateManager.func_179121_F();
@@ -157,4 +146,25 @@
{
return TextureMap.field_110575_b;
}
@@ -1,8 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
@@ -193,6 +193,10 @@
@@ -192,7 +192,12 @@
this.field_178637_m = new RenderPlayer(this);
this.field_178636_l.put("default", this.field_178637_m);
this.field_178636_l.put("slim", new RenderPlayer(this, true));
+ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.field_78729_o);
}
+
+ public Map<String, RenderPlayer> getSkinMap() {
@@ -11,7 +13,7 @@
public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_)
{
@@ -241,9 +245,9 @@
@@ -241,9 +246,9 @@
IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_));
Block block = iblockstate.func_177230_c();
@@ -10,7 +10,7 @@
public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_)
{
super(p_i46156_1_);
@@ -83,6 +86,7 @@
@@ -83,10 +86,12 @@
public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
@@ -18,7 +18,22 @@
GlStateManager.func_179094_E();
GlStateManager.func_179129_p();
this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_);
@@ -191,6 +195,7 @@
- this.field_77045_g.field_78093_q = p_76986_1_.func_70115_ae();
+ boolean shouldSit = p_76986_1_.func_70115_ae() && (p_76986_1_.field_70154_o != null && p_76986_1_.field_70154_o.shouldRiderSit());
+ this.field_77045_g.field_78093_q = shouldSit;
this.field_77045_g.field_78091_s = p_76986_1_.func_70631_g_();
try
@@ -95,7 +100,7 @@
float f1 = this.func_77034_a(p_76986_1_.field_70758_at, p_76986_1_.field_70759_as, p_76986_9_);
float f2 = f1 - f;
- if (p_76986_1_.func_70115_ae() && p_76986_1_.field_70154_o instanceof EntityLivingBase)
+ if (shouldSit && p_76986_1_.field_70154_o instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)p_76986_1_.field_70154_o;
f = this.func_77034_a(entitylivingbase.field_70760_ar, entitylivingbase.field_70761_aq, p_76986_9_);
@@ -191,6 +196,7 @@
{
super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
@@ -26,7 +41,7 @@
}
protected boolean func_177088_c(T p_177088_1_)
@@ -469,10 +474,11 @@
@@ -469,10 +475,11 @@
public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_)
{
@@ -39,7 +54,7 @@
if (d0 < (double)(f * f))
{
@@ -518,6 +524,7 @@
@@ -518,6 +525,7 @@
}
}
}
@@ -0,0 +1,15 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
@@ -23,10 +23,11 @@
@SideOnly(Side.CLIENT)
public class TileEntityPistonRenderer extends TileEntitySpecialRenderer<TileEntityPiston>
{
- private final BlockRendererDispatcher field_178462_c = Minecraft.func_71410_x().func_175602_ab();
+ private BlockRendererDispatcher field_178462_c;
public void func_180535_a(TileEntityPiston p_180535_1_, double p_180535_2_, double p_180535_4_, double p_180535_6_, float p_180535_8_, int p_180535_9_)
{
+ if(field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab();
BlockPos blockpos = p_180535_1_.func_174877_v();
IBlockState iblockstate = p_180535_1_.func_174927_b();
Block block = iblockstate.func_177230_c();
@@ -0,0 +1,79 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
@@ -102,11 +102,14 @@
{
if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n())
{
+ if(!p_180546_1_.hasFastRenderer())
+ {
int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j / 1.0F, (float)k / 1.0F);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
+ }
BlockPos blockpos = p_180546_1_.func_174877_v();
this.func_178469_a(p_180546_1_, (double)blockpos.func_177958_n() - field_147554_b, (double)blockpos.func_177956_o() - field_147555_c, (double)blockpos.func_177952_p() - field_147552_d, p_180546_2_, p_180546_3_);
}
@@ -125,6 +128,11 @@
{
try
{
+ if(p_178469_1_.hasFastRenderer())
+ {
+ tileentityspecialrenderer.renderTileEntityFast(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_, batchBuffer.func_178180_c());
+ }
+ else
tileentityspecialrenderer.func_180535_a(p_178469_1_, p_178469_2_, p_178469_4_, p_178469_6_, p_178469_8_, p_178469_9_);
}
catch (Throwable throwable)
@@ -146,4 +154,49 @@
{
return this.field_147557_n;
}
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Buffer used for batched TESRs
+ */
+ private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000);
+
+ /**
+ * Prepare for a batched TESR rendering.
+ * You probably shouldn't call this manually.
+ */
+ public void preDrawBatch()
+ {
+ batchBuffer.func_178180_c().func_181668_a(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a);
+ }
+
+ /**
+ * Render all TESRs batched so far.
+ * You probably shouldn't call this manually.
+ */
+ public void drawBatch(int pass)
+ {
+ field_147553_e.func_110577_a(net.minecraft.client.renderer.texture.TextureMap.field_110575_b);
+ net.minecraft.client.renderer.RenderHelper.func_74518_a();
+ GlStateManager.func_179112_b(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.func_179147_l();
+ GlStateManager.func_179129_p();
+
+ if (net.minecraft.client.Minecraft.func_71379_u())
+ {
+ GlStateManager.func_179103_j(org.lwjgl.opengl.GL11.GL_SMOOTH);
+ }
+ else
+ {
+ GlStateManager.func_179103_j(org.lwjgl.opengl.GL11.GL_FLAT);
+ }
+
+ if(pass > 0)
+ {
+ batchBuffer.func_178180_c().func_181674_a((float)field_147554_b, (float)field_147555_c, (float)field_147552_d);
+ }
+ batchBuffer.func_78381_a();
+
+ net.minecraft.client.renderer.RenderHelper.func_74519_b();
+ }
}
@@ -0,0 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java
@@ -45,4 +45,6 @@
{
return false;
}
+
+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.WorldRenderer worldRenderer) {}
}
@@ -9,15 +9,7 @@
}
}
catch (Exception exception)
@@ -160,6 +160,7 @@
}
}
}
+ catch (FileNotFoundException e) {}
catch (IOException ioexception)
{
throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception);
@@ -294,6 +295,7 @@
@@ -294,6 +294,7 @@
protected void func_177592_e()
{
@@ -25,7 +17,7 @@
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"}));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"}));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"}));
@@ -336,6 +338,10 @@
@@ -336,6 +337,10 @@
this.field_177613_u.put(Item.func_150898_a(Blocks.field_180390_bo), Lists.newArrayList(new String[] {"oak_fence_gate"}));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_180407_aO), Lists.newArrayList(new String[] {"oak_fence"}));
this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList(new String[] {"oak_door"}));
@@ -36,7 +28,7 @@
}
protected List<String> func_177596_a(Item p_177596_1_)
@@ -352,7 +358,7 @@
@@ -352,7 +357,7 @@
protected ResourceLocation func_177583_a(String p_177583_1_)
{
@@ -45,7 +37,7 @@
return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a());
}
@@ -395,7 +401,7 @@
@@ -395,7 +400,7 @@
for (Entry<String, ResourceLocation> entry : this.field_177615_s.entrySet())
{
ResourceLocation resourcelocation = (ResourceLocation)entry.getValue();
@@ -54,7 +46,7 @@
ModelBlock modelblock1 = (ModelBlock)this.field_177611_h.get(resourcelocation);
if (modelblock1 != null && modelblock1.func_178303_d())
@@ -453,6 +459,11 @@
@@ -453,6 +458,11 @@
private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_)
{
@@ -66,7 +58,7 @@
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle")));
SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_)).func_177646_a(textureatlassprite);
@@ -463,13 +474,13 @@
@@ -463,13 +473,13 @@
BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing);
TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d)));
@@ -83,7 +75,7 @@
}
}
}
@@ -479,9 +490,14 @@
@@ -479,9 +489,14 @@
private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_)
{
@@ -99,7 +91,7 @@
private void func_177597_h()
{
this.func_177574_i();
@@ -722,4 +738,35 @@
@@ -722,4 +737,35 @@
field_177617_q.field_178317_b = "class generation marker";
field_177616_r.field_178317_b = "block entity marker";
}
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java
+++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java
@@ -981,6 +981,7 @@
@@ -994,6 +994,7 @@
public void func_74303_b()
{
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/command/CommandBase.java
+++ ../src-work/minecraft/net/minecraft/command/CommandBase.java
@@ -329,7 +329,7 @@
ichatcomponent.func_150258_a(" ");
}
- IChatComponent ichatcomponent1 = new ChatComponentText(p_147176_1_[i]);
+ IChatComponent ichatcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_147176_1_[i]); // Forge: links for messages
if (p_147176_3_)
{
@@ -17,3 +17,12 @@
if (i > -1)
{
List<Entity> list = PlayerSelector.<Entity>func_179656_b(p_71556_1_, astring[i], Entity.class);
@@ -107,7 +117,7 @@
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]);
chatcomponenttranslation.func_150256_b().func_150238_a(EnumChatFormatting.RED);
p_175786_1_.func_145747_a(chatcomponenttranslation);
- field_147175_a.warn("Couldn\'t process command: \'" + p_175786_4_ + "\'");
+ field_147175_a.warn("Couldn\'t process command: \'" + p_175786_4_ + "\'", var9); // Forge: Log stacktrace of unknown exceptions
}
return false;
@@ -1,6 +1,15 @@
--- ../src-base/minecraft/net/minecraft/entity/Entity.java
+++ ../src-work/minecraft/net/minecraft/entity/Entity.java
@@ -129,6 +129,14 @@
@@ -49,7 +49,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class Entity implements ICommandSender
+public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable<NBTTagCompound>
{
private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static int field_70152_a;
@@ -129,6 +129,15 @@
protected UUID field_96093_i;
private final CommandResultStats field_174837_as;
@@ -8,24 +17,31 @@
+ private NBTTagCompound customEntityData;
+ public boolean captureDrops = false;
+ public java.util.ArrayList<EntityItem> capturedDrops = new java.util.ArrayList<EntityItem>();
+ private UUID persistentID;
+
+ @Deprecated //ToDo: Move to Capabilities?
+ protected java.util.HashMap<String, net.minecraftforge.common.IExtendedEntityProperties> extendedProperties = new java.util.HashMap<String, net.minecraftforge.common.IExtendedEntityProperties>();
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
+
public int func_145782_y()
{
return this.field_145783_c;
@@ -172,6 +180,8 @@
@@ -172,6 +181,9 @@
this.field_70180_af.func_75682_a(2, "");
this.field_70180_af.func_75682_a(4, Byte.valueOf((byte)0));
this.func_70088_a();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this));
+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, p_i1582_1_);
+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
}
protected abstract void func_70088_a();
@@ -998,10 +1008,7 @@
@@ -996,12 +1008,12 @@
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
Block block = iblockstate.func_177230_c();
+ Boolean result = block.isEntityInsideMaterial(this.field_70170_p, blockpos, iblockstate, this, d0, p_70055_1_, true);
+ if (result != null) return result;
+
if (block.func_149688_o() == p_70055_1_)
{
- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F;
@@ -36,7 +52,7 @@
}
else
{
@@ -1356,6 +1363,21 @@
@@ -1356,6 +1368,23 @@
p_70109_1_.func_74757_a("Silent", this.func_174814_R());
}
@@ -54,11 +70,13 @@
+ t.printStackTrace();
+ }
+ }
+
+ if (this.capabilities != null) p_70109_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
+
this.func_70014_b(p_70109_1_);
if (this.field_70154_o != null)
@@ -1438,6 +1460,28 @@
@@ -1438,6 +1467,30 @@
this.func_174805_g(p_70020_1_.func_74767_n("CustomNameVisible"));
this.field_174837_as.func_179668_a(p_70020_1_);
this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
@@ -78,16 +96,18 @@
+ }
+ }
+
+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly
+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly TODO: Remove in 1.9
+ if (p_70020_1_.func_74764_b("PersistentIDMSB") && p_70020_1_.func_74764_b("PersistentIDLSB"))
+ {
+ this.field_96093_i = new UUID(p_70020_1_.func_74763_f("PersistentIDMSB"), p_70020_1_.func_74763_f("PersistentIDLSB"));
+ }
+
+ if (this.capabilities != null && p_70020_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_70020_1_.func_74775_l("ForgeCaps"));
+
this.func_70037_a(p_70020_1_);
if (this.func_142008_O())
@@ -1512,7 +1556,10 @@
@@ -1512,7 +1565,10 @@
{
EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_);
entityitem.func_174869_p();
@@ -99,7 +119,7 @@
return entityitem;
}
else
@@ -1655,6 +1702,7 @@
@@ -1655,6 +1711,7 @@
public void func_70078_a(Entity p_70078_1_)
{
@@ -107,16 +127,15 @@
this.field_70149_e = 0.0D;
this.field_70147_f = 0.0D;
@@ -1789,7 +1837,7 @@
public boolean func_70115_ae()
@@ -2049,6 +2106,7 @@
{
- return this.field_70154_o != null;
+ return this.field_70154_o != null && field_70154_o.shouldRiderSit();
}
public boolean func_70093_af()
@@ -2092,7 +2140,7 @@
if (!this.field_70170_p.field_72995_K && !this.field_70128_L)
{
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_71027_1_)) return;
this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.func_71276_C();
int i = this.field_71093_bK;
@@ -2092,7 +2150,7 @@
public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_)
{
@@ -125,7 +144,7 @@
}
public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_)
@@ -2353,4 +2401,184 @@
@@ -2353,4 +2411,209 @@
EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_);
}
@@ -308,5 +327,30 @@
+ {
+ return this instanceof EntityLivingBase;
+ }
+
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (getCapability(capability, facing) != null)
+ return true;
+ return capabilities == null ? false : capabilities.hasCapability(capability, facing);
+ }
+
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return capabilities == null ? null : capabilities.getCapability(capability, facing);
+ }
+
+ public void deserializeNBT(NBTTagCompound nbt)
+ {
+ this.func_70020_e(nbt);
+ }
+
+ public NBTTagCompound serializeNBT()
+ {
+ NBTTagCompound ret = new NBTTagCompound();
+ ret.func_74778_a("id", this.func_70022_Q());
+ this.func_70109_d(ret);
+ return ret;
+ }
+ /* ================================== Forge End =====================================*/
}
@@ -18,7 +18,7 @@
+ if (--this.field_75445_i <= 0)
+ {
+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase);
+ this.field_151497_i = 4 + this.field_75441_b.func_70681_au().nextInt(7);
+ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7);
+ return this.field_75438_g != null;
+ }
+ else
@@ -35,7 +35,7 @@
+ if (this.canPenalize)
+ {
+ this.field_151497_i += failedPathFindingPenalty;
+ this.field_75445_i += failedPathFindingPenalty;
+ if (this.field_75441_b.func_70661_as().func_75505_d() != null)
+ {
+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c();
@@ -92,3 +92,23 @@
if (!this.func_174814_R())
{
this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F);
@@ -402,11 +423,6 @@
if (itemstack == null)
{
- if (this.field_70170_p != null)
- {
- field_145803_d.error("Item entity " + this.func_145782_y() + " has no item?!");
- }
-
return new ItemStack(Blocks.field_150348_b);
}
else
@@ -480,6 +496,6 @@
public void func_174870_v()
{
this.func_174871_r();
- this.field_70292_b = 5999;
+ this.field_70292_b = func_92059_d().func_77973_b().getEntityLifespan(func_92059_d(), field_70170_p) - 1;
}
}
@@ -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)
{
@@ -190,6 +191,24 @@
double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y);
if (d15 > 0.01D)
@@ -654,7 +679,7 @@
if (BlockRailBase.func_176563_d(iblockstate))
{
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l());
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(field_70170_p, new BlockPos(i, j, k), iblockstate, this);
p_70495_3_ = (double)j;
if (blockrailbase$enumraildirection.func_177018_c())
@@ -703,7 +728,7 @@
if (BlockRailBase.func_176563_d(iblockstate))
{
- BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l());
+ BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(field_70170_p, new BlockPos(i, j, k), iblockstate, this);
int[][] aint = field_70500_g[blockrailbase$enumraildirection.func_177015_a()];
double d0 = 0.0D;
double d1 = (double)i + 0.5D + (double)aint[0][0] * 0.5D;
@@ -817,13 +842,20 @@
public void func_70108_f(Entity p_70108_1_)
@@ -8,3 +8,26 @@
if (!this.field_70170_p.field_72995_K)
{
p_130002_1_.func_71007_a(this);
@@ -232,4 +233,22 @@
this.field_94113_a[i] = null;
}
}
+
+ public net.minecraftforge.items.IItemHandler itemHandler = new net.minecraftforge.items.wrapper.InvWrapper(this);
+
+ @Override
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ {
+ return (T) itemHandler;
+ }
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
+ }
}
@@ -296,9 +296,12 @@
if (!this.field_70170_p.field_72995_K)
{
if (this.func_70608_bn() || !this.func_70089_S())
@@ -1352,7 +1440,7 @@
@@ -1350,9 +1438,9 @@
if (this.field_70170_p.func_175667_e(p_180469_1_))
this.func_70105_a(0.2F, 0.2F);
- if (this.field_70170_p.func_175667_e(p_180469_1_))
+ if (this.field_70170_p.func_175667_e(p_180469_1_) && field_70170_p.func_180495_p(p_180469_1_).func_177230_c().isBed(field_70170_p, p_180469_1_, this))
{
- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockDirectional.field_176387_N);
+ EnumFacing enumfacing = this.field_70170_p.func_180495_p(p_180469_1_).func_177230_c().getBedDirection(field_70170_p, p_180469_1_);
@@ -323,12 +326,23 @@
if (blockpos == null)
{
@@ -1448,14 +1537,14 @@
@@ -1430,6 +1519,10 @@
this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F));
}
+ else
+ {
+ p_70999_3_ = false;
+ }
this.field_71083_bS = false;
@@ -1448,14 +1541,14 @@
private boolean func_175143_p()
{
- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() == Blocks.field_150324_C;
+ return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().isBed(field_70170_p, field_71081_bT, this);
+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, field_71081_bT);
}
public static BlockPos func_180467_a(World p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_)
@@ -340,7 +354,7 @@
{
if (!p_180467_2_)
{
@@ -1470,7 +1559,7 @@
@@ -1470,16 +1563,16 @@
}
else
{
@@ -349,16 +363,18 @@
}
}
@@ -1479,7 +1568,7 @@
@SideOnly(Side.CLIENT)
public float func_71051_bG()
{
if (this.field_71081_bT != null)
- if (this.field_71081_bT != null)
+ if (this.field_71081_bT != null && field_70170_p.func_180495_p(field_71081_bT).func_177230_c().isBed(field_70170_p, field_71081_bT, this))
{
- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockDirectional.field_176387_N);
+ EnumFacing enumfacing = this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().getBedDirection(field_70170_p, field_71081_bT);
switch (enumfacing)
{
@@ -1519,16 +1608,24 @@
@@ -1519,16 +1612,24 @@
public BlockPos func_180470_cg()
{
@@ -385,7 +401,7 @@
if (p_180473_1_ != null)
{
this.field_71077_c = p_180473_1_;
@@ -1712,6 +1809,10 @@
@@ -1712,6 +1813,10 @@
super.func_180430_e(p_180430_1_, p_180430_2_);
}
@@ -396,7 +412,7 @@
}
protected void func_71061_d_()
@@ -1735,6 +1836,7 @@
@@ -1735,6 +1840,7 @@
}
EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(p_70074_1_)));
@@ -404,7 +420,7 @@
if (entitylist$entityegginfo != null)
{
@@ -1847,6 +1949,8 @@
@@ -1847,6 +1953,8 @@
{
if (p_71008_1_ != this.field_71074_e)
{
@@ -413,7 +429,7 @@
this.field_71074_e = p_71008_1_;
this.field_71072_f = p_71008_2_;
@@ -1918,6 +2022,10 @@
@@ -1918,6 +2026,10 @@
this.field_181016_an = p_71049_1_.field_181016_an;
this.field_181017_ao = p_71049_1_.field_181017_ao;
this.field_181018_ap = p_71049_1_.field_181018_ap;
@@ -424,7 +440,7 @@
}
else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory"))
{
@@ -1931,6 +2039,18 @@
@@ -1931,6 +2043,18 @@
this.field_175152_f = p_71049_1_.field_175152_f;
this.field_71078_a = p_71049_1_.field_71078_a;
this.func_70096_w().func_75692_b(10, Byte.valueOf(p_71049_1_.func_70096_w().func_75683_a(10)));
@@ -443,7 +459,7 @@
}
protected boolean func_70041_e_()
@@ -1968,7 +2088,14 @@
@@ -1968,7 +2092,14 @@
public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_)
{
@@ -459,7 +475,7 @@
}
@SideOnly(Side.CLIENT)
@@ -2013,7 +2140,10 @@
@@ -2013,7 +2144,10 @@
public IChatComponent func_145748_c_()
{
@@ -471,7 +487,7 @@
ichatcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " "));
ichatcomponent.func_150256_b().func_150209_a(this.func_174823_aP());
ichatcomponent.func_150256_b().func_179989_a(this.func_70005_c_());
@@ -2022,7 +2152,7 @@
@@ -2022,7 +2156,7 @@
public float func_70047_e()
{
@@ -480,7 +496,7 @@
if (this.func_70608_bn())
{
@@ -2155,6 +2285,136 @@
@@ -2155,6 +2289,136 @@
this.field_175153_bG = p_175150_1_;
}
@@ -72,7 +72,15 @@
if (entitylist$entityegginfo != null)
{
@@ -831,6 +848,7 @@
@@ -528,6 +545,7 @@
public void func_71027_c(int p_71027_1_)
{
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_71027_1_)) return;
if (this.field_71093_bK == 1 && p_71027_1_ == 1)
{
this.func_71029_a(AchievementList.field_76003_C);
@@ -831,6 +849,7 @@
{
if (p_71064_1_ != null)
{
@@ -1,6 +1,21 @@
--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java
+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java
@@ -315,6 +315,14 @@
@@ -272,12 +272,8 @@
{
if (this.field_70462_a[j] == null)
{
- this.field_70462_a[j] = new ItemStack(item, 0, p_70452_1_.func_77960_j());
-
- if (p_70452_1_.func_77942_o())
- {
- this.field_70462_a[j].func_77982_d((NBTTagCompound)p_70452_1_.func_77978_p().func_74737_b());
- }
+ this.field_70462_a[j] = p_70452_1_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up.
+ this.field_70462_a[j].field_77994_a = 0;
}
int k = i;
@@ -315,6 +311,14 @@
this.field_70462_a[i].func_77945_a(this.field_70458_d.field_70170_p, this.field_70458_d, i, this.field_70461_c == i);
}
}
@@ -57,7 +57,7 @@
Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false);
}
@@ -371,11 +380,591 @@
@@ -371,11 +380,670 @@
return false;
}
@@ -91,16 +91,16 @@
+ }
+
+ /**
+ * Allow the item one last chance to modify its name used for the
+ * Allow the item one last chance to modify its name used for the
+ * tool highlight useful for adding something extra that can't be removed
+ * by a user in the displayed name, such as a mode of operation.
+ *
+ *
+ * @param item the ItemStack for the item.
+ * @param the name that will be displayed unless it is changed in this method.
+ */
+ public String getHighlightTip( ItemStack item, String displayName )
+ {
+ return displayName;
+ return displayName;
+ }
+
+ /**
@@ -427,18 +427,29 @@
+ }
+
+ /**
+ * @deprecated Use 4-argument version.
+ */
+ // remove 1.9
+ @SideOnly(Side.CLIENT)
+ @Deprecated
+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
+ {
+ return null;
+ }
+
+ /**
+ * Override this method to have an item handle its own armor rendering.
+ *
+ * @param entityLiving The entity wearing the armor
+ * @param itemStack The itemStack to render the model of
+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet
+ *
+ * @param _default Original armor model. Will have attributes set.
+ * @return A ModelBiped to render instead of the default
+ */
+ @SideOnly(Side.CLIENT)
+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot, net.minecraft.client.model.ModelBiped _default)
+ {
+ return null;
+ return getArmorModel(entityLiving, itemStack, armorSlot);
+ }
+
+ /**
@@ -644,12 +655,80 @@
+ {
+ return !ItemStack.func_77989_b(oldStack, newStack);
+ }
+
+
+ private ResourceLocation registryName = null;
+ /**
+ * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item.
+ * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does.
+ * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items.
+ *
+ * The supplied name will be prefixed with the currently active mod's modId.
+ * If the supplied name already has a prefix that is different, it will be used and a warning will be logged.
+ *
+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown.
+ *
+ * Returns 'this' to allow for chaining.
+ *
+ * @param name Unique registry name
+ * @return This instance
+ */
+ public final Item setRegistryName(String name)
+ {
+ if (getRegistryName() != null)
+ throw new IllegalStateException("Attempted to set registry name on block with exisiting registry name! New: " + name + " Old: " + getRegistryName());
+ int index = name.lastIndexOf(':');
+ String oldPrefix = index == -1 ? "" : name.substring(0, index);
+ name = index == -1 ? name : name.substring(index + 1);
+ net.minecraftforge.fml.common.ModContainer mc = net.minecraftforge.fml.common.Loader.instance().activeModContainer();
+ String prefix = mc == null ? "minecraft" : mc.getModId();
+ if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0)
+ {
+ net.minecraftforge.fml.common.FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name);
+ prefix = oldPrefix;
+ }
+ this.registryName = new ResourceLocation(prefix, name);
+ return this;
+ }
+ public final Item setRegistryName(ResourceLocation name){ return setRegistryName(name.toString()); }
+ public final Item setRegistryName(String modID, String name){ return setRegistryName(modID + ":" + name); }
+
+ /**
+ * A unique identifier for this block, if this block is registered in the game registry it will return that name.
+ * Otherwise it will return the name set in setRegistryName().
+ * If neither are valid null is returned.
+ *
+ * @return Unique identifier or null.
+ */
+ public final String getRegistryName()
+ {
+ if (delegate.getResourceName() != null) return delegate.getResourceName().toString();
+ return registryName != null ? registryName.toString() : null;
+ }
+
+ /**
+ * Called from ItemStack.setItem, will hold extra data for the life of this ItemStack.
+ * Can be retrieved from stack.getCapabilities()
+ * The NBT can be null if this is not called from readNBT or if the item the stack is
+ * changing FROM is different then this item, or the previous item had no capabilities.
+ *
+ * This is called BEFORE the stacks item is set so you can use stack.getItem() to see the OLD item.
+ * Remember that getItem CAN return null.
+ *
+ * @param stack The ItemStack
+ * @param nbt NBT of this item serialized, or null.
+ * @return A holder instance associated with this ItemStack where you can hold capabilities for the life of this item.
+ */
+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt)
+ {
+ return null;
+ }
+ /* ======================================== FORGE END =====================================*/
+
public static void func_150900_l()
{
func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function<ItemStack, String>()
@@ -855,6 +1444,10 @@
@@ -855,6 +1523,10 @@
private final float field_78011_i;
private final int field_78008_j;
@@ -660,7 +739,7 @@
private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_)
{
this.field_78001_f = p_i1874_3_;
@@ -889,9 +1482,36 @@
@@ -889,9 +1561,36 @@
return this.field_78008_j;
}
@@ -1,14 +1,35 @@
--- ../src-base/minecraft/net/minecraft/item/ItemStack.java
+++ ../src-work/minecraft/net/minecraft/item/ItemStack.java
@@ -49,6 +49,7 @@
@@ -35,7 +35,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public final class ItemStack
+public final class ItemStack implements net.minecraftforge.common.capabilities.ICapabilitySerializable<NBTTagCompound>
{
public static final DecimalFormat field_111284_a = new DecimalFormat("#.###");
public int field_77994_a;
@@ -49,6 +49,10 @@
private Block field_179550_j;
private boolean field_179551_k;
+ private net.minecraftforge.fml.common.registry.RegistryDelegate<Item> delegate;
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
+ private NBTTagCompound capNBT;
+
public ItemStack(Block p_i1876_1_)
{
this((Block)p_i1876_1_, 1);
@@ -80,7 +81,7 @@
@@ -74,13 +78,15 @@
this((Item)p_i1880_1_, p_i1880_2_, 0);
}
- public ItemStack(Item p_i1881_1_, int p_i1881_2_, int p_i1881_3_)
+ public ItemStack(Item p_i1881_1_, int p_i1881_2_, int p_i1881_3_) { this (p_i1881_1_, p_i1881_2_, p_i1881_3_, null); }
+ public ItemStack(Item p_i1881_1_, int p_i1881_2_, int p_i1881_3_, NBTTagCompound capNBT)
{
+ this.capNBT = capNBT;
this.field_179552_h = null;
this.field_179553_i = false;
this.field_179550_j = null;
this.field_179551_k = false;
@@ -17,7 +38,16 @@
this.field_77994_a = p_i1881_2_;
this.field_77991_e = p_i1881_3_;
@@ -120,11 +121,12 @@
@@ -107,7 +113,7 @@
public ItemStack func_77979_a(int p_77979_1_)
{
- ItemStack itemstack = new ItemStack(this.field_151002_e, p_77979_1_, this.field_77991_e);
+ ItemStack itemstack = new ItemStack(this.field_151002_e, p_77979_1_, this.field_77991_e, this.capabilities != null ? this.capabilities.serializeNBT() : null);
if (this.field_77990_d != null)
{
@@ -120,11 +126,12 @@
public Item func_77973_b()
{
@@ -31,8 +61,18 @@
boolean flag = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_);
if (flag)
@@ -169,11 +171,11 @@
@@ -162,19 +169,23 @@
p_77955_1_.func_74782_a("tag", this.field_77990_d);
}
+ if (this.capabilities != null) p_77955_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
+
return p_77955_1_;
}
public void func_77963_c(NBTTagCompound p_77963_1_)
{
+ this.capNBT = p_77963_1_.func_74764_b("ForgeCaps") ? p_77963_1_.func_74775_l("ForgeCaps") : null;
if (p_77963_1_.func_150297_b("id", 8))
{
- this.field_151002_e = Item.func_111206_d(p_77963_1_.func_74779_i("id"));
@@ -43,9 +83,11 @@
- this.field_151002_e = Item.func_150899_d(p_77963_1_.func_74765_d("id"));
+ this.func_150996_a(Item.func_150899_d(p_77963_1_.func_74765_d("id")));
}
+ this.capNBT = null;
this.field_77994_a = p_77963_1_.func_74771_c("Count");
@@ -197,7 +199,7 @@
this.field_77991_e = p_77963_1_.func_74765_d("Damage");
@@ -197,7 +208,7 @@
public int func_77976_d()
{
@@ -54,7 +96,7 @@
}
public boolean func_77985_e()
@@ -207,7 +209,7 @@
@@ -207,7 +218,7 @@
public boolean func_77984_f()
{
@@ -63,7 +105,7 @@
}
public boolean func_77981_g()
@@ -217,32 +219,27 @@
@@ -217,32 +228,27 @@
public boolean func_77951_h()
{
@@ -101,7 +143,7 @@
}
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_)
@@ -274,8 +271,8 @@
@@ -274,8 +280,8 @@
}
}
@@ -112,7 +154,7 @@
}
}
@@ -334,7 +331,7 @@
@@ -334,7 +340,7 @@
public boolean func_150998_b(Block p_150998_1_)
{
@@ -121,7 +163,16 @@
}
public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_)
@@ -742,6 +739,7 @@
@@ -344,7 +350,7 @@
public ItemStack func_77946_l()
{
- ItemStack itemstack = new ItemStack(this.field_151002_e, this.field_77994_a, this.field_77991_e);
+ ItemStack itemstack = new ItemStack(this.field_151002_e, this.field_77994_a, this.field_77991_e, this.capabilities != null ? this.capabilities.serializeNBT() : null);
if (this.field_77990_d != null)
{
@@ -742,6 +748,7 @@
}
}
@@ -129,7 +180,7 @@
return list;
}
@@ -852,7 +850,7 @@
@@ -852,7 +859,7 @@
}
else
{
@@ -138,11 +189,49 @@
}
return multimap;
@@ -860,6 +858,7 @@
@@ -860,6 +867,18 @@
public void func_150996_a(Item p_150996_1_)
{
+ if (p_150996_1_ == this.field_151002_e && field_151002_e != null && this.capabilities != null) //Item Didn't change but refreshed
+ {
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_151002_e.initCapabilities(this, this.capabilities.serializeNBT());
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(field_151002_e, this, parent);
+ }
+ else if (p_150996_1_ != this.field_151002_e && p_150996_1_ != null) // Item Changed
+ {
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = p_150996_1_.initCapabilities(this, this.capNBT);
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(p_150996_1_, this, parent);
+ }
+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT);
+ this.delegate = p_150996_1_ != null ? p_150996_1_.delegate : null;
this.field_151002_e = p_150996_1_;
}
@@ -946,4 +965,26 @@
return false;
}
}
+
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return this.capabilities == null ? false : this.capabilities.hasCapability(capability, facing);
+ }
+
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return this.capabilities == null ? null : this.capabilities.getCapability(capability, facing);
+ }
+
+ public void deserializeNBT(NBTTagCompound nbt)
+ {
+ this.func_77963_c(nbt);
+ }
+
+ public NBTTagCompound serializeNBT()
+ {
+ NBTTagCompound ret = new NBTTagCompound();
+ this.func_77955_b(ret);
+ return ret;
+ }
}
@@ -69,7 +69,7 @@
return;
}
+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_147369_b, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null);
+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_147369_b, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null, new net.minecraft.util.Vec3(p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()));
+ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY)
+ {
this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack);
@@ -88,16 +88,28 @@
}
flag = true;
@@ -601,7 +620,7 @@
@@ -598,12 +617,18 @@
this.field_147369_b.field_71137_h = true;
this.field_147369_b.field_71071_by.field_70462_a[this.field_147369_b.field_71071_by.field_70461_c] = ItemStack.func_77944_b(this.field_147369_b.field_71071_by.field_70462_a[this.field_147369_b.field_71071_by.field_70461_c]);
Slot slot = this.field_147369_b.field_71070_bA.func_75147_a(this.field_147369_b.field_71071_by, this.field_147369_b.field_71071_by.field_70461_c);
+ int windowId = this.field_147369_b.field_71070_bA.field_75152_c;
+ if (slot == null) // Forge: Fix 'slotless' inventories not selecting a valid slot to update
+ {
+ slot = this.field_147369_b.field_71069_bz.func_75147_a(this.field_147369_b.field_71071_by, this.field_147369_b.field_71071_by.field_70461_c);
+ windowId = this.field_147369_b.field_71069_bz.field_75152_c;
+ }
this.field_147369_b.field_71070_bA.func_75142_b();
this.field_147369_b.field_71137_h = false;
- if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g()))
+ if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g()) || !placeResult) // force client itemstack update if place event was cancelled
{
this.func_147359_a(new S2FPacketSetSlot(this.field_147369_b.field_71070_bA.field_75152_c, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g()));
- this.func_147359_a(new S2FPacketSetSlot(this.field_147369_b.field_71070_bA.field_75152_c, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g()));
+ this.func_147359_a(new S2FPacketSetSlot(windowId, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g()));
}
@@ -770,8 +789,10 @@
}
}
@@ -770,8 +795,10 @@
}
else
{
@@ -110,7 +122,7 @@
}
this.field_147374_l += 20;
@@ -916,7 +937,7 @@
@@ -916,7 +943,7 @@
return;
}
@@ -35,7 +35,7 @@
if (i >= 0 && i < Potion.field_76425_a.length && Potion.field_76425_a[i] != null)
{
@@ -223,4 +228,62 @@
@@ -223,4 +228,53 @@
{
return this.field_100013_f;
}
@@ -50,3 +50,11 @@
}
}
}
@@ -621,4 +627,7 @@
this.field_71321_q.func_71556_a(RConConsoleSource.func_175570_h(), p_71252_1_);
return RConConsoleSource.func_175570_h().func_70008_c();
}
+
+ //Forge: Enable formated text for colors in console.
+ @Override public void func_145747_a(net.minecraft.util.IChatComponent message) { field_155771_h.info(message.func_150254_d()); }
}
@@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java
+++ ../src-work/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java
@@ -22,6 +22,7 @@
private static final Logger field_180251_a = LogManager.getLogger();
private final DedicatedServer field_180249_b;
private final long field_180250_c;
+ private boolean firstRun = true;
public ServerHangWatchdog(DedicatedServer p_i46310_1_)
{
@@ -37,7 +38,7 @@
long j = MinecraftServer.func_130071_aq();
long k = j - i;
- if (k > this.field_180250_c)
+ if (k > this.field_180250_c && !this.firstRun)
{
field_180251_a.fatal("A single server tick took " + String.format("%.2f", new Object[] {Float.valueOf((float)k / 1000.0F)}) + " seconds (should be max " + String.format("%.2f", new Object[] {Float.valueOf(0.05F)}) + ")");
field_180251_a.fatal("Considering it to be crashed, server will forcibly shutdown.");
@@ -75,6 +76,8 @@
this.func_180248_a();
}
+ this.firstRun = false;
+
try
{
Thread.sleep(i + this.field_180250_c - j);
@@ -9,12 +9,21 @@
public World field_73092_a;
public EntityPlayerMP field_73090_b;
private WorldSettings.GameType field_73091_c = WorldSettings.GameType.NOT_SET;
@@ -116,7 +118,7 @@
else
{
int k = this.field_73100_i - this.field_73089_e;
- float f1 = block1.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1);
+ float f1 = block1.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); //Forge: Fix network break progress using wrong position
int l = (int)(f1 * 10.0F);
if (l != this.field_73094_o)
@@ -130,6 +132,14 @@
public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_)
{
+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b,
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_);
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1));
+ if (event.isCanceled())
+ {
+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_));
@@ -177,7 +186,7 @@
{
- if (!p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null)
+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(p_180236_1_,
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, p_180236_2_, p_180236_4_, p_180236_5_);
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, p_180236_2_, p_180236_4_, p_180236_5_, new net.minecraft.util.Vec3(p_180236_6_, p_180236_7_, p_180236_8_));
+ if (event.isCanceled())
{
- IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_);
@@ -57,24 +57,24 @@
- func_151180_a(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP);
- func_151180_a(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d);
- func_151180_a(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d);
+ func_151180_a(p_75924_0_, Blocks.field_150355_j, Blocks.field_150358_i, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150353_l, Blocks.field_150356_k, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150428_aP, Blocks.field_150423_aK, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150470_am, Blocks.field_150460_al, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150439_ay, Blocks.field_150450_ax, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150416_aS, Blocks.field_150413_aR, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150455_bV, Blocks.field_150441_bU, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150429_aA, Blocks.field_150437_az, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150374_bv, Blocks.field_150379_bu, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150334_T, Blocks.field_150333_U, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150373_bw, Blocks.field_150376_bx, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d, useItemIds);
+ func_151180_a(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150355_j, Blocks.field_150358_i, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150353_l, Blocks.field_150356_k, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150428_aP, Blocks.field_150423_aK, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150470_am, Blocks.field_150460_al, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150439_ay, Blocks.field_150450_ax, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150416_aS, Blocks.field_150413_aR, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150455_bV, Blocks.field_150441_bU, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150429_aA, Blocks.field_150437_az, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150374_bv, Blocks.field_150379_bu, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150334_T, Blocks.field_150333_U, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150373_bw, Blocks.field_150376_bx, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d, useItemIds);
+ mergeStatBases(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d, useItemIds);
}
- private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_)
+ private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_, boolean useItemIds)
+ private static void mergeStatBases(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_, boolean useItemIds)
{
- int i = Block.func_149682_b(p_151180_1_);
- int j = Block.func_149682_b(p_151180_2_);
@@ -1,22 +1,33 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -59,6 +59,7 @@
@@ -17,7 +17,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class TileEntity
+public abstract class TileEntity implements net.minecraftforge.common.capabilities.ICapabilitySerializable<NBTTagCompound>
{
private static final Logger field_145852_a = LogManager.getLogger();
private static Map < String, Class <? extends TileEntity >> field_145855_i = Maps. < String, Class <? extends TileEntity >> newHashMap();
@@ -59,6 +59,8 @@
public void func_145839_a(NBTTagCompound p_145839_1_)
{
this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z"));
+ if (p_145839_1_.func_74764_b("ForgeData")) this.customTileData = p_145839_1_.func_74775_l("ForgeData");
+ if (this.capabilities != null && p_145839_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_145839_1_.func_74775_l("ForgeCaps"));
}
public void func_145841_b(NBTTagCompound p_145841_1_)
@@ -75,6 +76,7 @@
@@ -75,6 +77,8 @@
p_145841_1_.func_74768_a("x", this.field_174879_c.func_177958_n());
p_145841_1_.func_74768_a("y", this.field_174879_c.func_177956_o());
p_145841_1_.func_74768_a("z", this.field_174879_c.func_177952_p());
+ if (this.customTileData != null) p_145841_1_.func_74782_a("ForgeData", this.customTileData);
+ if (this.capabilities != null) p_145841_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
}
}
@@ -82,9 +84,10 @@
@@ -82,9 +86,10 @@
{
TileEntity tileentity = null;
@@ -28,7 +39,7 @@
if (oclass != null)
{
@@ -102,7 +105,17 @@
@@ -102,7 +107,17 @@
}
else
{
@@ -46,7 +57,7 @@
}
return tileentity;
@@ -134,7 +147,6 @@
@@ -134,7 +149,6 @@
}
}
@@ -54,7 +65,7 @@
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
@@ -279,4 +291,146 @@
@@ -279,4 +293,183 @@
func_145826_a(TileEntityFlowerPot.class, "FlowerPot");
func_145826_a(TileEntityBanner.class, "Banner");
}
@@ -82,18 +93,18 @@
+
+ private boolean isVanilla = getClass().getName().startsWith("net.minecraft.");
+ /**
+ * Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes.
+ * Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes.
+ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly.
+ *
+ * @param world Current world
+ * @param pos Tile's world position
+ * @param oldID The old ID of the block
+ * @param newID The new ID of the block (May be the same)
+ * @return True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to}
+ * @param oldState The old ID of the block
+ * @param newState The new ID of the block (May be the same)
+ * @return true forcing the invalidation of the existing TE, false not to invalidate the existing TE
+ */
+ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
+ {
+ return !isVanilla || (oldState.func_177230_c() != newSate.func_177230_c());
+ return isVanilla ? (oldState.func_177230_c() != newSate.func_177230_c()) : oldState != newSate;
+ }
+
+ public boolean shouldRenderInPass(int pass)
@@ -199,5 +210,42 @@
+ public void onLoad()
+ {
+ // NOOP
+ }
+
+ /**
+ * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state.
+ * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class.
+ */
+ public boolean hasFastRenderer()
+ {
+ return false;
+ }
+
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
+ public TileEntity()
+ {
+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
+ }
+
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return capabilities == null ? false : capabilities.hasCapability(capability, facing);
+ }
+
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return capabilities == null ? null : capabilities.getCapability(capability, facing);
+ }
+
+ public void deserializeNBT(NBTTagCompound nbt)
+ {
+ this.func_145839_a(nbt);
+ }
+
+ public NBTTagCompound serializeNBT()
+ {
+ NBTTagCompound ret = new NBTTagCompound();
+ this.func_145841_b(ret);
+ return ret;
+ }
}
@@ -5,7 +5,7 @@
Block block = this.field_145850_b.func_180495_p(new BlockPos(j1, i2, k1)).func_177230_c();
- if (block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150484_ah && block != Blocks.field_150339_S)
+ if (!block.isBeaconBase(this.field_145850_b, new BlockPos(l1, k1, j1), func_174877_v()))
+ if (!block.isBeaconBase(this.field_145850_b, new BlockPos(j1, i2, k1), func_174877_v()))
{
flag1 = false;
break;
@@ -76,3 +76,22 @@
}
public boolean[] func_174902_m()
@@ -386,4 +393,18 @@
this.field_145945_j[i] = null;
}
}
+
+ net.minecraftforge.items.IItemHandler handlerInput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP);
+ net.minecraftforge.items.IItemHandler handlerOutput = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN);
+
+ @Override
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ if (facing == EnumFacing.UP)
+ return (T) handlerInput;
+ else
+ return (T) handlerOutput;
+ return super.getCapability(capability, facing);
+ }
}
@@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityChest.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityChest.java
@@ -186,6 +186,7 @@
{
super.func_145836_u();
this.field_145984_a = false;
+ doubleChestHandler = null;
}
@SuppressWarnings("incomplete-switch")
@@ -468,4 +469,24 @@
this.field_145985_p[i] = null;
}
}
+
+ public net.minecraftforge.items.VanillaDoubleChestItemHandler doubleChestHandler;
+
+ @Override
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ {
+ if(doubleChestHandler == null || doubleChestHandler.needsRefresh())
+ doubleChestHandler = net.minecraftforge.items.VanillaDoubleChestItemHandler.get(this);
+ if (doubleChestHandler != null && doubleChestHandler != net.minecraftforge.items.VanillaDoubleChestItemHandler.NO_ADJACENT_CHESTS_INSTANCE)
+ return (T) doubleChestHandler;
+ }
+ return super.getCapability(capability, facing);
+ }
+
+ public net.minecraftforge.items.IItemHandler getSingleChestHandler()
+ {
+ return super.getCapability(net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
+ }
}
@@ -1,5 +1,31 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
@@ -141,9 +141,9 @@
}
}
- this.field_145956_a = p_145839_1_.func_74765_d("BurnTime");
- this.field_174906_k = p_145839_1_.func_74765_d("CookTime");
- this.field_174905_l = p_145839_1_.func_74765_d("CookTimeTotal");
+ this.field_145956_a = p_145839_1_.func_74762_e("BurnTime");
+ this.field_174906_k = p_145839_1_.func_74762_e("CookTime");
+ this.field_174905_l = p_145839_1_.func_74762_e("CookTimeTotal");
this.field_145963_i = func_145952_a(this.field_145957_n[1]);
if (p_145839_1_.func_150297_b("CustomName", 8))
@@ -155,9 +155,9 @@
public void func_145841_b(NBTTagCompound p_145841_1_)
{
super.func_145841_b(p_145841_1_);
- p_145841_1_.func_74777_a("BurnTime", (short)this.field_145956_a);
- p_145841_1_.func_74777_a("CookTime", (short)this.field_174906_k);
- p_145841_1_.func_74777_a("CookTimeTotal", (short)this.field_174905_l);
+ p_145841_1_.func_74768_a("BurnTime", this.field_145956_a);
+ p_145841_1_.func_74768_a("CookTime", this.field_174906_k);
+ p_145841_1_.func_74768_a("CookTimeTotal", this.field_174905_l);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.field_145957_n.length; ++i)
@@ -223,8 +223,7 @@
if (this.field_145957_n[1].field_77994_a == 0)
@@ -49,3 +75,25 @@
}
}
@@ -451,4 +462,21 @@
this.field_145957_n[i] = null;
}
}
+
+ net.minecraftforge.items.IItemHandler handlerTop = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.UP);
+ net.minecraftforge.items.IItemHandler handlerBottom = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.DOWN);
+ net.minecraftforge.items.IItemHandler handlerSide = new net.minecraftforge.items.wrapper.SidedInvWrapper(this, net.minecraft.util.EnumFacing.WEST);
+
+ @Override
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ if (facing == EnumFacing.DOWN)
+ return (T) handlerBottom;
+ else if (facing == EnumFacing.UP)
+ return (T) handlerTop;
+ else
+ return (T) handlerSide;
+ return super.getCapability(capability, facing);
+ }
}
@@ -1,6 +1,22 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java
@@ -515,17 +515,31 @@
@@ -260,6 +260,7 @@
private boolean func_145883_k()
{
+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.insertHook(this)) { return true; }
IInventory iinventory = this.func_145895_l();
if (iinventory == null)
@@ -366,6 +367,7 @@
public static boolean func_145891_a(IHopper p_145891_0_)
{
+ if (net.minecraftforge.items.VanillaInventoryCodeHooks.extractHook(p_145891_0_)) { return true; }
IInventory iinventory = func_145884_b(p_145891_0_);
if (iinventory != null)
@@ -515,17 +517,31 @@
if (itemstack == null)
{
@@ -33,3 +49,14 @@
}
if (flag)
@@ -668,4 +684,10 @@
this.field_145900_a[i] = null;
}
}
+
+
+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler()
+ {
+ return new net.minecraftforge.items.VanillaHopperItemHandler(this);
+ }
}
@@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityLockable.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityLockable.java
@@ -47,4 +47,25 @@
{
return (IChatComponent)(this.func_145818_k_() ? new ChatComponentText(this.func_70005_c_()) : new ChatComponentTranslation(this.func_70005_c_(), new Object[0]));
}
+
+ private net.minecraftforge.items.IItemHandler itemHandler;
+
+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler()
+ {
+ return new net.minecraftforge.items.wrapper.InvWrapper(this);
+ }
+
+ @Override
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, net.minecraft.util.EnumFacing facing)
+ {
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler);
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing)
+ {
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
+ }
}
@@ -0,0 +1,32 @@
--- ../src-base/minecraft/net/minecraft/util/BlockPos.java
+++ ../src-work/minecraft/net/minecraft/util/BlockPos.java
@@ -257,6 +257,21 @@
};
}
+ /**
+ * Returns a version of this BlockPos that is guaranteed to be Immutable.
+ * In most cases this will return 'this', but if 'this' is an instance of
+ * MutableBlockPos it will return a new instance of BlockPos with the same values.
+ *
+ * When storing a parameter given to you for an extended period of time, make sure you
+ * use this in case the value is changed internally.
+ *
+ * @return An immutable BlockPos.
+ */
+ public BlockPos getImmutable()
+ {
+ return this;
+ }
+
public static final class MutableBlockPos extends BlockPos
{
private int field_177997_b;
@@ -298,5 +313,7 @@
this.field_177996_d = p_181079_3_;
return this;
}
+
+ @Override public BlockPos getImmutable() { return new BlockPos(this); }
}
}
@@ -9,15 +9,7 @@
return this.field_72817_c[i][j].func_177424_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE);
}
@@ -84,6 +86,7 @@
{
int i = (p_180495_1_.func_177958_n() >> 4) - this.field_72818_a;
int j = (p_180495_1_.func_177952_p() >> 4) - this.field_72816_b;
+ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return Blocks.field_150350_a.func_176223_P();
if (i >= 0 && i < this.field_72817_c.length && j >= 0 && j < this.field_72817_c[i].length)
{
@@ -139,6 +142,8 @@
@@ -139,6 +141,8 @@
{
int i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a;
int j = (p_175629_2_.func_177952_p() >> 4) - this.field_72816_b;
@@ -26,7 +18,7 @@
return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_);
}
}
@@ -150,7 +155,7 @@
@@ -150,7 +154,7 @@
public boolean func_175623_d(BlockPos p_175623_1_)
{
@@ -35,15 +27,15 @@
}
@SideOnly(Side.CLIENT)
@@ -160,6 +165,7 @@
@@ -160,6 +164,7 @@
{
int i = (p_175628_2_.func_177958_n() >> 4) - this.field_72818_a;
int j = (p_175628_2_.func_177952_p() >> 4) - this.field_72816_b;
+ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return p_175628_1_.field_77198_c;
+ if (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return p_175628_1_.field_77198_c;
return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_);
}
else
@@ -179,4 +185,15 @@
@@ -179,4 +184,16 @@
{
return this.field_72815_e.func_175624_G();
}
@@ -54,7 +46,8 @@
+ int x = (pos.func_177958_n() >> 4) - this.field_72818_a;
+ int z = (pos.func_177952_p() >> 4) - this.field_72816_b;
+ if (pos.func_177956_o() >= 0 && pos.func_177956_o() < 256) return _default;
+ if (x < 0 || x >= field_72817_c.length || z < 0 || x >= field_72817_c[x].length) return _default;
+ if (x < 0 || x >= field_72817_c.length || z < 0 || z >= field_72817_c[x].length) return _default;
+ if (field_72817_c[x][z] == null) return _default;
+
+ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side);
+ }
@@ -24,10 +24,10 @@
entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
- if (entityliving.func_70601_bi() && entityliving.func_70058_J())
+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, l2, f1);
+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, i3, f1);
+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.func_70601_bi() && entityliving.func_70058_J())))
{
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1))
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f, l3, f1))
ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata);
if (entityliving.func_70058_J())
@@ -82,7 +82,7 @@
}
public boolean func_175667_e(BlockPos p_175667_1_)
@@ -284,39 +301,61 @@
@@ -284,39 +301,63 @@
{
Chunk chunk = this.func_175726_f(p_180501_1_);
Block block = p_180501_2_.func_177230_c();
@@ -93,7 +93,9 @@
+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_);
+ this.capturedBlockSnapshots.add(blockSnapshot);
+ }
+ int oldLight = func_180495_p(p_180501_1_).func_177230_c().getLightValue(this, p_180501_1_);
+ Block oldBlock = func_180495_p(p_180501_1_).func_177230_c();
+ int oldLight = oldBlock.getLightValue(this, p_180501_1_);
+ int oldOpacity = oldBlock.getLightOpacity(this, p_180501_1_);
+
IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_);
@@ -107,7 +109,7 @@
Block block1 = iblockstate.func_177230_c();
- if (block.func_149717_k() != block1.func_149717_k() || block.func_149750_m() != block1.func_149750_m())
+ if (block.func_149717_k() != block1.func_149717_k() || block.getLightValue(this, p_180501_1_) != oldLight)
+ if (block.getLightOpacity(this, p_180501_1_) != oldOpacity || block.getLightValue(this, p_180501_1_) != oldLight)
{
this.field_72984_F.func_76320_a("checkLight");
this.func_175664_x(p_180501_1_);
@@ -139,7 +141,7 @@
+ if (!this.field_72995_K && (flags & 1) != 0)
{
- this.func_175722_b(p_180501_1_, iblockstate.func_177230_c());
+ this.func_175722_b(pos, new_.func_177230_c());
+ this.func_175722_b(pos, old.func_177230_c());
- if (block.func_149740_M())
+ if (new_.func_177230_c().func_149740_M())
@@ -153,7 +155,7 @@
}
}
}
@@ -404,6 +443,9 @@
@@ -404,6 +445,9 @@
public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_)
{
@@ -163,7 +165,7 @@
this.func_180496_d(p_175685_1_.func_177976_e(), p_175685_2_);
this.func_180496_d(p_175685_1_.func_177974_f(), p_175685_2_);
this.func_180496_d(p_175685_1_.func_177977_b(), p_175685_2_);
@@ -414,6 +456,11 @@
@@ -414,6 +458,11 @@
public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_)
{
@@ -175,7 +177,7 @@
if (p_175695_3_ != EnumFacing.WEST)
{
this.func_180496_d(p_175695_1_.func_177976_e(), p_175695_2_);
@@ -777,7 +824,7 @@
@@ -777,7 +826,7 @@
public boolean func_72935_r()
{
@@ -184,7 +186,7 @@
}
public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_)
@@ -972,6 +1019,12 @@
@@ -972,6 +1021,12 @@
public void func_72956_a(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_)
{
@@ -197,7 +199,7 @@
for (int i = 0; i < this.field_73021_x.size(); ++i)
{
((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_);
@@ -980,6 +1033,12 @@
@@ -980,6 +1035,12 @@
public void func_85173_a(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_)
{
@@ -210,7 +212,7 @@
for (int i = 0; i < this.field_73021_x.size(); ++i)
{
((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_);
@@ -1033,6 +1092,9 @@
@@ -1033,6 +1094,9 @@
public boolean func_72838_d(Entity p_72838_1_)
{
@@ -220,7 +222,7 @@
int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D);
int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D);
boolean flag = p_72838_1_.field_98038_p;
@@ -1055,6 +1117,8 @@
@@ -1055,6 +1119,8 @@
this.func_72854_c();
}
@@ -229,7 +231,7 @@
this.func_72964_e(i, j).func_76612_a(p_72838_1_);
this.field_72996_f.add(p_72838_1_);
this.func_72923_a(p_72838_1_);
@@ -1267,17 +1331,29 @@
@@ -1267,17 +1333,29 @@
public int func_72967_a(float p_72967_1_)
{
@@ -262,7 +264,7 @@
public void func_72848_b(IWorldAccess p_72848_1_)
{
this.field_73021_x.remove(p_72848_1_);
@@ -1286,6 +1362,12 @@
@@ -1286,6 +1364,12 @@
@SideOnly(Side.CLIENT)
public float func_72971_b(float p_72971_1_)
{
@@ -275,7 +277,7 @@
float f = this.func_72826_c(p_72971_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1298,6 +1380,12 @@
@@ -1298,6 +1382,12 @@
@SideOnly(Side.CLIENT)
public Vec3 func_72833_a(Entity p_72833_1_, float p_72833_2_)
{
@@ -288,7 +290,7 @@
float f = this.func_72826_c(p_72833_2_);
float f1 = MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1305,9 +1393,7 @@
@@ -1305,9 +1395,7 @@
int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u);
int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
@@ -299,7 +301,7 @@
float f3 = (float)(l >> 16 & 255) / 255.0F;
float f4 = (float)(l >> 8 & 255) / 255.0F;
float f5 = (float)(l & 255) / 255.0F;
@@ -1367,6 +1453,11 @@
@@ -1367,6 +1455,11 @@
public float func_130001_d()
{
@@ -311,7 +313,7 @@
return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())];
}
@@ -1379,6 +1470,12 @@
@@ -1379,6 +1472,12 @@
@SideOnly(Side.CLIENT)
public Vec3 func_72824_f(float p_72824_1_)
{
@@ -324,7 +326,7 @@
float f = this.func_72826_c(p_72824_1_);
float f1 = MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1434,9 +1531,9 @@
@@ -1434,9 +1533,9 @@
for (blockpos = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos.func_177956_o() >= 0; blockpos = blockpos1)
{
blockpos1 = blockpos.func_177977_b();
@@ -336,7 +338,7 @@
{
break;
}
@@ -1448,6 +1545,12 @@
@@ -1448,6 +1547,12 @@
@SideOnly(Side.CLIENT)
public float func_72880_h(float p_72880_1_)
{
@@ -349,7 +351,7 @@
float f = this.func_72826_c(p_72880_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -1494,7 +1597,15 @@
@@ -1494,7 +1599,15 @@
entity.func_85029_a(crashreportcategory);
}
@@ -366,7 +368,7 @@
}
if (entity.field_70128_L)
@@ -1554,7 +1665,15 @@
@@ -1554,7 +1667,15 @@
CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity");
CrashReportCategory crashreportcategory2 = crashreport1.func_85058_a("Entity being ticked");
entity2.func_85029_a(crashreportcategory2);
@@ -383,7 +385,7 @@
}
}
@@ -1601,7 +1720,16 @@
@@ -1601,7 +1722,16 @@
CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity");
CrashReportCategory crashreportcategory1 = crashreport2.func_85058_a("Block entity being ticked");
tileentity.func_145828_a(crashreportcategory1);
@@ -401,7 +403,7 @@
}
}
}
@@ -1618,15 +1746,20 @@
@@ -1618,15 +1748,20 @@
}
}
@@ -424,7 +426,7 @@
this.field_72984_F.func_76318_c("pendingBlockEntities");
if (!this.field_147484_a.isEmpty())
@@ -1660,7 +1793,8 @@
@@ -1660,7 +1795,8 @@
public boolean func_175700_a(TileEntity p_175700_1_)
{
@@ -434,7 +436,7 @@
if (flag && p_175700_1_ instanceof ITickable)
{
@@ -1699,9 +1833,13 @@
@@ -1699,9 +1835,13 @@
{
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
@@ -450,7 +452,7 @@
{
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
p_72866_1_.field_70137_T = p_72866_1_.field_70163_u;
@@ -1829,7 +1967,7 @@
@@ -1829,7 +1969,7 @@
{
Block block = this.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).func_177230_c();
@@ -459,7 +461,7 @@
{
return true;
}
@@ -1894,6 +2032,10 @@
@@ -1894,6 +2034,10 @@
{
return true;
}
@@ -470,7 +472,34 @@
}
}
}
@@ -2034,6 +2176,7 @@
@@ -1930,6 +2074,16 @@
blockpos$mutableblockpos.func_181079_c(k1, l1, i2);
IBlockState iblockstate = this.func_180495_p(blockpos$mutableblockpos);
Block block = iblockstate.func_177230_c();
+
+ Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, p_72918_3_, (double)l, p_72918_2_, false);
+ if (result != null && result == true)
+ {
+ // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater"
+ flag = true;
+ vec3 = block.func_176197_a(this, blockpos$mutableblockpos, p_72918_3_, vec3);
+ continue;
+ }
+ else if (result != null && result == false) continue;
if (block.func_149688_o() == p_72918_2_)
{
@@ -2004,6 +2158,9 @@
IBlockState iblockstate = this.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, l1, i2));
Block block = iblockstate.func_177230_c();
+ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, p_72830_1_, p_72830_2_);
+ if (result != null) return result;
+
if (block.func_149688_o() == p_72830_2_)
{
int j2 = ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue();
@@ -2034,6 +2191,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_)
{
Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_);
@@ -478,7 +507,7 @@
explosion.func_77278_a();
explosion.func_77279_a(true);
return explosion;
@@ -2180,19 +2323,27 @@
@@ -2180,19 +2338,27 @@
else
{
this.func_175700_a(p_175690_2_);
@@ -507,7 +536,7 @@
}
else
{
@@ -2205,6 +2356,7 @@
@@ -2205,6 +2371,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
@@ -515,7 +544,7 @@
}
public void func_147457_a(TileEntity p_147457_1_)
@@ -2223,7 +2375,7 @@
@@ -2223,7 +2390,7 @@
{
IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_);
Block block = iblockstate.func_177230_c();
@@ -524,7 +553,7 @@
}
public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_)
@@ -2243,7 +2395,7 @@
@@ -2243,7 +2410,7 @@
else
{
Block block = this.func_180495_p(p_175677_1_).func_177230_c();
@@ -533,7 +562,7 @@
}
}
}
@@ -2262,6 +2414,7 @@
@@ -2262,6 +2429,7 @@
{
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
@@ -541,7 +570,7 @@
}
public void func_72835_b()
@@ -2271,6 +2424,11 @@
@@ -2271,6 +2439,11 @@
protected void func_72947_a()
{
@@ -553,7 +582,7 @@
if (this.field_72986_A.func_76059_o())
{
this.field_73004_o = 1.0F;
@@ -2284,6 +2442,11 @@
@@ -2284,6 +2457,11 @@
protected void func_72979_l()
{
@@ -565,7 +594,7 @@
if (!this.field_73011_w.func_177495_o())
{
if (!this.field_72995_K)
@@ -2378,6 +2541,7 @@
@@ -2378,6 +2556,7 @@
{
this.field_72993_I.clear();
this.field_72984_F.func_76320_a("buildList");
@@ -573,7 +602,7 @@
for (int i = 0; i < this.field_73010_i.size(); ++i)
{
@@ -2434,8 +2598,9 @@
@@ -2434,8 +2613,9 @@
Block block = p_147467_3_.func_177428_a(blockpos);
j = j + p_147467_1_;
k = k + p_147467_2_;
@@ -584,7 +613,7 @@
{
EntityPlayer entityplayer = this.func_72977_a((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D);
@@ -2475,6 +2640,11 @@
@@ -2475,6 +2655,11 @@
public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_)
{
@@ -596,7 +625,7 @@
BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_);
float f = biomegenbase.func_180626_a(p_175670_1_);
@@ -2516,6 +2686,11 @@
@@ -2516,6 +2701,11 @@
public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_)
{
@@ -608,7 +637,7 @@
BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_);
float f = biomegenbase.func_180626_a(p_175708_1_);
@@ -2533,7 +2708,7 @@
@@ -2533,7 +2723,7 @@
{
Block block = this.func_180495_p(p_175708_1_).func_177230_c();
@@ -617,7 +646,7 @@
{
return true;
}
@@ -2565,10 +2740,11 @@
@@ -2565,10 +2755,11 @@
else
{
Block block = this.func_180495_p(p_175638_1_).func_177230_c();
@@ -632,7 +661,7 @@
{
j = 1;
}
@@ -2768,10 +2944,10 @@
@@ -2768,10 +2959,10 @@
public List<Entity> func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate <? super Entity > p_175674_3_)
{
List<Entity> list = Lists.<Entity>newArrayList();
@@ -647,7 +676,7 @@
for (int i1 = i; i1 <= j; ++i1)
{
@@ -2824,10 +3000,10 @@
@@ -2824,10 +3015,10 @@
public <T extends Entity> List<T> func_175647_a(Class <? extends T > p_175647_1_, AxisAlignedBB p_175647_2_, Predicate <? super T > p_175647_3_)
{
@@ -662,7 +691,7 @@
List<T> list = Lists.<T>newArrayList();
for (int i1 = i; i1 <= j; ++i1)
@@ -2905,11 +3081,13 @@
@@ -2905,11 +3096,13 @@
public void func_175650_b(Collection<Entity> p_175650_1_)
{
@@ -679,7 +708,7 @@
}
}
@@ -2922,7 +3100,9 @@
@@ -2922,7 +3115,9 @@
{
Block block = this.func_180495_p(p_175716_2_).func_177230_c();
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_180640_a(this, p_175716_2_, p_175716_1_.func_176223_P());
@@ -690,7 +719,7 @@
}
public int func_181545_F()
@@ -3007,7 +3187,7 @@
@@ -3007,7 +3202,7 @@
{
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
Block block = iblockstate.func_177230_c();
@@ -699,7 +728,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_)
@@ -3134,7 +3314,7 @@
@@ -3134,7 +3329,7 @@
public long func_72905_C()
{
@@ -708,7 +737,7 @@
}
public long func_82737_E()
@@ -3144,17 +3324,17 @@
@@ -3144,17 +3339,17 @@
public long func_72820_D()
{
@@ -729,7 +758,7 @@
if (!this.func_175723_af().func_177746_a(blockpos))
{
@@ -3166,7 +3346,7 @@
@@ -3166,7 +3361,7 @@
public void func_175652_B(BlockPos p_175652_1_)
{
@@ -738,7 +767,7 @@
}
@SideOnly(Side.CLIENT)
@@ -3186,12 +3366,18 @@
@@ -3186,12 +3381,18 @@
if (!this.field_72996_f.contains(p_72897_1_))
{
@@ -757,7 +786,7 @@
return true;
}
@@ -3285,8 +3471,7 @@
@@ -3285,8 +3486,7 @@
public boolean func_180502_D(BlockPos p_180502_1_)
{
@@ -767,7 +796,7 @@
}
public MapStorage func_175693_T()
@@ -3345,12 +3530,12 @@
@@ -3345,12 +3545,12 @@
public int func_72800_K()
{
@@ -782,7 +811,7 @@
}
public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_)
@@ -3405,7 +3590,7 @@
@@ -3405,7 +3605,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{
@@ -791,7 +820,16 @@
}
public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
@@ -3447,18 +3632,14 @@
@@ -3439,7 +3639,7 @@
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_)
{
- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
+ for (EnumFacing enumfacing : EnumFacing.field_82609_l)
{
BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing);
@@ -3447,18 +3647,14 @@
{
IBlockState iblockstate = this.func_180495_p(blockpos);
@@ -816,7 +854,7 @@
}
}
}
@@ -3528,4 +3709,81 @@
@@ -3528,4 +3724,81 @@
int k = 128;
return i >= -k && i <= k && j >= -k && j <= k;
}
@@ -60,7 +60,7 @@
this.field_72984_F.func_76319_b();
this.func_147488_Z();
}
@@ -217,6 +237,7 @@
@@ -217,12 +237,14 @@
public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_)
{
List<BiomeGenBase.SpawnListEntry> list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_);
@@ -68,7 +68,14 @@
return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.func_76271_a(this.field_73012_v, list) : null;
}
@@ -268,10 +289,7 @@
public boolean func_175732_a(EnumCreatureType p_175732_1_, BiomeGenBase.SpawnListEntry p_175732_2_, BlockPos p_175732_3_)
{
List<BiomeGenBase.SpawnListEntry> list = this.func_72863_F().func_177458_a(p_175732_1_, p_175732_3_);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175732_1_, p_175732_3_, list);
return list != null && !list.isEmpty() ? list.contains(p_175732_2_) : false;
}
@@ -268,10 +290,7 @@
private void func_73051_P()
{
@@ -133,13 +140,13 @@
- for (int i = 0; i < this.field_147482_g.size(); ++i)
+ //Forge: Optimize this loop to only grab from the chunks it needs
+ for (int x = p_147486_1_; x < p_147486_4_; x += 16)
+ for (int x = (p_147486_1_ & ~0x0F); x < p_147486_4_; x += 16)
{
- TileEntity tileentity = (TileEntity)this.field_147482_g.get(i);
- BlockPos blockpos = tileentity.func_174877_v();
-
- if (blockpos.func_177958_n() >= p_147486_1_ && blockpos.func_177956_o() >= p_147486_2_ && blockpos.func_177952_p() >= p_147486_3_ && blockpos.func_177958_n() < p_147486_4_ && blockpos.func_177956_o() < p_147486_5_ && blockpos.func_177952_p() < p_147486_6_)
+ for (int z = p_147486_3_; z < p_147486_6_; z += 16)
+ for (int z = (p_147486_3_ & ~0x0F); z < p_147486_6_; z += 16) // & ~0xF Floors it by 16. Yay bitmath!
{
- list.add(tileentity);
+ if (!this.func_175680_a(x >> 4, z >> 4, true)) continue; //Prevent loading extra chunks to just read data. This causes orphaned chunks that never unload.
@@ -24,7 +24,15 @@
}
private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_)
@@ -623,14 +623,19 @@
@@ -607,6 +607,7 @@
{
Block block = p_177436_2_.func_177230_c();
Block block1 = iblockstate.func_177230_c();
+ int k1 = block1.getLightOpacity(this.field_76637_e, p_177436_1_); // Relocate old light value lookup here, so that it is called before TE is removed.
ExtendedBlockStorage extendedblockstorage = this.field_76652_q[j >> 4];
boolean flag = false;
@@ -623,14 +624,19 @@
extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_);
@@ -46,23 +54,24 @@
this.field_76637_e.func_175713_t(p_177436_1_);
}
}
@@ -647,8 +652,8 @@
@@ -647,8 +653,7 @@
}
else
{
- int j1 = block.func_149717_k();
- int k1 = block1.func_149717_k();
+ int j1 = block.getLightOpacity(this.field_76637_e, p_177436_1_);
+ int k1 = block1.getLightOpacity(this.field_76637_e, p_177436_1_);
if (j1 > 0)
{
@@ -668,28 +673,18 @@
@@ -668,28 +673,19 @@
}
}
- if (block1 instanceof ITileEntityProvider)
- {
+ // If capturing blocks, only run block physics for TE's. Non-TE's are handled in ForgeHooks.onPlaceItemIntoWorld
+ if (!this.field_76637_e.field_72995_K && block1 != block && (!this.field_76637_e.captureBlockSnapshots || block.hasTileEntity(p_177436_2_)))
{
- TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);
-
- if (tileentity != null)
@@ -71,8 +80,8 @@
- }
- }
-
if (!this.field_76637_e.field_72995_K && block1 != block)
{
- if (!this.field_76637_e.field_72995_K && block1 != block)
- {
block.func_176213_c(this.field_76637_e, p_177436_1_, p_177436_2_);
}
@@ -88,7 +97,7 @@
this.field_76637_e.func_175690_a(p_177436_1_, tileentity1);
}
@@ -792,6 +787,7 @@
@@ -792,6 +788,7 @@
k = this.field_76645_j.length - 1;
}
@@ -96,7 +105,7 @@
p_76612_1_.field_70175_ag = true;
p_76612_1_.field_70176_ah = this.field_76635_g;
p_76612_1_.field_70162_ai = k;
@@ -830,13 +826,20 @@
@@ -830,13 +827,20 @@
private TileEntity func_177422_i(BlockPos p_177422_1_)
{
Block block = this.func_177428_a(p_177422_1_);
@@ -118,8 +127,12 @@
if (tileentity == null)
{
if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE)
@@ -849,11 +852,6 @@
this.field_177447_w.add(p_177424_1_);
@@ -846,14 +850,9 @@
}
else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED)
{
- this.field_177447_w.add(p_177424_1_);
+ this.field_177447_w.add(p_177424_1_.getImmutable());
}
}
- else if (tileentity.func_145837_r())
@@ -130,7 +143,7 @@
return tileentity;
}
@@ -873,7 +871,7 @@
@@ -873,7 +872,7 @@
p_177426_2_.func_145834_a(this.field_76637_e);
p_177426_2_.func_174878_a(p_177426_1_);
@@ -139,7 +152,7 @@
{
if (this.field_150816_i.containsKey(p_177426_1_))
{
@@ -882,6 +880,7 @@
@@ -882,6 +881,7 @@
p_177426_2_.func_145829_t();
this.field_150816_i.put(p_177426_1_, p_177426_2_);
@@ -147,7 +160,7 @@
}
}
@@ -910,8 +909,9 @@
@@ -910,8 +910,9 @@
entity.func_110123_P();
}
@@ -158,7 +171,7 @@
}
public void func_76623_d()
@@ -927,6 +927,7 @@
@@ -927,6 +928,7 @@
{
this.field_76637_e.func_175681_c(this.field_76645_j[i]);
}
@@ -166,7 +179,7 @@
}
public void func_76630_e()
@@ -936,8 +937,8 @@
@@ -936,8 +938,8 @@
public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List<Entity> p_177414_3_, Predicate <? super Entity > p_177414_4_)
{
@@ -177,7 +190,7 @@
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -976,8 +977,8 @@
@@ -976,8 +978,8 @@
public <T extends Entity> void func_177430_a(Class <? extends T > p_177430_1_, AxisAlignedBB p_177430_2_, List<T> p_177430_3_, Predicate <? super T > p_177430_4_)
{
@@ -188,7 +201,7 @@
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -1137,8 +1138,10 @@
@@ -1137,8 +1139,10 @@
while (!this.field_177447_w.isEmpty())
{
BlockPos blockpos = (BlockPos)this.field_177447_w.poll();
@@ -200,7 +213,7 @@
{
TileEntity tileentity = this.func_177422_i(blockpos);
this.field_76637_e.func_175690_a(blockpos, tileentity);
@@ -1200,6 +1203,13 @@
@@ -1200,6 +1204,13 @@
@SideOnly(Side.CLIENT)
public void func_177439_a(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_)
{
@@ -214,7 +227,7 @@
int i = 0;
boolean flag = !this.field_76637_e.field_73011_w.func_177495_o();
@@ -1267,10 +1277,16 @@
@@ -1267,10 +1278,16 @@
this.field_76646_k = true;
this.func_76590_a();
@@ -231,7 +244,7 @@
}
public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_)
@@ -1583,4 +1599,20 @@
@@ -1583,4 +1600,20 @@
QUEUED,
CHECK;
}
@@ -5,7 +5,7 @@
Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).func_177230_c();
- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j)
+ if (block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos))
+ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos))
{
flag = false;
}
@@ -4,7 +4,7 @@
i = 6;
}
+ i = getModdedBiomeSize(p_180781_2_, j);
+ i = getModdedBiomeSize(p_180781_2_, i);
+
GenLayer lvt_8_1_ = GenLayerZoom.func_75915_a(1000L, genlayer4, 0);
GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_);
@@ -51,12 +51,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IRegistry;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.*;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -80,6 +75,7 @@ import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.ForgeVersion.Status;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.tuple.Pair;
@@ -164,7 +160,7 @@ public class ForgeHooksClient
public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBiped _default)
{
ModelBiped model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID);
ModelBiped model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID, _default);
return model == null ? _default : model;
}
@@ -200,6 +196,12 @@ public class ForgeHooksClient
MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
return fovUpdateEvent.newfov;
}
public static float getFOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) {
EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, block, renderPartialTicks, fov);
MinecraftForge.EVENT_BUS.post(event);
return event.getFOV();
}
private static int skyX, skyZ;
@@ -387,7 +389,7 @@ public class ForgeHooksClient
}
else
{
model.getItemCameraTransforms().func_181689_a(cameraTransformType);
model.getItemCameraTransforms().applyTransform(cameraTransformType);
}
return model;
}
@@ -412,28 +414,30 @@ public class ForgeHooksClient
public static void preDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)
{
VertexFormatElement attr = format.getElement(element);
int count = attr.getElementCount();
int constant = attr.getType().getGlConstant();
buffer.position(format.func_181720_d(element));
switch(attrType)
{
case POSITION:
glVertexPointer(attr.getElementCount(), attr.getType().getGlConstant(), stride, buffer);
glVertexPointer(count, constant, stride, buffer);
glEnableClientState(GL_VERTEX_ARRAY);
break;
case NORMAL:
if(attr.getElementCount() != 3)
if(count != 3)
{
throw new IllegalArgumentException("Normal attribute should have the size 3: " + attr);
}
glNormalPointer(attr.getType().getGlConstant(), stride, buffer);
glNormalPointer(constant, stride, buffer);
glEnableClientState(GL_NORMAL_ARRAY);
break;
case COLOR:
glColorPointer(attr.getElementCount(), attr.getType().getGlConstant(), stride, buffer);
glColorPointer(count, constant, stride, buffer);
glEnableClientState(GL_COLOR_ARRAY);
break;
case UV:
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + attr.getIndex());
glTexCoordPointer(attr.getElementCount(), attr.getType().getGlConstant(), stride, buffer);
glTexCoordPointer(count, constant, stride, buffer);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
break;
@@ -441,7 +445,7 @@ public class ForgeHooksClient
break;
case GENERIC:
glEnableVertexAttribArray(attr.getIndex());
glVertexAttribPointer(attr.getIndex(), attr.getElementCount(), attr.getType().getGlConstant(), false, stride, buffer);
glVertexAttribPointer(attr.getIndex(), count, constant, false, stride, buffer);
default:
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName());
}
@@ -576,4 +580,16 @@ public class ForgeHooksClient
if(part.isPresent()) return Optional.absent();
return Optional.of(new TRSRTransformation(matrix));
}
public static void loadEntityShader(Entity entity, EntityRenderer entityRenderer)
{
if (entity != null)
{
ResourceLocation shader = ClientRegistry.getEntityShader(entity.getClass());
if (shader != null)
{
entityRenderer.loadShader(shader);
}
}
}
}
@@ -153,7 +153,7 @@ public class GuiIngameForge extends GuiIngame
Scoreboard scoreboard = this.mc.theWorld.getScoreboard();
ScoreObjective objective = null;
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getCommandSenderName());
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getName());
if (scoreplayerteam != null)
{
int slot = scoreplayerteam.getChatFormat().getColorIndex();
@@ -205,6 +205,7 @@ public class GuiIngameForge extends GuiIngame
protected void renderBossHealth()
{
if (pre(BOSSHEALTH)) return;
bind(Gui.icons);
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
mc.mcProfiler.startSection("bossHealth");
GlStateManager.enableBlend();
@@ -276,7 +277,7 @@ public class GuiIngameForge extends GuiIngame
if (f1 > 0.0F)
{
func_180474_b(f1, res);
renderPortal(f1, res);
}
post(PORTAL);
@@ -6,7 +6,18 @@
package net.minecraftforge.client;
import java.util.BitSet;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.renderer.RegionRenderCache;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
public class MinecraftForgeClient
{
@@ -56,4 +67,29 @@ public class MinecraftForgeClient
stencilBits.set(bit);
}
}
private static final LoadingCache<Pair<World, BlockPos>, RegionRenderCache> regionCache = CacheBuilder.newBuilder()
.maximumSize(500)
.concurrencyLevel(5)
.expireAfterAccess(1, TimeUnit.SECONDS)
.build(new CacheLoader<Pair<World, BlockPos>, RegionRenderCache>()
{
public RegionRenderCache load(Pair<World, BlockPos> key) throws Exception
{
return new RegionRenderCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1);
}
});
public static void onRebuildChunk(World world, BlockPos position, RegionRenderCache cache)
{
regionCache.put(Pair.of(world, position), cache);
}
public static RegionRenderCache getRegionRenderCache(World world, BlockPos pos)
{
int x = pos.getX() & ~0xF;
int y = pos.getY() & ~0xF;
int z = pos.getZ() & ~0xF;
return regionCache.getUnchecked(Pair.of(world, new BlockPos(x, y, z)));
}
}
@@ -7,8 +7,8 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Event that hooks into EntityRenderer, allowing any feature to customize visual attributes of
* fog the player sees.
* Event that hooks into EntityRenderer, allowing any feature to customize visual attributes
* the player sees.
*/
public abstract class EntityViewRenderEvent extends Event
{
@@ -94,4 +94,26 @@ public abstract class EntityViewRenderEvent extends Event
this.roll = roll;
}
}
/**
* Event that allows mods to alter the raw FOV itself.
* This directly affects to the FOV without being modified.
* */
public static class FOVModifier extends EntityViewRenderEvent
{
private float fov;
public FOVModifier(EntityRenderer renderer, Entity entity, Block block, double renderPartialTicks, float fov) {
super(renderer, entity, block, renderPartialTicks);
this.setFOV(fov);
}
public float getFOV() {
return fov;
}
public void setFOV(float fov) {
this.fov = fov;
}
}
}
@@ -3,8 +3,12 @@ package net.minecraftforge.client.event;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.relauncher.Side;
@@ -119,6 +123,42 @@ public class GuiScreenEvent extends Event
}
}
}
/**
* This event fires at the end of {@code 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
{
private final int mouseX;
private final int mouseY;
public BackgroundDrawnEvent(GuiScreen gui)
{
super(gui);
final ScaledResolution scaledresolution = new ScaledResolution(gui.mc);
final int scaledWidth = scaledresolution.getScaledWidth();
final int scaledHeight = scaledresolution.getScaledHeight();
this.mouseX = Mouse.getX() * scaledWidth / gui.mc.displayWidth;
this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1;
}
/**
* The x coordinate of the mouse pointer on the screen.
*/
public int getMouseX()
{
return mouseX;
}
/**
* The y coordinate of the mouse pointer on the screen.
*/
public int getMouseY()
{
return mouseY;
}
}
public static class ActionPerformedEvent extends GuiScreenEvent
{
@@ -17,10 +17,10 @@ public class Attributes
static
{
DEFAULT_BAKED_FORMAT = new VertexFormat();
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3));
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4));
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2));
DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4));
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3));
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4));
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2));
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4));
}
/*
@@ -63,12 +63,14 @@ public class BlockStateLoader
for (ForgeBlockStateV1.Variant var : entry.getValue())
{
boolean uvLock = var.getUvLock().or(false);
boolean smooth = var.getSmooth().or(true);
boolean gui3d = var.getGui3d().or(true);
int weight = var.getWeight().or(1);
if (var.getModel() != null && var.getSubmodels().size() == 0 && var.getTextures().size() == 0 && var.getCustomData().size() == 0 && var.getState().orNull() instanceof ModelRotation)
mcVars.add(new ModelBlockDefinition.Variant(var.getModel(), (ModelRotation)var.getState().get(), uvLock, weight));
else
mcVars.add(new ForgeVariant(var.getModel(), var.getState().or(TRSRTransformation.identity()), uvLock, weight, var.getTextures(), var.getOnlyPartsVariant(), var.getCustomData()));
mcVars.add(new ForgeVariant(var.getModel(), var.getState().or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, var.getTextures(), var.getOnlyPartsVariant(), var.getCustomData()));
}
variants.add(new ModelBlockDefinition.Variants(entry.getKey(), mcVars));
}
@@ -96,14 +98,24 @@ public class BlockStateLoader
{
private final IModelState state;
private final boolean uvLock;
private final boolean smooth;
private final boolean gui3d;
private final ImmutableMap<String, String> textures;
private final ResourceLocation model;
private final ImmutableMap<String, String> customData;
@Deprecated // remove in 1.9
public SubModel(IModelState state, boolean uvLock, ImmutableMap<String, String> textures, ResourceLocation model, ImmutableMap<String, String> customData)
{
this(state, uvLock, true, true, textures, model, customData);
}
public SubModel(IModelState state, boolean uvLock, boolean smooth, boolean gui3d, ImmutableMap<String, String> textures, ResourceLocation model, ImmutableMap<String, String> customData)
{
this.state = state;
this.uvLock = uvLock;
this.smooth = smooth;
this.gui3d = gui3d;
this.textures = textures;
this.model = model;
this.customData = customData;
@@ -121,33 +133,36 @@ public class BlockStateLoader
private final ImmutableMap<String, String> textures;
private final ImmutableMap<String, SubModel> parts;
private final ImmutableMap<String, String> customData;
private final boolean smooth;
private final boolean gui3d;
private final IModelState state;
public ForgeVariant(ResourceLocation model, IModelState state, boolean uvLock, int weight, ImmutableMap<String, String> textures, ImmutableMap<String, SubModel> parts, ImmutableMap<String, String> customData)
public ForgeVariant(ResourceLocation model, IModelState state, boolean uvLock, boolean smooth, boolean gui3d, int weight, ImmutableMap<String, String> textures, ImmutableMap<String, SubModel> parts, ImmutableMap<String, String> customData)
{
super(model == null ? new ResourceLocation("builtin/missing") : model, state instanceof ModelRotation ? (ModelRotation)state : ModelRotation.X0_Y0, uvLock, weight);
this.textures = textures;
this.parts = parts;
this.customData = customData;
this.state = state;
this.smooth = smooth;
this.gui3d = gui3d;
}
protected IModel runModelHooks(IModel base, ImmutableMap<String, String> textureMap, ImmutableMap<String, String> customData)
private IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, ImmutableMap<String, String> textureMap, ImmutableMap<String, String> customData)
{
if (!customData.isEmpty())
if (!customData.isEmpty() && base instanceof IModelCustomData)
{
if (base instanceof IModelCustomData)
base = ((IModelCustomData)base).process(customData);
else
throw new RuntimeException("Attempted to add custom data to a model that doesn't need it: " + base);
base = ((IModelCustomData<?>)base).process(customData);
}
if (!textureMap.isEmpty())
if (!textureMap.isEmpty() && base instanceof IRetexturableModel)
{
if (base instanceof IRetexturableModel)
base = ((IRetexturableModel)base).retexture(textureMap);
else
throw new RuntimeException("Attempted to retexture a non-retexturable model: " + base);
base = ((IRetexturableModel<?>)base).retexture(textureMap);
}
if (base instanceof IModelSimpleProperties<?>)
{
base = ((IModelSimpleProperties<?>) base).smoothLighting(smooth).gui3d(gui3d);
}
return base;
@@ -164,7 +179,7 @@ public class BlockStateLoader
if (hasBase)
{
base = runModelHooks(base, textures, customData);
base = runModelHooks(base, smooth, gui3d, textures, customData);
if (size <= 0)
return base;
@@ -193,7 +208,7 @@ public class BlockStateLoader
IModelState partState = new ModelStateComposition(baseTr, part.getState());
if (part.isUVLock()) partState = new ModelLoader.UVLock(partState);
models.put(entry.getKey(), Pair.<IModel, IModelState>of(runModelHooks(model, part.getTextures(), part.getCustomData()), partState));
models.put(entry.getKey(), Pair.<IModel, IModelState>of(runModelHooks(model, part.smooth, part.gui3d, part.getTextures(), part.getCustomData()), partState));
}
return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build());
@@ -275,6 +275,8 @@ public class ForgeBlockStateV1 extends Marker
private boolean modelSet = false;
private Optional<IModelState> state = Optional.absent();
private Optional<Boolean> uvLock = Optional.absent();
private Optional<Boolean> smooth = Optional.absent();
private Optional<Boolean> gui3d = Optional.absent();
private Optional<Integer> weight = Optional.absent();
private Map<String, String> textures = Maps.newHashMap();
private Map<String, List<ForgeBlockStateV1.Variant>> submodels = Maps.newHashMap();
@@ -292,6 +294,8 @@ public class ForgeBlockStateV1 extends Marker
this.modelSet = other.modelSet;
this.state = other.state;
this.uvLock = other.uvLock;
this.smooth = other.smooth;
this.gui3d = other.gui3d;
this.weight = other.weight;
this.textures.putAll(other.textures);
this.mergeModelPartVariants(this.submodels, other.submodels);
@@ -311,6 +315,8 @@ public class ForgeBlockStateV1 extends Marker
}
if (!this.state.isPresent()) this.state = parent.state;
if (!this.uvLock.isPresent()) this.uvLock = parent.uvLock;
if (!this.smooth.isPresent()) this.smooth = parent.smooth;
if (!this.gui3d.isPresent()) this.gui3d = parent.gui3d;
if (!this.weight.isPresent()) this.weight = parent.weight;
for (Entry<String, String> e : parent.textures.entrySet())
@@ -400,6 +406,16 @@ public class ForgeBlockStateV1 extends Marker
}
}
public Optional<Boolean> getSmooth()
{
return smooth;
}
public Optional<Boolean> getGui3d()
{
return gui3d;
}
public static class Deserializer implements JsonDeserializer<ForgeBlockStateV1.Variant>
{
static Variant.Deserializer INSTANCE = new Deserializer();
@@ -593,6 +609,16 @@ public class ForgeBlockStateV1 extends Marker
ret.uvLock = Optional.of(JsonUtils.getBoolean(json, "uvlock"));
}
if (json.has("smooth_lighting"))
{
ret.smooth = Optional.of(JsonUtils.getBoolean(json, "smooth_lighting"));
}
if (json.has("gui3d"))
{
ret.gui3d = Optional.of(JsonUtils.getBoolean(json, "gui3d"));
}
if (json.has("weight"))
{ // Load weight.
ret.weight = Optional.of(JsonUtils.getInt(json, "weight"));
@@ -59,9 +59,9 @@ public interface IFlexibleBakedModel extends IBakedModel
return parent.isBuiltInRenderer();
}
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
return parent.getTexture();
return parent.getParticleTexture();
}
@Deprecated
@@ -17,6 +17,7 @@ public interface IModel
/*
* Returns all model locations that this model depends on.
* Assume that returned collection is immutable.
* See ModelLoaderRegistry.getModel for dependency loading.
*/
Collection<ResourceLocation> getDependencies();
@@ -2,11 +2,13 @@ package net.minecraftforge.client.model;
import com.google.common.collect.ImmutableMap;
public interface IModelCustomData extends IModel
public interface IModelCustomData<M extends IModelCustomData<M>> extends IModel
{
/**
* Allows the model to process custom data from the variant definition
* @return a new model, with data applied
* Allows the model to process custom data from the variant definition.
* If unknown data is encountered it should be skipped.
* @return a new model, with data applied.
*/
// 1.9: change IModel to M
IModel process(ImmutableMap<String, String> customData);
}
@@ -0,0 +1,10 @@
package net.minecraftforge.client.model;
/**
* Implement this if the model can process "smooth_lighting" or "gui3d" attributes from the json.
*/
public interface IModelSimpleProperties<M extends IModelSimpleProperties<M>> extends IModel
{
M smoothLighting(boolean value);
M gui3d(boolean value);
}
@@ -0,0 +1,12 @@
package net.minecraftforge.client.model;
import com.google.common.collect.ImmutableSet;
/**
* Created by rainwarrior on 2/2/16.
*/
public interface IModelWithSubmodels<M extends IModelWithSubmodels<M>> extends IModel
{
M setDefaultSubmodelEnabled (boolean value);
M setSubmodelsEnabled(ImmutableSet<String> submodelNames, boolean show);
}
@@ -63,7 +63,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel
ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();
for(TransformType type : TransformType.values())
{
builder.put(type, new TRSRTransformation(transforms.func_181688_b(type)));
builder.put(type, new TRSRTransformation(transforms.getTransform(type)));
}
return builder.build();
}
@@ -72,7 +72,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel
{
TRSRTransformation tr = transforms.get(cameraTransformType);
Matrix4f mat = null;
if(tr != null && tr != TRSRTransformation.identity()) mat = TRSRTransformation.blockCornerToCenter(tr).getMatrix();
if(tr != null && !tr.equals(TRSRTransformation.identity())) mat = TRSRTransformation.blockCornerToCenter(tr).getMatrix();
return Pair.of(model, mat);
}
@@ -89,7 +89,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel
public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); }
public boolean isGui3d() { return parent.isGui3d(); }
public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); }
public TextureAtlasSprite getTexture() { return parent.getTexture(); }
public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); }
public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); }
public List<BakedQuad> getFaceQuads(EnumFacing side) { return parent.getFaceQuads(side); }
public List<BakedQuad> getGeneralQuads() { return parent.getGeneralQuads(); }
@@ -2,7 +2,7 @@ package net.minecraftforge.client.model;
import com.google.common.collect.ImmutableMap;
public interface IRetexturableModel extends IModel
public interface IRetexturableModel<M extends IRetexturableModel<M>> extends IModel
{
/**
* Applies new textures to the model.
@@ -21,5 +21,6 @@ public interface IRetexturableModel extends IModel
* @param textures New
* @return Model with textures applied.
*/
// 1.9: change IModel to M
IModel retexture(ImmutableMap<String, String> textures);
}
@@ -53,9 +53,9 @@ public interface ISmartBlockModel extends IBakedModel
return parent.isBuiltInRenderer();
}
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
return parent.getTexture();
return parent.getParticleTexture();
}
public ItemCameraTransforms getItemCameraTransforms()
@@ -5,8 +5,11 @@ import java.util.BitSet;
import java.util.Collection;
import java.util.List;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector4f;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
@@ -23,7 +26,7 @@ import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public class ItemLayerModel implements IRetexturableModel
public class ItemLayerModel implements IRetexturableModel<ItemLayerModel>
{
public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.<ResourceLocation>of());
@@ -68,12 +71,16 @@ public class ItemLayerModel implements IRetexturableModel
public IModel retexture(ImmutableMap<String, String> textures)
{
ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
for(int i = 0; i < textures.size(); i++)
for(int i = 0; i < textures.size() + this.textures.size(); i++)
{
if(textures.containsKey("layer" + i))
{
builder.add(new ResourceLocation(textures.get("layer" + i)));
}
else if(i < this.textures.size())
{
builder.add(this.textures.get(i));
}
}
return new ItemLayerModel(builder.build());
}
@@ -89,14 +96,10 @@ public class ItemLayerModel implements IRetexturableModel
}
TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
ImmutableMap<TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
IFlexibleBakedModel ret = new BakedModel(builder.build(), particle, format);
if(map.isEmpty())
{
return ret;
}
return new IPerspectiveAwareModel.MapWrapper(ret, map);
return new BakedItemModel(builder.build(), particle, format, map, null);
}
@Deprecated // remove 1.9
public static class BakedModel implements IFlexibleBakedModel
{
private final ImmutableList<BakedQuad> quads;
@@ -113,13 +116,72 @@ public class ItemLayerModel implements IRetexturableModel
public boolean isAmbientOcclusion() { return true; }
public boolean isGui3d() { return false; }
public boolean isBuiltInRenderer() { return false; }
public TextureAtlasSprite getTexture() { return particle; }
public TextureAtlasSprite getParticleTexture() { return particle; }
public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
public List<BakedQuad> getFaceQuads(EnumFacing side) { return ImmutableList.of(); }
public List<BakedQuad> getGeneralQuads() { return quads; }
public VertexFormat getFormat() { return format; }
}
private static class BakedItemModel implements IFlexibleBakedModel, IPerspectiveAwareModel
{
private final ImmutableList<BakedQuad> quads;
private final TextureAtlasSprite particle;
private final VertexFormat format;
private final ImmutableMap<TransformType, TRSRTransformation> transforms;
private final IFlexibleBakedModel otherModel;
private final boolean isCulled;
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap<TransformType, TRSRTransformation> transforms, IFlexibleBakedModel otherModel)
{
this.quads = quads;
this.particle = particle;
this.format = format;
this.transforms = transforms;
if(otherModel != null)
{
this.otherModel = otherModel;
this.isCulled = true;
}
else
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(BakedQuad quad : quads)
{
if(quad.getFace() == EnumFacing.SOUTH)
{
builder.add(quad);
}
}
this.otherModel = new BakedItemModel(builder.build(), particle, format, transforms, this);
isCulled = false;
}
}
public boolean isAmbientOcclusion() { return true; }
public boolean isGui3d() { return false; }
public boolean isBuiltInRenderer() { return false; }
public TextureAtlasSprite getParticleTexture() { return particle; }
public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
public List<BakedQuad> getFaceQuads(EnumFacing side) { return ImmutableList.of(); }
public List<BakedQuad> getGeneralQuads() { return quads; }
public VertexFormat getFormat() { return format; }
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(TransformType type)
{
Pair<? extends IFlexibleBakedModel, Matrix4f> pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type);
if(type == TransformType.GUI && !isCulled && pair.getRight() == null)
{
return Pair.of(otherModel, null);
}
else if(type != TransformType.GUI && isCulled)
{
return Pair.of(otherModel, pair.getRight());
}
return pair;
}
}
public ImmutableList<BakedQuad> getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, Optional<TRSRTransformation> transform)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
@@ -8,6 +8,7 @@ import com.google.common.collect.ImmutableMap;
/*
* Simple implementation of IModelState via a map and a default value. Provides a full state for each part.
* You probably don't want to use this.
*/
public class MapModelState implements IModelState
{
@@ -27,7 +27,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Map;
public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel
public class ModelDynBucket implements IModel, IModelCustomData<ModelDynBucket>, IRetexturableModel<ModelDynBucket>
{
public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation("forge", "dynbucket"), "inventory");
@@ -48,7 +48,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo
public ModelDynBucket()
{
this(null, null, null, FluidRegistry.WATER, false);
this(null, null, null, null, false);
}
public ModelDynBucket(ResourceLocation baseLocation, ResourceLocation liquidLocation, ResourceLocation coverLocation, Fluid fluid, boolean flipGas)
@@ -88,22 +88,26 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo
ImmutableMap<TransformType, TRSRTransformation> transformMap = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
// if the fluid is a gas wi manipulate the initial state to be rotated 180° to turn it upside down
if (flipGas && fluid.isGaseous())
if (flipGas && fluid != null && fluid.isGaseous())
{
state = new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, new Quat4f(0, 0, 1, 0), null, null)));
}
TRSRTransformation transform = state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity());
TextureAtlasSprite fluidSprite = bakedTextureGetter.apply(fluid.getStill());
TextureAtlasSprite fluidSprite = null;
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
if(fluid != null) {
fluidSprite = bakedTextureGetter.apply(fluid.getStill());
}
if (baseLocation != null)
{
// build base (insidest)
IFlexibleBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter);
builder.addAll(model.getGeneralQuads());
}
if (liquidLocation != null)
if (liquidLocation != null && fluidSprite != null)
{
TextureAtlasSprite liquid = bakedTextureGetter.apply(liquidLocation);
// build liquid layer (inside)
@@ -239,7 +243,10 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo
// not a fluid item apparently
if (fluidStack == null)
{
// empty bucket
return this;
}
Fluid fluid = fluidStack.getFluid();
@@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector4f;
import net.minecraft.block.state.IBlockState;
@@ -27,8 +28,13 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.base.Function;
import com.google.common.base.Optional;
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.ImmutableSet;
@@ -37,7 +43,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
@SuppressWarnings("deprecation")
public class ModelFluid implements IModelCustomData
public class ModelFluid implements IModelCustomData<ModelFluid>
{
public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER);
public static final ModelFluid lavaModel = new ModelFluid(FluidRegistry.LAVA);
@@ -61,12 +67,7 @@ public class ModelFluid implements IModelCustomData
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
ImmutableMap<TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
IFlexibleBakedModel ret = new BakedFluid(state.apply(Optional.<IModelPart>absent()), format, fluid.getColor(), bakedTextureGetter.apply(fluid.getStill()), bakedTextureGetter.apply(fluid.getFlowing()), fluid.isGaseous());
if(map.isEmpty())
{
return ret;
}
return new IPerspectiveAwareModel.MapWrapper(ret, map);
return new BakedFluid(state.apply(Optional.<IModelPart>absent()), map, format, fluid.getColor(), bakedTextureGetter.apply(fluid.getStill()), bakedTextureGetter.apply(fluid.getFlowing()), fluid.isGaseous(), Optional.<IExtendedBlockState>absent());
}
public IModelState getDefaultState()
@@ -94,18 +95,35 @@ public class ModelFluid implements IModelCustomData
}
}
public static class BakedFluid implements IFlexibleBakedModel, ISmartBlockModel
public static class BakedFluid implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel
{
private static final int x[] = { 0, 0, 1, 1 };
private static final int z[] = { 0, 1, 1, 0 };
private static final float eps = 1e-3f;
private final LoadingCache<Long, BakedFluid> modelCache = CacheBuilder.newBuilder().maximumSize(200).build(new CacheLoader<Long, BakedFluid>()
{
public BakedFluid load(Long key) throws Exception
{
boolean statePresent = (key & 1) != 0;
key >>>= 1;
int[] cornerRound = new int[4];
for(int i = 0; i < 4; i++)
{
cornerRound[i] = (int)(key & 0x3FF);
key >>>= 10;
}
int flowRound = (int)(key & 0x7FF) - 1024;
return new BakedFluid(transformation, transforms, format, color, still, flowing, gas, statePresent, cornerRound, flowRound);
}
});
private final Optional<TRSRTransformation> transformation;
private final ImmutableMap<TransformType, TRSRTransformation> transforms;
private final VertexFormat format;
private final int color;
private final TextureAtlasSprite still, flowing;
private final boolean gas;
private final Optional<IExtendedBlockState> state;
private final EnumMap<EnumFacing, List<BakedQuad>> faceQuads;
public BakedFluid(Optional<TRSRTransformation> transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas)
@@ -114,14 +132,52 @@ public class ModelFluid implements IModelCustomData
}
public BakedFluid(Optional<TRSRTransformation> transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, Optional<IExtendedBlockState> stateOption)
{
this(transformation, ImmutableMap.<TransformType, TRSRTransformation>of(), format, color, still, flowing, gas, stateOption);
}
public BakedFluid(Optional<TRSRTransformation> transformation, ImmutableMap<TransformType, TRSRTransformation> transforms, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, Optional<IExtendedBlockState> stateOption)
{
this(transformation, transforms, format, color, still, flowing, gas, stateOption.isPresent(), getCorners(stateOption), getFlow(stateOption));
}
private static int[] getCorners(Optional<IExtendedBlockState> stateOption)
{
int[] cornerRound = new int[]{0, 0, 0, 0};
if(stateOption.isPresent())
{
IExtendedBlockState state = stateOption.get();
for(int i = 0; i < 4; i++)
{
Float level = state.getValue(BlockFluidBase.LEVEL_CORNERS[i]);
cornerRound[i] = Math.round((level == null ? 7f / 8 : level) * 768);
}
}
return cornerRound;
}
private static int getFlow(Optional<IExtendedBlockState> stateOption)
{
Float flow = -1000f;
if(stateOption.isPresent())
{
flow = stateOption.get().getValue(BlockFluidBase.FLOW_DIRECTION);
if(flow == null) flow = -1000f;
}
int flowRound = (int)Math.round(Math.toDegrees(flow));
flowRound = MathHelper.clamp_int(flowRound, -1000, 1000);
return flowRound;
}
public BakedFluid(Optional<TRSRTransformation> transformation, ImmutableMap<TransformType, TRSRTransformation> transforms, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, boolean statePresent, int[] cornerRound, int flowRound)
{
this.transformation = transformation;
this.transforms = transforms;
this.format = format;
this.color = color;
this.still = still;
this.flowing = flowing;
this.gas = gas;
this.state = stateOption;
faceQuads = Maps.newEnumMap(EnumFacing.class);
for(EnumFacing side : EnumFacing.values())
@@ -129,29 +185,28 @@ public class ModelFluid implements IModelCustomData
faceQuads.put(side, ImmutableList.<BakedQuad>of());
}
if(state.isPresent())
if(statePresent)
{
IExtendedBlockState state = this.state.get();
float[] y = new float[4];
for(int i = 0; i < 4; i++)
{
if(gas)
{
y[i] = 1 - state.getValue(BlockFluidBase.LEVEL_CORNERS[i]);
y[i] = 1 - cornerRound[i] / 768f;
}
else
{
y[i] = state.getValue(BlockFluidBase.LEVEL_CORNERS[i]);
y[i] = cornerRound[i] / 768f;
}
}
float flow = state.getValue(BlockFluidBase.FLOW_DIRECTION);
float flow = (float)Math.toRadians(flowRound);
// top
TextureAtlasSprite topSprite = flowing;
float scale = 4;
if(flow < -999F)
if(flow < -17F)
{
flow = 0;
scale = 8;
@@ -222,7 +277,6 @@ public class ModelFluid implements IModelCustomData
else
{
// 1 quad for inventory
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
builder.setQuadOrientation(EnumFacing.UP);
builder.setQuadColored();
@@ -231,8 +285,8 @@ public class ModelFluid implements IModelCustomData
putVertex(
builder, EnumFacing.UP,
z[i], x[i], 0,
still.getInterpolatedU(x[i] * 16),
still.getInterpolatedV(z[i] * 16));
still.getInterpolatedU(z[i] * 16),
still.getInterpolatedV(x[i] * 16));
}
faceQuads.put(EnumFacing.SOUTH, ImmutableList.<BakedQuad>of(builder.build()));
}
@@ -242,12 +296,11 @@ public class ModelFluid implements IModelCustomData
{
for(int e = 0; e < format.getElementCount(); e++)
{
// TODO transformation
switch(format.getElement(e).getUsage())
{
case POSITION:
float[] data = new float[]{ x - side.getDirectionVec().getX() * eps, y, z - side.getDirectionVec().getZ() * eps, 1 };
if(transformation.isPresent())
if(transformation.isPresent() && transformation.get() != TRSRTransformation.identity())
{
Vector4f vec = new Vector4f(data);
transformation.get().getMatrix().transform(vec);
@@ -280,7 +333,7 @@ public class ModelFluid implements IModelCustomData
public boolean isAmbientOcclusion()
{
return false; // FIXME
return false;
}
public boolean isGui3d()
@@ -293,7 +346,7 @@ public class ModelFluid implements IModelCustomData
return false;
}
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
return still;
}
@@ -320,7 +373,28 @@ public class ModelFluid implements IModelCustomData
public IBakedModel handleBlockState(IBlockState state)
{
return new BakedFluid(transformation, format, color, still, flowing, gas, Optional.of((IExtendedBlockState)state));
if(state instanceof IExtendedBlockState)
{
IExtendedBlockState exState = (IExtendedBlockState)state;
int[] cornerRound = getCorners(Optional.of(exState));
int flowRound = getFlow(Optional.of(exState));
long key = flowRound + 1024;
for(int i = 3; i >= 0; i--)
{
key <<= 10;
key |= cornerRound[i];
}
key <<= 1;
key |= 1;
return modelCache.getUnchecked(key);
}
return this;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(TransformType type)
{
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type);
}
}
@@ -3,18 +3,20 @@ package net.minecraftforge.client.model;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.google.common.base.Joiner;
import com.google.common.collect.*;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -23,6 +25,7 @@ import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.renderer.block.model.BlockPart;
import net.minecraft.client.renderer.block.model.BlockPartFace;
import net.minecraft.client.renderer.block.model.BlockPartRotation;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.block.model.ItemModelGenerator;
@@ -48,15 +51,24 @@ import net.minecraft.client.resources.model.WeightedBakedModel;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IRegistry;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.animation.Animation;
import net.minecraftforge.client.model.animation.IAnimatedModel;
import net.minecraftforge.client.model.animation.IClip;
import net.minecraftforge.client.model.animation.ModelBlockAnimation;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.Properties;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ProgressManager;
import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.common.registry.RegistryDelegate;
@@ -65,20 +77,15 @@ import org.apache.commons.lang3.tuple.Pair;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@SuppressWarnings("deprecation")
@SuppressWarnings("ALL")
public class ModelLoader extends ModelBakery
{
private final Map<ModelResourceLocation, IModel> stateModels = new HashMap<ModelResourceLocation, IModel>();
private final Set<ResourceLocation> textures = new HashSet<ResourceLocation>();
private final Set<ResourceLocation> loadingModels = new HashSet<ResourceLocation>();
private final Map<ModelResourceLocation, IModel> stateModels = Maps.newHashMap();
private final Set<ResourceLocation> textures = Sets.newHashSet();
private final Set<ResourceLocation> loadingModels = Sets.newHashSet();
private final Set<ModelResourceLocation> missingVariants = Sets.newHashSet();
private final Map<ResourceLocation, Exception> loadingExceptions = Maps.newHashMap();
private IModel missingModel = null;
private IModel itemModel = new ItemLayerModel(MODEL_GENERATED);
@@ -88,6 +95,8 @@ public class ModelLoader extends ModelBakery
return isLoading;
}
private final boolean enableVerboseMissingInfo = (Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment") || Boolean.parseBoolean(System.getProperty("forge.verboseMissingModelLogging", "false"));
public ModelLoader(IResourceManager manager, TextureMap map, BlockModelShapes shapes)
{
super(manager, map, shapes);
@@ -123,14 +132,7 @@ public class ModelLoader extends ModelBakery
}
}
});
Function<ResourceLocation, TextureAtlasSprite> textureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
{
public TextureAtlasSprite apply(ResourceLocation location)
{
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
}
};
IFlexibleBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, textureGetter);
IFlexibleBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance);
for (Entry<ModelResourceLocation, IModel> e : stateModels.entrySet())
{
if(e.getValue() == getMissingModel())
@@ -139,7 +141,7 @@ public class ModelLoader extends ModelBakery
}
else
{
bakedRegistry.putObject(e.getKey(), e.getValue().bake(e.getValue().getDefaultState(), DefaultVertexFormats.ITEM, textureGetter));
bakedRegistry.putObject(e.getKey(), e.getValue().bake(e.getValue().getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance));
}
}
return bakedRegistry;
@@ -148,10 +150,23 @@ public class ModelLoader extends ModelBakery
private void loadBlocks()
{
Map<IBlockState, ModelResourceLocation> stateMap = blockModelShapes.getBlockStateMapper().putAllStateModelLocations();
Collection<ModelResourceLocation> variants = Lists.newArrayList(stateMap.values());
List<ModelResourceLocation> variants = Lists.newArrayList(stateMap.values());
variants.add(new ModelResourceLocation("minecraft:item_frame", "normal")); //Vanilla special cases item_frames so must we
variants.add(new ModelResourceLocation("minecraft:item_frame", "map"));
loadVariants(variants);
Collections.sort(variants, new Comparator<ModelResourceLocation>()
{
public int compare(ModelResourceLocation v1, ModelResourceLocation v2)
{
return v1.toString().compareTo(v2.toString());
}
});
ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", variants.size());
for(ModelResourceLocation variant : variants)
{
loadVariants(ImmutableList.of(variant));
blockBar.step(variant.toString());
}
ProgressManager.pop(blockBar);
}
@Override
@@ -179,36 +194,77 @@ public class ModelLoader extends ModelBakery
}
}
private void storeException(ResourceLocation location, Exception exception)
{
loadingExceptions.put(location, exception);
}
@Override
protected ModelBlockDefinition getModelBlockDefinition(ResourceLocation location)
{
try
{
return super.getModelBlockDefinition(location);
}
catch (Exception exception)
{
storeException(location, new Exception("Could not load model definition for variant " + location, exception));
}
return new ModelBlockDefinition(new ArrayList<ModelBlockDefinition>());
}
private void loadItems()
{
// register model for the universal bucket, if it exists
if(FluidRegistry.isUniversalBucketEnabled())
{
setBucketModelDefinition(ForgeModContainer.getInstance().universalBucket);
}
registerVariantNames();
List<String> itemVariants = Lists.newArrayList();
for(Item item : GameData.getItemRegistry().typeSafeIterable())
{
// default loading
for(String s : (List<String>)getVariantNames(item))
itemVariants.addAll(getVariantNames(item));
}
Collections.sort(itemVariants);
ProgressBar itemBar = ProgressManager.push("ModelLoader: items", itemVariants.size());
for(String s : itemVariants)
{
ResourceLocation file = getItemLocation(s);
ModelResourceLocation memory = getInventoryVariant(s);
itemBar.step(memory.toString());
IModel model = null;
try
{
ResourceLocation file = getItemLocation(s);
ModelResourceLocation memory = getInventoryVariant(s);
IModel model = null;
// default loading
model = getModel(file);
if (model == null)
{
model = getMissingModel();
}
stateModels.put(memory, model);
}
catch (FileNotFoundException e)
{
// try blockstate json if the item model is missing
FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json");
try
{
model = getModel(file);
registerVariant(getModelBlockDefinition(memory), memory);
}
catch (IOException e)
catch (Exception exception)
{
// Handled by our finally block.
}
finally
{
if (model == null || model == getMissingModel())
{
FMLLog.fine("Item json isn't found for '" + memory + "', trying to load the variant from the blockstate json");
registerVariant(getModelBlockDefinition(memory), memory);
}
else stateModels.put(memory, model);
storeException(memory, new Exception("Could not load item model either from the normal location " + file + " or from the blockstate", exception));
}
}
catch (Exception exception)
{
storeException(memory, exception);
}
}
ProgressManager.pop(itemBar);
// replace vanilla bucket models if desired. done afterwards for performance reasons
if(ForgeModContainer.replaceVanillaBucketModel)
@@ -217,8 +273,15 @@ public class ModelLoader extends ModelBakery
if(!stateModels.containsKey(ModelDynBucket.LOCATION))
{
// load forges blockstate json for it
ModelResourceLocation memory = getInventoryVariant("forge:dynbucket");
registerVariant(getModelBlockDefinition(memory), memory);
try
{
registerVariant(getModelBlockDefinition(ModelDynBucket.LOCATION), ModelDynBucket.LOCATION);
}
catch (Exception exception)
{
FMLLog.getLogger().error("Could not load the forge bucket model from the blockstate", exception);
return;
}
}
// empty bucket
@@ -323,13 +386,21 @@ public class ModelLoader extends ModelBakery
}
}
IModel getVariantModel(ModelResourceLocation location)
{
loadVariants(ImmutableList.of(location));
IModel model = stateModels.get(location);
if(model == null) model = getMissingModel();
return model;
}
private void resolveDependencies(IModel model) throws IOException
{
for (ResourceLocation dep : model.getDependencies())
{
if(dep instanceof ModelResourceLocation)
{
loadVariants(ImmutableList.of((ModelResourceLocation)dep));
getVariantModel((ModelResourceLocation)dep);
}
else
{
@@ -339,15 +410,17 @@ public class ModelLoader extends ModelBakery
textures.addAll(model.getTextures());
}
private class VanillaModelWrapper implements IRetexturableModel
private class VanillaModelWrapper implements IRetexturableModel<VanillaModelWrapper>, IModelSimpleProperties<VanillaModelWrapper>, IAnimatedModel
{
private final ResourceLocation location;
private final ModelBlock model;
private final ModelBlockAnimation animation;
public VanillaModelWrapper(ResourceLocation location, ModelBlock model)
public VanillaModelWrapper(ResourceLocation location, ModelBlock model, ModelBlockAnimation animation)
{
this.location = location;
this.model = model;
this.animation = animation;
}
public Collection<ResourceLocation> getDependencies()
@@ -399,7 +472,7 @@ public class ModelLoader extends ModelBakery
if(hasItemModel(model))
{
for(String s : (List<String>)ItemModelGenerator.LAYERS)
for(String s : ItemModelGenerator.LAYERS)
{
String r = model.resolveTextureName(s);
ResourceLocation loc = new ResourceLocation(r);
@@ -418,7 +491,7 @@ public class ModelLoader extends ModelBakery
}
}
}
for(String s : (Iterable<String>)model.textures.values())
for(String s : model.textures.values())
{
if(!s.startsWith("#"))
{
@@ -440,7 +513,8 @@ public class ModelLoader extends ModelBakery
List<TRSRTransformation> newTransforms = Lists.newArrayList();
for(int i = 0; i < model.getElements().size(); i++)
{
newTransforms.add(null);
BlockPart part = model.getElements().get(i);
newTransforms.add(animation.getPartTransform(state, part, i));
}
ItemCameraTransforms transforms = model.func_181682_g();
@@ -463,7 +537,7 @@ public class ModelLoader extends ModelBakery
return bakeNormal(model, perState, state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock);
}
private IFlexibleBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List<TRSRTransformation> newTransforms, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
private IFlexibleBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List<TRSRTransformation> newTransforms, VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
{
TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model)).setTexture(particle);
@@ -474,8 +548,11 @@ public class ModelLoader extends ModelBakery
if(newTransforms.get(i) != null)
{
transformation = transformation.compose(newTransforms.get(i));
BlockPartRotation rot = part.partRotation;
if(rot == null) rot = new BlockPartRotation(new org.lwjgl.util.vector.Vector3f(), EnumFacing.Axis.Y, 0, false);
part = new BlockPart(part.positionFrom, part.positionTo, part.mapFaces, rot, part.shade);
}
for(Map.Entry<EnumFacing, BlockPartFace> e : (Iterable<Map.Entry<EnumFacing, BlockPartFace>>)part.mapFaces.entrySet())
for(Map.Entry<EnumFacing, BlockPartFace> e : part.mapFaces.entrySet())
{
TextureAtlasSprite textureatlassprite1 = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName(e.getValue().texture)));
@@ -494,13 +571,25 @@ public class ModelLoader extends ModelBakery
{
public IBakedModel handleBlockState(IBlockState state)
{
return VanillaModelWrapper.this.handleBlockState(parent, modelState, state);
return VanillaModelWrapper.this.handleBlockState(parent, bakedTextureGetter, modelState, state);
}
};
}
private IBakedModel handleBlockState(IFlexibleBakedModel model, TRSRTransformation modelState, IBlockState state)
private IBakedModel handleBlockState(IFlexibleBakedModel model, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, TRSRTransformation modelState, IBlockState state)
{
if(state instanceof IExtendedBlockState)
{
IExtendedBlockState exState = (IExtendedBlockState)state;
if(exState.getUnlistedNames().contains(Properties.AnimationProperty))
{
IModelState newState = exState.getValue(Properties.AnimationProperty);
if(newState != null)
{
return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), model.getFormat(), bakedTextureGetter);
}
}
}
return model;
}
@@ -511,16 +600,16 @@ public class ModelLoader extends ModelBakery
return this;
List<BlockPart> elements = Lists.newArrayList(); //We have to duplicate this so we can edit it below.
for (BlockPart part : (List<BlockPart>)this.model.getElements())
for (BlockPart part : this.model.getElements())
{
elements.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), part.partRotation, part.shade));
}
ModelBlock neweModel = new ModelBlock(this.model.getParentLocation(), elements,
ModelBlock newModel = new ModelBlock(this.model.getParentLocation(), elements,
Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT
model.func_181682_g());
neweModel.name = this.model.name;
neweModel.parent = this.model.parent;
newModel.name = this.model.name;
newModel.parent = this.model.parent;
Set<String> removed = Sets.newHashSet();
@@ -529,29 +618,29 @@ public class ModelLoader extends ModelBakery
if ("".equals(e.getValue()))
{
removed.add(e.getKey());
neweModel.textures.remove(e.getKey());
newModel.textures.remove(e.getKey());
}
else
neweModel.textures.put(e.getKey(), e.getValue());
newModel.textures.put(e.getKey(), e.getValue());
}
// Map the model's texture references as if it was the parent of a model with the retexture map as its textures.
Map<String, String> remapped = Maps.newHashMap();
for (Entry<String, String> e : (Set<Entry<String, String>>)neweModel.textures.entrySet())
for (Entry<String, String> e : newModel.textures.entrySet())
{
if (e.getValue().startsWith("#"))
{
String key = e.getValue().substring(1);
if (neweModel.textures.containsKey(key))
remapped.put(e.getKey(), (String)neweModel.textures.get(key));
if (newModel.textures.containsKey(key))
remapped.put(e.getKey(), newModel.textures.get(key));
}
}
neweModel.textures.putAll(remapped);
newModel.textures.putAll(remapped);
//Remove any faces that use a null texture, this is for performance reasons, also allows some cool layering stuff.
for (BlockPart part : (List<BlockPart>)neweModel.getElements())
for (BlockPart part : newModel.getElements())
{
Iterator<Entry<EnumFacing, BlockPartFace>> itr = part.mapFaces.entrySet().iterator();
while (itr.hasNext())
@@ -562,15 +651,52 @@ public class ModelLoader extends ModelBakery
}
}
return new VanillaModelWrapper(location, neweModel);
return new VanillaModelWrapper(location, newModel, animation);
}
@Override
public Optional<? extends IClip> getClip(String name)
{
if(animation.getClips().containsKey(name))
{
return Optional.<IClip>fromNullable(animation.getClips().get(name));
}
return Optional.absent();
}
public IModelState getDefaultState()
{
return ModelRotation.X0_Y0;
}
@Override
public VanillaModelWrapper smoothLighting(boolean value)
{
if(model.ambientOcclusion == value)
{
return this;
}
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.func_181682_g());
newModel.parent = model.parent;
newModel.name = model.name;
return new VanillaModelWrapper(location, newModel, animation);
}
@Override
public VanillaModelWrapper gui3d(boolean value)
{
if(model.isGui3d() == value)
{
return this;
}
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.func_181682_g());
newModel.parent = model.parent;
newModel.name = model.name;
return new VanillaModelWrapper(location, newModel, animation);
}
}
@Deprecated // rework in 1.9
public static class UVLock implements IModelState
{
private final IModelState parent;
@@ -591,37 +717,6 @@ public class ModelLoader extends ModelBakery
}
}
// Weighted models can contain multiple copies of 1 model with different rotations - this is to make it work with IModelState (different copies will be different objects).
private static class WeightedPartWrapper implements IModel
{
private final IModel model;
public WeightedPartWrapper(IModel model)
{
this.model = model;
}
public Collection<ResourceLocation> getDependencies()
{
return model.getDependencies();
}
public Collection<ResourceLocation> getTextures()
{
return model.getTextures();
}
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
return model.bake(state, format, bakedTextureGetter);
}
public IModelState getDefaultState()
{
return model.getDefaultState();
}
}
private class WeightedRandomModel implements IModel
{
private final List<Variant> variants;
@@ -629,12 +724,11 @@ public class ModelLoader extends ModelBakery
private final List<IModel> models = new ArrayList<IModel>();
private final IModelState defaultState;
@Deprecated @SuppressWarnings("unused") public WeightedRandomModel(Variants variants){ this(null, variants); } // Remove 1.9
public WeightedRandomModel(ModelResourceLocation parent, Variants variants)
{
this.variants = variants.getVariants();
ImmutableMap.Builder<MapModelState.Wrapper, IModelState> builder = ImmutableMap.builder();
for (Variant v : (List<Variant>)variants.getVariants())
ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder();
for (Variant v : variants.getVariants())
{
ResourceLocation loc = v.getModelLocation();
locations.add(loc);
@@ -669,20 +763,18 @@ public class ModelLoader extends ModelBakery
textures.addAll(model.getTextures()); // Kick this, just in case.
}
model = new WeightedPartWrapper(model);
models.add(model);
builder.put(MapModelState.wrap(model), v.getState());
builder.add(Pair.of(model, v.getState()));
}
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
{
IModel missing = getMissingModel();
models.add(missing);
builder.put(MapModelState.wrap(missing), TRSRTransformation.identity());
builder.add(Pair.<IModel, IModelState>of(missing, TRSRTransformation.identity()));
}
defaultState = new MapModelState(builder.build());
defaultState = new MultiModelState(builder.build());
}
public Collection<ResourceLocation> getDependencies()
@@ -701,15 +793,6 @@ public class ModelLoader extends ModelBakery
return state;
}
private IModelState getState(IModelState state, IModel model)
{
if(state instanceof MapModelState)
{
return ((MapModelState)state).getState(model);
}
return state;
}
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT))
@@ -720,14 +803,14 @@ public class ModelLoader extends ModelBakery
{
Variant v = variants.get(0);
IModel model = models.get(0);
return model.bake(addUV(v.isUvLocked(), getState(state, model)), format, bakedTextureGetter);
return model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, 0)), format, bakedTextureGetter);
}
WeightedBakedModel.Builder builder = new WeightedBakedModel.Builder();
for(int i = 0; i < variants.size(); i++)
{
IModel model = models.get(i);
Variant v = variants.get(i);
builder.add(model.bake(addUV(v.isUvLocked(), getState(state, model)), format, bakedTextureGetter), variants.get(i).getWeight());
builder.add(model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, i)), format, bakedTextureGetter), variants.get(i).getWeight());
}
return new FlexibleWeightedBakedModel(builder.build(), Attributes.DEFAULT_BAKED_FORMAT);
}
@@ -740,14 +823,11 @@ public class ModelLoader extends ModelBakery
private static class FlexibleWeightedBakedModel extends WeightedBakedModel implements IFlexibleBakedModel
{
@SuppressWarnings("unused")
private final WeightedBakedModel parent;
private final VertexFormat format;
public FlexibleWeightedBakedModel(WeightedBakedModel parent, VertexFormat format)
{
super(parent.models);
this.parent = parent;
this.format = format;
}
@@ -757,12 +837,6 @@ public class ModelLoader extends ModelBakery
}
}
@SuppressWarnings("unused")
private boolean isBuiltinModel(ModelBlock model)
{
return model == MODEL_GENERATED || model == MODEL_COMPASS || model == MODEL_CLOCK || model == MODEL_ENTITY;
}
public IModel getMissingModel()
{
if (missingModel == null)
@@ -813,7 +887,14 @@ public class ModelLoader extends ModelBakery
public IModel loadModel(ResourceLocation modelLocation) throws IOException
{
return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation));
String modelPath = modelLocation.getResourcePath();
if(modelLocation.getResourcePath().startsWith("models/"))
{
modelPath = modelPath.substring("models/".length());
}
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json");
ModelBlockAnimation animation = Animation.INSTANCE.loadVanillaAnimation(armatureLocation);
return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation), animation);
}
}
@@ -862,12 +943,106 @@ public class ModelLoader extends ModelBakery
public void onPostBakeEvent(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry)
{
IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING);
Map<String, Integer> modelErrors = Maps.newHashMap();
Multimap<ModelResourceLocation, IBlockState> reverseBlockMap = null;
Multimap<ModelResourceLocation, String> reverseItemMap = null;
if(enableVerboseMissingInfo)
{
reverseBlockMap = HashMultimap.create();
for(Map.Entry<IBlockState, ModelResourceLocation> entry : blockModelShapes.getBlockStateMapper().putAllStateModelLocations().entrySet())
{
reverseBlockMap.put(entry.getValue(), entry.getKey());
}
reverseItemMap = HashMultimap.create();
for(Item item : GameData.getItemRegistry().typeSafeIterable())
{
for(String s : getVariantNames(item))
{
ModelResourceLocation memory = getInventoryVariant(s);
reverseItemMap.put(memory, item.getRegistryName());
}
}
}
for(Map.Entry<ResourceLocation, Exception> entry : loadingExceptions.entrySet())
{
// ignoring pure ResourceLocation arguments, all things we care about pass ModelResourceLocation
if(entry.getKey() instanceof ModelResourceLocation)
{
ModelResourceLocation location = (ModelResourceLocation)entry.getKey();
IBakedModel model = modelRegistry.getObject(location);
if(model == null || model == missingModel)
{
String domain = entry.getKey().getResourceDomain();
Integer errorCountBox = modelErrors.get(domain);
int errorCount = errorCountBox == null ? 0 : errorCountBox;
errorCount++;
if(errorCount < 5)
{
String errorMsg = "Exception loading model for variant " + entry.getKey();
if(enableVerboseMissingInfo)
{
Collection<IBlockState> blocks = reverseBlockMap.get(location);
if(!blocks.isEmpty())
{
if(blocks.size() == 1)
{
errorMsg += " for blockstate \"" + blocks.iterator().next() + "\"";
}
else
{
errorMsg += " for blockstates [\"" + Joiner.on("\", \"").join(blocks) + "\"]";
}
}
Collection<String> items = reverseItemMap.get(location);
if(!items.isEmpty())
{
if(!blocks.isEmpty()) errorMsg += " and";
if(items.size() == 1)
{
errorMsg += " for item \"" + items.iterator().next() + "\"";
}
else
{
errorMsg += " for items [\"" + Joiner.on("\", \"").join(items) + "\"]";
}
}
}
FMLLog.getLogger().error(errorMsg, entry.getValue());
}
modelErrors.put(domain, errorCount);
}
if(model == null)
{
modelRegistry.putObject(location, missingModel);
}
}
}
for(ModelResourceLocation missing : missingVariants)
{
IBakedModel model = modelRegistry.getObject(missing);
if(model == null || model == missingModel)
{
FMLLog.severe("Model definition for location %s not found", missing);
String domain = missing.getResourceDomain();
Integer errorCountBox = modelErrors.get(domain);
int errorCount = errorCountBox == null ? 0 : errorCountBox;
errorCount++;
if(errorCount < 5)
{
FMLLog.severe("Model definition for location %s not found", missing);
}
modelErrors.put(domain, errorCount);
}
if(model == null)
{
modelRegistry.putObject(missing, missingModel);
}
}
for(Map.Entry<String, Integer> e : modelErrors.entrySet())
{
if(e.getValue() >= 5)
{
FMLLog.severe("Suppressed additional %s model loading errors for domain %s", e.getValue(), e.getKey());
}
}
isLoading = false;
@@ -936,4 +1111,19 @@ public class ModelLoader extends ModelBakery
mesher.register(e.getKey().getLeft().get(), e.getKey().getRight(), e.getValue());
}
}
private static enum DefaultTextureGetter implements Function<ResourceLocation, TextureAtlasSprite>
{
instance;
public TextureAtlasSprite apply(ResourceLocation location)
{
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
}
}
public static Function<ResourceLocation, TextureAtlasSprite> defaultTextureGetter()
{
return DefaultTextureGetter.instance;
}
}
@@ -10,6 +10,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader.VanillaLoader;
import net.minecraftforge.client.model.b3d.B3DLoader;
@@ -43,13 +44,7 @@ public class ModelLoaderRegistry
public static void registerLoader(ICustomModelLoader loader)
{
loaders.add(loader);
((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener()
{
public void onResourceManagerReload(IResourceManager manager)
{
for(ICustomModelLoader loader : loaders) loader.onResourceManagerReload(manager);
}
});
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(loader);
}
public static boolean loaded(ResourceLocation location)
@@ -64,58 +59,79 @@ public class ModelLoaderRegistry
return new ResourceLocation(location.getResourceDomain(), "models/" + location.getResourcePath());
}
/**
* Primary method to get IModel instances.
* ResourceLocation argument will be passed directly to the custom model loaders,
* ModelResourceLocation argument will be loaded through the blockstate system.
*/
public static IModel getModel(ResourceLocation location) throws IOException
{
if(cache.containsKey(location)) return cache.get(location);
ResourceLocation actual = getActualLocation(location);
ICustomModelLoader accepted = null;
for(ICustomModelLoader loader : loaders)
{
try
{
if(loader.accepts(actual))
{
if(accepted != null)
{
FMLLog.severe("2 loaders (%s and %s) want to load the same model %s", accepted, loader, location);
throw new IllegalStateException("2 loaders want to load the same model");
}
accepted = loader;
}
}
catch(Exception e)
{
FMLLog.log(Level.ERROR, e, "Exception checking if model %s can be loaded with loader %s, skipping", location, loader);
}
}
// no custom loaders found, try vanilla one
if(accepted == null)
{
if(VanillaLoader.instance.accepts(actual)) accepted = VanillaLoader.instance;
}
IModel model;
if(accepted == null)
if(location instanceof ModelResourceLocation)
{
FMLLog.severe("no suitable loader found for the model %s, skipping", location);
model = getMissingModel();
ModelLoader loader = ModelLoader.VanillaLoader.instance.getLoader();
if(loader != null)
{
model = loader.getVariantModel((ModelResourceLocation)location);
}
else
{
FMLLog.log(Level.ERROR, "Loading model too early, skipping: %s", location);
model = getMissingModel();
}
}
else
{
try
if(cache.containsKey(location)) return cache.get(location);
ResourceLocation actual = getActualLocation(location);
ICustomModelLoader accepted = null;
for(ICustomModelLoader loader : loaders)
{
model = accepted.loadModel(actual);
try
{
if(loader.accepts(actual))
{
if(accepted != null)
{
FMLLog.severe("2 loaders (%s and %s) want to load the same model %s", accepted, loader, location);
throw new IllegalStateException("2 loaders want to load the same model");
}
accepted = loader;
}
}
catch(Exception e)
{
FMLLog.log(Level.ERROR, e, "Exception checking if model %s can be loaded with loader %s, skipping", location, loader);
}
}
catch (IOException e)
// no custom loaders found, try vanilla one
if(accepted == null)
{
throw e;
if(VanillaLoader.instance.accepts(actual)) accepted = VanillaLoader.instance;
}
catch(Exception e)
if(accepted == null)
{
FMLLog.log(Level.ERROR, e, "Exception loading model %s with loader %s, skipping", location, accepted);
FMLLog.severe("no suitable loader found for the model %s, skipping", location);
model = getMissingModel();
}
else
{
try
{
model = accepted.loadModel(actual);
}
catch (IOException e)
{
throw e;
}
catch(Exception e)
{
FMLLog.log(Level.ERROR, e, "Exception loading model %s with loader %s, skipping", location, accepted);
model = getMissingModel();
}
}
}
cache.put(location, model);
return model;
@@ -1,12 +1,11 @@
package net.minecraftforge.client.model;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import javax.vecmath.Matrix4f;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
@@ -16,15 +15,16 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.ItemLayerModel.BakedModel;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.Level;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
public class MultiLayerModel implements IModelCustomData
public class MultiLayerModel implements IModelCustomData<MultiLayerModel>
{
public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap.<Optional<EnumWorldBlockLayer>, ModelResourceLocation>of());
@@ -55,10 +55,36 @@ public class MultiLayerModel implements IModelCustomData
return ImmutableList.of();
}
private static ImmutableMap<Optional<EnumWorldBlockLayer>, IFlexibleBakedModel> buildModels(ImmutableMap<Optional<EnumWorldBlockLayer>, ModelResourceLocation> models, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
ImmutableMap.Builder<Optional<EnumWorldBlockLayer>, IFlexibleBakedModel> builder = ImmutableMap.builder();
for(Optional<EnumWorldBlockLayer> key : models.keySet())
{
IModel model;
try
{
model = ModelLoaderRegistry.getModel(models.get(key));
}
catch (IOException e)
{
FMLLog.log(Level.ERROR, e, "Couldn't load MultiLayerModel dependency: %s", models.get(key));
model = ModelLoaderRegistry.getMissingModel();
}
builder.put(key, model.bake(new ModelStateComposition(state, model.getDefaultState()), format, bakedTextureGetter));
}
return builder.build();
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
return new MultiLayerBakedModel(models, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state));
IModel missing = ModelLoaderRegistry.getMissingModel();
return new MultiLayerBakedModel(
buildModels(models, state, format, bakedTextureGetter),
missing.bake(missing.getDefaultState(), format, bakedTextureGetter),
format,
IPerspectiveAwareModel.MapWrapper.getTransforms(state)
);
}
@Override
@@ -103,63 +129,59 @@ public class MultiLayerModel implements IModelCustomData
public static class MultiLayerBakedModel implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel
{
private final ImmutableMap<Optional<EnumWorldBlockLayer>, ModelResourceLocation> models;
private final ImmutableMap<Optional<EnumWorldBlockLayer>, IFlexibleBakedModel> models;
private final VertexFormat format;
private final ImmutableMap<TransformType, TRSRTransformation> cameraTransforms;;
private IBakedModel missing;
private IBakedModel base;
private ImmutableMap<EnumWorldBlockLayer, IBakedModel> bakedModels;
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
private final IFlexibleBakedModel base;
private final IFlexibleBakedModel missing;
private final ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
private static final Function<ResourceLocation, TextureAtlasSprite> defaultTextureGetter = new Function<ResourceLocation, TextureAtlasSprite>()
{
public TextureAtlasSprite apply(ResourceLocation location)
{
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
}
};
@Deprecated // remove 1.9
public MultiLayerBakedModel(ImmutableMap<Optional<EnumWorldBlockLayer>, ModelResourceLocation> models, VertexFormat format, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms)
{
this(
buildModels(models, TRSRTransformation.identity(), format, defaultTextureGetter),
ModelLoaderRegistry.getMissingModel().bake(ModelLoaderRegistry.getMissingModel().getDefaultState(), format, defaultTextureGetter),
format,
cameraTransforms
);
}
public MultiLayerBakedModel(ImmutableMap<Optional<EnumWorldBlockLayer>, IFlexibleBakedModel> models, IFlexibleBakedModel missing, VertexFormat format, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms)
{
this.models = models;
this.format = format;
this.cameraTransforms = cameraTransforms;
}
private void compute()
{
if(base == null)
this.missing = missing;
if(models.containsKey(Optional.absent()))
{
ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
missing = manager.getMissingModel();
base = getModel(manager, Optional.<EnumWorldBlockLayer>absent());
ImmutableMap.Builder<EnumWorldBlockLayer, IBakedModel> builder = ImmutableMap.builder();
for(EnumWorldBlockLayer layer : EnumWorldBlockLayer.values())
{
if(models.containsKey(Optional.of(layer)))
{
builder.put(layer, getModel(manager, Optional.of(layer)));
}
}
bakedModels = builder.build();
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(Optional.<EnumFacing>absent()));
for(EnumFacing side: EnumFacing.values())
{
quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side)));
}
quads = quadBuilder.build();
base = models.get(Optional.absent());
}
}
private IBakedModel getModel(ModelManager manager, Optional<EnumWorldBlockLayer> layer)
{
ModelResourceLocation loc = models.get(layer);
if(loc == null)
else
{
loc = new ModelResourceLocation("builtin/missing", "missing");
base = missing;
}
return manager.getModel(loc);
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(models, Optional.<EnumFacing>absent()));
for(EnumFacing side: EnumFacing.values())
{
quadBuilder.put(Optional.of(side), buildQuads(models, Optional.of(side)));
}
quads = quadBuilder.build();
}
private ImmutableList<BakedQuad> buildQuads(Optional<EnumFacing> side)
private static ImmutableList<BakedQuad> buildQuads(ImmutableMap<Optional<EnumWorldBlockLayer>, IFlexibleBakedModel> models, Optional<EnumFacing> side)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(IBakedModel model : bakedModels.values())
for(IBakedModel model : models.values())
{
if(side.isPresent())
{
@@ -176,43 +198,37 @@ public class MultiLayerModel implements IModelCustomData
@Override
public List<BakedQuad> getFaceQuads(EnumFacing side)
{
compute();
return quads.get(Optional.of(side));
}
@Override
public List<BakedQuad> getGeneralQuads()
{
compute();
return quads.get(Optional.absent());
}
@Override
public boolean isAmbientOcclusion()
{
compute();
return base.isAmbientOcclusion();
}
@Override
public boolean isGui3d()
{
compute();
return base.isGui3d();
}
@Override
public boolean isBuiltInRenderer()
{
compute();
return base.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
compute();
return base.getTexture();
return base.getParticleTexture();
}
@Override
@@ -224,13 +240,12 @@ public class MultiLayerModel implements IModelCustomData
@Override
public IBakedModel handleBlockState(IBlockState state)
{
compute();
EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer();
if(!bakedModels.containsKey(layer))
Optional<EnumWorldBlockLayer> layer = Optional.of(MinecraftForgeClient.getRenderLayer());
if(!models.containsKey(layer))
{
return missing;
}
return bakedModels.get(layer);
return models.get(layer);
}
@Override
@@ -100,9 +100,9 @@ public class MultiModel implements IModel
}
@Override
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
return internalBase.getTexture();
return internalBase.getParticleTexture();
}
@Override
@@ -0,0 +1,128 @@
package net.minecraftforge.client.model;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public class MultiModelState implements IModelState
{
private final ImmutableMap<MultiModelPart, ? extends IModelState> states;
public <M extends IModel, S extends IModelState> MultiModelState(ImmutableList<Pair<M, S>> states)
{
ImmutableMap.Builder<MultiModelPart, S> builder = ImmutableMap.builder();
for(int i = 0; i < states.size(); i++)
{
Pair<M, S> pair = states.get(i);
builder.put(new MultiModelPart(pair.getLeft(), i), pair.getRight());
}
this.states = builder.build();
}
public static IModelState getPartState(IModelState state, IModel model, int index)
{
if(state.apply(Optional.of(new MultiModelPart(model, index))).isPresent())
{
return new PartState(state, model, index);
}
return state;
}
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
if(part.isPresent())
{
if(part.get() instanceof MultiModelPart)
{
MultiModelPart key = (MultiModelPart)part.get();
if(states.containsKey(key))
{
return Optional.of(states.get(key).apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity()));
}
}
else if(part.get() instanceof PartPart)
{
PartPart partPart = (PartPart)part.get();
MultiModelPart key = new MultiModelPart(partPart.model, partPart.index);
if(states.containsKey(key))
{
return states.get(key).apply(partPart.part);
}
}
}
return Optional.absent();
}
private static class PartState implements IModelState
{
private final IModelState state;
private final IModel model;
private final int index;
public PartState(IModelState state, IModel model, int index)
{
this.state = state;
this.model = model;
this.index = index;
}
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
Optional<TRSRTransformation> normal = state.apply(part);
Optional<TRSRTransformation> multi = state.apply(Optional.of(new PartPart(model, index, part)));
if(normal.isPresent() && multi.isPresent())
{
return Optional.of(normal.get().compose(multi.get()));
}
return normal.or(multi);
}
}
private static class MultiModelPart implements IModelPart
{
private final IModel model;
private final int index;
public MultiModelPart(IModel model, int index)
{
this.model = model;
this.index = index;
}
@Override
public int hashCode()
{
return Objects.hashCode(model, index);
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MultiModelPart other = (MultiModelPart)obj;
return Objects.equal(this.model, other.model) && this.index == other.index;
}
}
private static class PartPart implements IModelPart
{
private final IModel model;
private final int index;
private final Optional<? extends IModelPart> part;
public PartPart(IModel model, int index, Optional<? extends IModelPart> part)
{
this.model = model;
this.index = index;
this.part = part;
}
}
}
@@ -157,6 +157,12 @@ public class TRSRTransformation implements IModelState, ITransformation
return ret;
}
public static Vector3f toYXZDegrees(Quat4f q)
{
Vector3f yxz = toYXZ(q);
return new Vector3f((float)Math.toDegrees(yxz.x), (float)Math.toDegrees(yxz.y), (float)Math.toDegrees(yxz.z));
}
public static Vector3f toYXZ(Quat4f q)
{
float w2 = q.w * q.w;
@@ -164,19 +170,19 @@ public class TRSRTransformation implements IModelState, ITransformation
float y2 = q.y * q.y;
float z2 = q.z * q.z;
float l = w2 + x2 + y2 + z2;
float sx = 2 * q.y * q.z - 2 * q.w * q.x;
float sx = 2 * q.w * q.x - 2 * q.y * q.z;
float x = (float)Math.asin(sx / l);
if(Math.abs(sx) > .999f * l)
{
return new Vector3f(
2 * (float)Math.atan2(q.y, q.w),
x,
2 * (float)Math.atan2(q.y, q.w),
0
);
}
return new Vector3f(
(float)Math.atan2(2 * q.x * q.z + 2 * q.y * q.w, w2 - x2 - y2 + z2),
x,
(float)Math.atan2(2 * q.x * q.z + 2 * q.y * q.w, w2 - x2 - y2 + z2),
(float)Math.atan2(2 * q.x * q.y + 2 * q.w * q.z, w2 - x2 + y2 - z2)
);
}
@@ -443,7 +449,7 @@ public class TRSRTransformation implements IModelState, ITransformation
*/
public ItemTransformVec3f toItemTransform()
{
return new ItemTransformVec3f(toLwjgl(getTranslation()), toLwjgl(toYXZ(getLeftRot())), toLwjgl(getScale()));
return new ItemTransformVec3f(toLwjgl(toYXZDegrees(getLeftRot())), toLwjgl(getTranslation()), toLwjgl(getScale()));
}
public Matrix4f getMatrix()
@@ -0,0 +1,203 @@
package net.minecraftforge.client.model.animation;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import net.minecraftforge.common.util.JsonUtils;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
public enum Animation implements IResourceManagerReloadListener
{
INSTANCE;
private float clientPartialTickTime;
/**
* Get the global world time for the current tick, in seconds.
*/
public static float getWorldTime(World world)
{
return getWorldTime(world, 0);
}
/**
* Get the global world time for the current tick + partial tick progress, in seconds.
*/
public static float getWorldTime(World world, float tickProgress)
{
return (world.getTotalWorldTime() + tickProgress) / 20;
}
/**
* Get current partialTickTime.
*/
public static float getPartialTickTime()
{
return INSTANCE.clientPartialTickTime;
}
/**
* Load a new instance if AnimationStateMachine at specified location, with specified custom parameters.
*/
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> customParameters)
{
try
{
ClipResolver clipResolver = new ClipResolver();
ParameterResolver parameterResolver = new ParameterResolver(customParameters);
Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(clipResolver);
TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(parameterResolver);
IResource resource = manager.getResource(location);
AnimationStateMachine asm = asmGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), AnimationStateMachine.class);
clipResolver.asm = asm;
parameterResolver.asm = asm;
asm.initialize();
//String json = asmGson.toJson(asm);
//System.out.println(location + ": " + json);
return asm;
}
catch(IOException e)
{
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location);
return missing;
}
catch(JsonParseException e)
{
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location);
return missing;
}
finally
{
Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(null);
TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(null);
}
}
/**
* Load armature associated with a vanilla model.
*/
public ModelBlockAnimation loadVanillaAnimation(ResourceLocation armatureLocation)
{
try
{
IResource resource = null;
try
{
resource = manager.getResource(armatureLocation);
}
catch(FileNotFoundException e)
{
// this is normal. FIXME: error reporting?
return defaultModelBlockAnimation;
}
ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), ModelBlockAnimation.class);
String json = mbaGson.toJson(mba);
return mba;
}
catch(IOException e)
{
FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation);
return defaultModelBlockAnimation;
}
catch(JsonParseException e)
{
FMLLog.log(Level.ERROR, e, "Exception loading vanilla model aniamtion %s, skipping", armatureLocation);
return defaultModelBlockAnimation;
}
}
private IResourceManager manager;
private final AnimationStateMachine missing = new AnimationStateMachine(
ImmutableMap.<String, ITimeValue>of(),
ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance),
ImmutableList.of("missingno"),
ImmutableMap.<String, String>of(),
"missingno");
{
missing.initialize();
}
private final Gson asmGson = new GsonBuilder()
.registerTypeAdapter(ImmutableList.class, JsonUtils.ImmutableListTypeAdapter.INSTANCE)
.registerTypeAdapter(ImmutableMap.class, JsonUtils.ImmutableMapTypeAdapter.INSTANCE)
.registerTypeAdapterFactory(Clips.CommonClipTypeAdapterFactory.INSTANCE)
//.registerTypeAdapterFactory(ClipProviders.CommonClipProviderTypeAdapterFactory.INSTANCE)
.registerTypeAdapterFactory(TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE)
.setPrettyPrinting()
.enableComplexMapKeySerialization()
.disableHtmlEscaping()
.create();
private static final class ClipResolver implements Function<String, IClip>
{
private AnimationStateMachine asm;
public IClip apply(String name)
{
return asm.getClips().get(name);
}
}
private static final class ParameterResolver implements Function<String, ITimeValue>
{
private final ImmutableMap<String, ITimeValue> customParameters;
private AnimationStateMachine asm;
public ParameterResolver(ImmutableMap<String, ITimeValue> customParameters)
{
this.customParameters = customParameters;
}
public ITimeValue apply(String name)
{
if(asm.getParameters().containsKey(name))
{
return asm.getParameters().get(name);
}
return customParameters.get(name);
}
}
private final Gson mbaGson = new GsonBuilder()
.registerTypeAdapter(ImmutableList.class, JsonUtils.ImmutableListTypeAdapter.INSTANCE)
.registerTypeAdapter(ImmutableMap.class, JsonUtils.ImmutableMapTypeAdapter.INSTANCE)
.setPrettyPrinting()
.enableComplexMapKeySerialization()
.disableHtmlEscaping()
.create();
private final ModelBlockAnimation defaultModelBlockAnimation = new ModelBlockAnimation(ImmutableMap.<String, ImmutableMap<String, float[]>>of(), ImmutableMap.<String, ModelBlockAnimation.MBClip>of());
/**
* Iternal hook, do not use.
*/
public static void setClientPartialTickTime(float clientPartialTickTime) {
Animation.INSTANCE.clientPartialTickTime = clientPartialTickTime;
}
/**
* Iternal hook, do not use.
*/
public void onResourceManagerReload(IResourceManager manager)
{
this.manager = manager;
}
}
@@ -0,0 +1,108 @@
package net.minecraftforge.client.model.animation;
import java.util.List;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.IModelState;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.pipeline.VertexLighterFlat;
import net.minecraftforge.client.model.pipeline.WorldRendererConsumer;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
/**
* ModelBase that works with the Forge model system and animations.
* Some quirks are still left, deprecated for the moment.
*/
@Deprecated
public class AnimationModelBase<T extends Entity & IAnimationProvider> extends ModelBase implements IEventHandler<T>
{
private final VertexLighterFlat lighter;
private final IModel model;
public AnimationModelBase(IModel model, VertexLighterFlat lighter)
{
this.model = model;
this.lighter = lighter;
}
@SuppressWarnings("unchecked")
@Override
public void render(Entity entity, float limbSwing, float limbSwingSpeed, float timeAlive, float yawHead, float rotationPitch, float scale)
{
if(!(entity instanceof IAnimationProvider))
{
throw new ClassCastException("AnimationModelBase expects IAnimationProvider");
}
Pair<IModelState, Iterable<Event>> pair = ((IAnimationProvider)entity).asm().apply(timeAlive / 20);
handleEvents((T)entity, timeAlive / 20, pair.getRight());
IBakedModel bakedModel = model.bake(pair.getLeft(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
BlockPos pos = new BlockPos(entity.posX, entity.posY + entity.height, entity.posZ);
RenderHelper.disableStandardItemLighting();
GlStateManager.pushMatrix();
GlStateManager.rotate(180, 0, 0, 1);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
worldRenderer.setTranslation(-0.5, -1.5, -0.5);
lighter.setParent(new WorldRendererConsumer(worldRenderer));
lighter.setWorld(entity.worldObj);
lighter.setBlock(Blocks.air);
lighter.setBlockPos(pos);
boolean empty = true;
List<BakedQuad> quads = bakedModel.getGeneralQuads();
if(!quads.isEmpty())
{
lighter.updateBlockInfo();
empty = false;
for(BakedQuad quad : quads)
{
quad.pipe(lighter);
}
}
for(EnumFacing side : EnumFacing.values())
{
quads = bakedModel.getFaceQuads(side);
if(!quads.isEmpty())
{
if(empty) lighter.updateBlockInfo();
empty = false;
for(BakedQuad quad : quads)
{
quad.pipe(lighter);
}
}
}
// debug quad
/*worldRenderer.pos(0, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 0).lightmap(240, 0).endVertex();
worldRenderer.pos(0, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 1).lightmap(240, 0).endVertex();
worldRenderer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex();
worldRenderer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();*/
worldRenderer.setTranslation(0, 0, 0);
tessellator.draw();
GlStateManager.popMatrix();
RenderHelper.enableStandardItemLighting();
}
public void handleEvents(T instance, float time, Iterable<Event> pastEvents) {}
}
@@ -0,0 +1,169 @@
package net.minecraftforge.client.model.animation;
import java.util.concurrent.TimeUnit;
import net.minecraftforge.client.model.IModelState;
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
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.JsonParseException;
import com.google.gson.annotations.SerializedName;
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;
@SerializedName("start_state")
private final String startState;
private transient boolean shouldHandleSpecialEvents;
private transient String currentStateName;
private transient IClip currentState;
private transient float lastPollTime;
private static final LoadingCache<Triple<? extends IClip, Float, Float>, Pair<IModelState, Iterable<Event>>> clipCache = CacheBuilder.newBuilder()
.maximumSize(100)
.expireAfterWrite(100, TimeUnit.MILLISECONDS)
.build(new CacheLoader<Triple<? extends IClip, Float, Float>, Pair<IModelState, Iterable<Event>>>()
{
public Pair<IModelState, Iterable<Event>> load(Triple<? extends IClip, Float, Float> key) throws Exception
{
return Clips.apply(key.getLeft(), key.getMiddle(), key.getRight());
}
});
public AnimationStateMachine(ImmutableMap<String, ITimeValue> parameters, ImmutableMap<String, IClip> clips, ImmutableList<String> states, ImmutableMap<String, String> transitions, String startState)
{
this.parameters = parameters;
this.clips = clips;
this.states = states;
this.transitions = transitions;
this.startState = startState;
}
/**
* Used during resolution of parameter references.
*/
ImmutableMap<String, ITimeValue> getParameters()
{
return parameters;
}
/**
* Used during resolution of clip references.
*/
ImmutableMap<String, IClip> getClips()
{
return clips;
}
/**
* post-loading initialization hook.
*/
void initialize()
{
if(parameters == null)
{
throw new JsonParseException("Animation State Machine should contain \"parameters\" key.");
}
if(clips == null)
{
throw new JsonParseException("Animation State Machine should contain \"clips\" key.");
}
if(states == null)
{
throw new JsonParseException("Animation State Machine should contain \"states\" key.");
}
if(transitions == null)
{
throw new JsonParseException("Animation State Machine should contain \"transitions\" key.");
}
shouldHandleSpecialEvents = true;
lastPollTime = Float.NEGATIVE_INFINITY;
// setting the starting state
IClip state = clips.get(startState);
if(!clips.containsKey(startState) || !states.contains(startState))
{
throw new IllegalStateException("unknown state: " + startState);
}
currentStateName = startState;
currentState = state;
}
public Pair<IModelState, Iterable<Event>> apply(float time)
{
if(lastPollTime == Float.NEGATIVE_INFINITY)
{
lastPollTime = time;
}
Pair<IModelState, Iterable<Event>> pair = clipCache.getUnchecked(Triple.of(currentState, lastPollTime, time));
lastPollTime = time;
boolean shouldFilter = false;
if(shouldHandleSpecialEvents)
{
for(Event event : ImmutableList.copyOf(pair.getRight()).reverse())
{
if(event.event().startsWith("!"))
{
shouldFilter = true;
if(event.event().startsWith("!transition:"))
{
String newState = event.event().substring("!transition:".length());
transition(newState);
}
else
{
System.out.println("Unknown special event \"" + event.event() + "\", ignoring");
}
}
}
}
if(!shouldFilter)
{
return pair;
}
return Pair.of(pair.getLeft(), Iterables.filter(pair.getRight(), new Predicate<Event>()
{
public boolean apply(Event event)
{
return !event.event().startsWith("!");
}
}));
}
public void transition(String newState)
{
IClip nc = clips.get(newState);
if(!clips.containsKey(newState) || !states.contains(newState))
{
throw new IllegalStateException("unknown state: " + newState);
}
if(!transitions.get(currentStateName).equals(newState))
{
throw new IllegalArgumentException("no transition from current clip \"" + currentStateName + "\" to the clip \"" + newState + "\" found.");
}
currentStateName = newState;
currentState = nc;
}
public String currentState()
{
return currentStateName;
}
public void shouldHandleSpecialEvents(boolean value)
{
shouldHandleSpecialEvents = true;
}
}
@@ -0,0 +1,79 @@
package net.minecraftforge.client.model.animation;
import java.util.concurrent.TimeUnit;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.IModelState;
import net.minecraftforge.client.model.ISmartBlockModel;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.Properties;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
/**
* Generic TileEntitySpecialRenderer that works with the Forge model system and animations.
*/
public class AnimationTESR<T extends TileEntity & IAnimationProvider> extends FastTESR<T> implements IEventHandler<T>
{
protected static BlockRendererDispatcher blockRenderer;
protected static final LoadingCache<Pair<IExtendedBlockState, IModelState>, IBakedModel> modelCache = CacheBuilder.newBuilder().maximumSize(10).expireAfterWrite(100, TimeUnit.MILLISECONDS).build(new CacheLoader<Pair<IExtendedBlockState, IModelState>, IBakedModel>()
{
public IBakedModel load(Pair<IExtendedBlockState, IModelState> key) throws Exception
{
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(key.getLeft().getClean());
if(model instanceof ISmartBlockModel)
{
model = ((ISmartBlockModel)model).handleBlockState(key.getLeft().withProperty(Properties.AnimationProperty, key.getRight()));
}
return model;
}
});
protected static IBakedModel getModel(IExtendedBlockState state, IModelState modelState)
{
return modelCache.getUnchecked(Pair.of(state, modelState));
}
public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, WorldRenderer renderer)
{
if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockPos pos = te.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
IBlockState state = world.getBlockState(pos);
if(state.getPropertyNames().contains(Properties.StaticProperty))
{
state = state.withProperty(Properties.StaticProperty, false);
}
if(state instanceof IExtendedBlockState)
{
IExtendedBlockState exState = (IExtendedBlockState)state;
if(exState.getUnlistedNames().contains(Properties.AnimationProperty))
{
float time = Animation.getWorldTime(getWorld(), partialTick);
Pair<IModelState, Iterable<Event>> pair = te.asm().apply(time);
handleEvents(te, time, pair.getRight());
IBakedModel model = getModel(exState, pair.getLeft());
renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());
blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, renderer, false);
}
}
}
public void handleEvents(T te, float time, Iterable<Event> pastEvents) {}
}
@@ -0,0 +1,538 @@
package net.minecraftforge.client.model.animation;
import java.io.IOException;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.IModelPart;
import net.minecraftforge.client.model.IModelState;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.TRSRTransformation;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Various implementations of IClip, and utility methods.
*/
public final class Clips
{
/**
* Clip that does nothing.
*/
public static enum IdentityClip implements IClip, IStringSerializable
{
instance;
public IJointClip apply(IJoint joint)
{
return JointClips.IdentityJointClip.instance;
}
public Iterable<Event> pastEvents(float lastPollTime, float time)
{
return ImmutableSet.<Event>of();
}
public String getName()
{
return "identity";
}
}
/**
* Retrieves the clip from the model.
*/
public static IClip getModelClipNode(ResourceLocation modelLocation, String clipName)
{
IModel model;
try
{
model = ModelLoaderRegistry.getModel(modelLocation);
if(model instanceof IAnimatedModel)
{
Optional<? extends IClip> clip = ((IAnimatedModel)model).getClip(clipName);
if(clip.isPresent())
{
return new ModelClip(clip.get(), modelLocation, clipName);
}
FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation);
}
}
catch (IOException e)
{
FMLLog.getLogger().error("Unable to load model" + modelLocation + " while loading clip " + clipName, e);
}
// FIXME: missing clip?
return new ModelClip(IdentityClip.instance, modelLocation, clipName);
}
/**
* Wrapper for model clips; useful for debugging and serialization;
*/
public static final class ModelClip implements IClip
{
private final IClip childClip;
private final ResourceLocation modelLocation;
private final String clipName;
public ModelClip(IClip childClip, ResourceLocation modelLocation, String clipName)
{
this.childClip = childClip;
this.modelLocation = modelLocation;
this.clipName = clipName;
}
public IJointClip apply(IJoint joint)
{
return childClip.apply(joint);
}
public Iterable<Event> pastEvents(float lastPollTime, float time)
{
return childClip.pastEvents(lastPollTime, time);
}
@Override
public int hashCode()
{
return Objects.hashCode(modelLocation, clipName);
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ModelClip other = (ModelClip) obj;
return Objects.equal(modelLocation, other.modelLocation) && Objects.equal(clipName, other.clipName);
}
}
/**
* Clip with custom parameterization of the time.
*/
public static final class TimeClip implements IClip
{
private final IClip childClip;
private final ITimeValue time;
public TimeClip(IClip childClip, ITimeValue time)
{
this.childClip = childClip;
this.time = time;
}
public IJointClip apply(final IJoint joint)
{
return new IJointClip()
{
private final IJointClip parent = childClip.apply(joint);
public TRSRTransformation apply(float time)
{
return parent.apply(TimeClip.this.time.apply(time));
}
};
}
public Iterable<Event> pastEvents(float lastPollTime, float time)
{
return childClip.pastEvents(this.time.apply(lastPollTime), this.time.apply(time));
}
@Override
public int hashCode()
{
return Objects.hashCode(childClip, time);
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TimeClip other = (TimeClip) obj;
return Objects.equal(childClip, other.childClip) && Objects.equal(time, other.time);
}
}
/**
* Spherical linear blend between 2 clips.
*/
public static final class SlerpClip implements IClip
{
private final IClip from;
private final IClip to;
private final ITimeValue input;
private final ITimeValue progress;
public SlerpClip(IClip from, IClip to, ITimeValue input, ITimeValue progress)
{
this.from = from;
this.to = to;
this.input = input;
this.progress = progress;
}
public IJointClip apply(IJoint joint)
{
IJointClip fromClip = from.apply(joint);
IJointClip toClip = to.apply(joint);
return blendClips(joint, fromClip, toClip, input, progress);
}
public Iterable<Event> pastEvents(float lastPollTime, float time)
{
float clipLastPollTime = input.apply(lastPollTime);
float clipTime = input.apply(time);
return Iterables.mergeSorted(ImmutableSet.of(
from.pastEvents(clipLastPollTime, clipTime),
to.pastEvents(clipLastPollTime, clipTime)
), Ordering.<Event>natural());
}
@Override
public int hashCode()
{
return Objects.hashCode(from, to, input, progress);
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SlerpClip other = (SlerpClip) obj;
return Objects.equal(from, other.from) &&
Objects.equal(to, other.to) &&
Objects.equal(input, other.input) &&
Objects.equal(progress, other.progress);
}
}
/*public static class AdditiveLerpClip implements IClip
{
private final IClip base;
private final IClip add;
private final IParameter progress;
public AdditiveLerpClip(IClip base, IClip add, IParameter progress)
{
this.base = base;
this.add = add;
this.progress = progress;
}
public IJointClip apply(IJoint joint)
{
throw new NotImplementedException("AdditiveLerpClip.apply");
}
}*/
private static IJointClip blendClips(final IJoint joint, final IJointClip fromClip, final IJointClip toClip, final ITimeValue input, final ITimeValue progress)
{
return new IJointClip()
{
public TRSRTransformation apply(float time)
{
float clipTime = input.apply(time);
return fromClip.apply(clipTime).slerp(toClip.apply(clipTime), MathHelper.clamp_float(progress.apply(time), 0, 1));
}
};
}
/**
* IModelState wrapper for a Clip, sampled at specified time.
*/
public static Pair<IModelState, Iterable<Event>> apply(final IClip clip, final float lastPollTime, final float time)
{
return Pair.<IModelState, Iterable<Event>>of(new IModelState()
{
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
if(!part.isPresent() || !(part.get() instanceof IJoint))
{
return Optional.absent();
}
IJoint joint = (IJoint)part.get();
if(!joint.getParent().isPresent())
{
return Optional.of(clip.apply(joint).apply(time).compose(joint.getInvBindPose()));
}
return Optional.of(clip.apply(joint.getParent().get()).apply(time).compose(clip.apply(joint).apply(time)).compose(joint.getInvBindPose()));
}
}, clip.pastEvents(lastPollTime, time));
}
/**
* Clip + Event, triggers when parameter becomes non-negative.
*/
public static final class TriggerClip implements IClip
{
private final IClip clip;
private final ITimeValue parameter;
private final String event;
public TriggerClip(IClip clip, ITimeValue parameter, String event)
{
this.clip = clip;
this.parameter = parameter;
this.event = event;
}
public IJointClip apply(IJoint joint)
{
return clip.apply(joint);
}
public Iterable<Event> pastEvents(float lastPollTime, float time)
{
if(parameter.apply(lastPollTime) < 0 && parameter.apply(time) >= 0)
{
return Iterables.mergeSorted(ImmutableSet.of(
clip.pastEvents(lastPollTime, time),
ImmutableSet.of(new Event(event, 0))
), Ordering.<Event>natural());
}
return clip.pastEvents(lastPollTime, time);
}
}
/**
* Reference to another clip.
* Should only exist during debugging.
*/
public static final class ClipReference implements IClip, IStringSerializable
{
private final String clipName;
private final Function<String, IClip> clipResolver;
private IClip clip;
public ClipReference(String clipName, Function<String, IClip> clipResolver)
{
this.clipName = clipName;
this.clipResolver = clipResolver;
}
private void resolve()
{
if(clip == null)
{
if(clipResolver != null)
{
clip = clipResolver.apply(clipName);
}
if(clip == null)
{
throw new IllegalArgumentException("Couldn't resolve clip " + clipName);
}
}
}
public IJointClip apply(final IJoint joint)
{
resolve();
return clip.apply(joint);
}
public Iterable<Event> pastEvents(float lastPollTime, float time)
{
resolve();
return clip.pastEvents(lastPollTime, time);
}
public String getName()
{
return clipName;
}
@Override
public int hashCode()
{
resolve();
return clip.hashCode();
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ClipReference other = (ClipReference) obj;
resolve();
other.resolve();
return Objects.equal(clip, other.clip);
}
}
public static enum CommonClipTypeAdapterFactory implements TypeAdapterFactory
{
INSTANCE;
private final ThreadLocal<Function<String, IClip>> clipResolver = new ThreadLocal<Function<String, IClip>>();
public void setClipResolver(Function<String, IClip> clipResolver)
{
this.clipResolver.set(clipResolver);
}
@SuppressWarnings("unchecked")
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
{
if(type.getRawType() != IClip.class)
{
return null;
}
final TypeAdapter<ITimeValue> parameterAdapter = gson.getAdapter(ITimeValue.class);
return (TypeAdapter<T>)new TypeAdapter<IClip>()
{
public void write(JsonWriter out, IClip clip) throws IOException
{
// IdentityClip + ClipReference
if(clip instanceof IStringSerializable)
{
out.value("#" + ((IStringSerializable)clip).getName());
return;
}
else if(clip instanceof TimeClip)
{
out.beginArray();
out.value("apply");
TimeClip timeClip = (TimeClip)clip;
write(out, timeClip.childClip);
parameterAdapter.write(out, timeClip.time);
out.endArray();
return;
}
else if(clip instanceof SlerpClip)
{
out.beginArray();
out.value("slerp");
SlerpClip slerpClip = (SlerpClip)clip;
write(out, slerpClip.from);
write(out, slerpClip.to);
parameterAdapter.write(out, slerpClip.input);
parameterAdapter.write(out, slerpClip.progress);
out.endArray();
return;
}
else if(clip instanceof TriggerClip)
{
out.beginArray();
out.value("trigger_positive");
TriggerClip triggerClip = (TriggerClip)clip;
write(out, triggerClip.clip);
parameterAdapter.write(out, triggerClip.parameter);
out.value(triggerClip.event);
out.endArray();
return;
}
else if(clip instanceof ModelClip)
{
ModelClip modelClip = (ModelClip)clip;
out.value(modelClip.modelLocation + "@" + modelClip.clipName);
return;
}
// TODO custom clip writing?
throw new NotImplementedException("unknown Clip to json: " + clip);
}
public IClip read(JsonReader in) throws IOException
{
switch(in.peek())
{
case BEGIN_ARRAY:
in.beginArray();
String type = in.nextString();
IClip clip;
// TimeClip
if("apply".equals(type))
{
clip = new TimeClip(read(in), parameterAdapter.read(in));
}
else if("slerp".equals(type))
{
clip = new SlerpClip(read(in), read(in), parameterAdapter.read(in), parameterAdapter.read(in));
}
else if("trigger_positive".equals(type))
{
clip = new TriggerClip(read(in), parameterAdapter.read(in), in.nextString());
}
else
{
throw new IOException("Unknown Clip type \"" + type + "\"");
}
in.endArray();
return clip;
case STRING:
String string = in.nextString();
// IdentityClip
if(string.equals("#identity"))
{
return IdentityClip.instance;
}
// Clip reference
if(string.startsWith("#"))
{
return new ClipReference(string.substring(1), clipResolver.get());
}
// ModelClip
else
{
int at = string.lastIndexOf('@');
String location = string.substring(0, at);
String clipName = string.substring(at + 1, string.length());
ResourceLocation model;
if(location.indexOf('#') != -1)
{
model = new ModelResourceLocation(location);
}
else
{
model = new ResourceLocation(location);
}
return getModelClipNode(model, clipName);
}
default:
throw new IOException("expected Clip, got " + in.peek());
}
}
};
}
}
}
@@ -0,0 +1,46 @@
package net.minecraftforge.client.model.animation;
import com.google.common.base.Objects;
/**
* Event stored in the clip
*/
public final class Event implements Comparable<Event>
{
private final String event;
private final float offset;
public Event(String event, float offset)
{
this.event = event;
this.offset = offset;
}
/**
* @return the name of the event.
*/
public String event()
{
return event;
}
/**
* @return how long ago the event happened, relative to the next event / first query time
*/
public float offset()
{
return offset;
}
public int compareTo(Event event)
{
return new Float(offset).compareTo(event.offset);
}
@Override
public String toString()
{
return Objects.toStringHelper(getClass()).add("event", event).add("offset", offset).toString();
}
}
@@ -0,0 +1,49 @@
package net.minecraftforge.client.model.animation;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.tileentity.TileEntity;
public abstract class FastTESR<T extends TileEntity> extends TileEntitySpecialRenderer<T>
{
@Override
public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage)
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
this.bindTexture(TextureMap.locationBlocksTexture);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableBlend();
GlStateManager.disableCull();
if (Minecraft.isAmbientOcclusionEnabled())
{
GlStateManager.shadeModel(GL11.GL_SMOOTH);
}
else
{
GlStateManager.shadeModel(GL11.GL_FLAT);
}
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, worldRenderer);
worldRenderer.setTranslation(0, 0, 0);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
}
@Override
public abstract void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, WorldRenderer worldRenderer);
}
@@ -0,0 +1,13 @@
package net.minecraftforge.client.model.animation;
import net.minecraftforge.client.model.IModel;
import com.google.common.base.Optional;
/**
* IModel that has animation data.
*/
public interface IAnimatedModel extends IModel
{
Optional<? extends IClip> getClip(String name);
}
@@ -0,0 +1,12 @@
package net.minecraftforge.client.model.animation;
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
/**
* Something that can provide the Animation State Machine, for example and Entity or a Block
*/
public interface IAnimationProvider
{
public IAnimationStateMachine asm();
}
@@ -0,0 +1,12 @@
package net.minecraftforge.client.model.animation;
/**
* Clip for a rigged model.
*/
public interface IClip
{
IJointClip apply(IJoint joint);
Iterable<Event> pastEvents(float lastPollTime, float time);
}
@@ -0,0 +1,10 @@
package net.minecraftforge.client.model.animation;
/**
* Handler for animation events;
*/
public interface IEventHandler<T>
{
void handleEvents(T instance, float time, Iterable<Event> pastEvents);
}
@@ -0,0 +1,16 @@
package net.minecraftforge.client.model.animation;
import com.google.common.base.Optional;
import net.minecraftforge.client.model.IModelPart;
import net.minecraftforge.client.model.TRSRTransformation;
/**
* Model part that's a part of the hierarchical skeleton.
*/
public interface IJoint extends IModelPart
{
TRSRTransformation getInvBindPose();
Optional<? extends IJoint> getParent();
}
@@ -0,0 +1,11 @@
package net.minecraftforge.client.model.animation;
import net.minecraftforge.client.model.TRSRTransformation;
/**
* Returns Local joint pose; animation clip for specific model part.
*/
public interface IJointClip
{
TRSRTransformation apply(float time);
}
Loaded 100 of 225 files, more files were not shown because too many files have changed in this diff. Show more