mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-21 06:36:25 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
099bee8d5d | ||
|
|
5a926ffa23 | ||
|
|
d7d32a186b | ||
|
|
f437b7a7ff | ||
|
|
ff4ef2d90b | ||
|
|
5fb39bba2b | ||
|
|
e4798e6793 | ||
|
|
ce6ef64cec | ||
|
|
9999a04692 | ||
|
|
6901f3e43d | ||
|
|
3b94b6660c | ||
|
|
dc46c96ecf | ||
|
|
55861a249e | ||
|
|
f00a569d9d | ||
|
|
aaa5484752 | ||
|
|
c6e82ebfb9 | ||
|
|
365844ae2e | ||
|
|
c18c1f39fb | ||
|
|
1fd2aa06ae | ||
|
|
931852bd36 | ||
|
|
272f429f59 | ||
|
|
6a5c6d2b17 | ||
|
|
618453caaa | ||
|
|
e1d048ec9d | ||
|
|
26ebd23d14 | ||
|
|
b446415200 | ||
|
|
ed8fe19dc1 | ||
|
|
e674b042d0 | ||
|
|
53abb58ae6 | ||
|
|
17fed9662c | ||
|
|
74dd2a6c0d | ||
|
|
7505ce15e3 | ||
|
|
30ba97ea69 | ||
|
|
5fee2df9f7 | ||
|
|
238c7474b3 | ||
|
|
5da5c72b4f | ||
|
|
0604b45b9d | ||
|
|
132a43c5c7 | ||
|
|
b1e8f9cfb6 | ||
|
|
a166a38c4b | ||
|
|
57fa6a58d5 | ||
|
|
95006ae327 | ||
|
|
ad6fc97eef | ||
|
|
fc39baaa30 | ||
|
|
887ff8ccdb | ||
|
|
4d6117f5bf | ||
|
|
3dc26639a5 | ||
|
|
252f9d5dbd | ||
|
|
599b8c5eec | ||
|
|
974f839d61 | ||
|
|
b4ea13ab20 | ||
|
|
06afb04050 | ||
|
|
92c3d9464b | ||
|
|
03ed8f3edd | ||
|
|
b475b02fff | ||
|
|
8c462f1567 | ||
|
|
e668735dd8 | ||
|
|
f0e65fe4de | ||
|
|
084a7bfb3c | ||
|
|
3c11a673dc | ||
|
|
deb2cff477 | ||
|
|
79d89852d4 | ||
|
|
8d38144551 | ||
|
|
a21a172be3 | ||
|
|
b44e5c797e | ||
|
|
ae9337c84a | ||
|
|
5db2c4c955 | ||
|
|
8af1225c90 | ||
|
|
4b181d75c8 | ||
|
|
9e28dce3d7 | ||
|
|
39f084bd56 | ||
|
|
c82bba7872 | ||
|
|
3f557d9ae6 | ||
|
|
c15976a936 | ||
|
|
c8652b519a | ||
|
|
67c828dd0c | ||
|
|
10a1bc6bc6 | ||
|
|
e4db065a85 | ||
|
|
171cd45e32 | ||
|
|
d638315fb1 | ||
|
|
980fa6a13d | ||
|
|
267faf9397 | ||
|
|
7549d77ad7 | ||
|
|
0f6929dd5e | ||
|
|
79597a81fe | ||
|
|
e54e822c3a | ||
|
|
5e60bb525c | ||
|
|
c49cb45892 | ||
|
|
e0a896377e | ||
|
|
b96638226c | ||
|
|
7c025582e0 | ||
|
|
623dfbb78b | ||
|
|
942bf8247e | ||
|
|
d6a991e81e | ||
|
|
5d5de4f2f3 | ||
|
|
7e952295a5 | ||
|
|
d299cad9db | ||
|
|
261408d542 | ||
|
|
cde163c1d1 | ||
|
|
dbc478fc89 | ||
|
|
dde6c1dc97 | ||
|
|
41d7740374 | ||
|
|
29f0c6f7bc | ||
|
|
d128d3e025 | ||
|
|
422bd5a0de | ||
|
|
65271dc1b1 | ||
|
|
8a604fdefe | ||
|
|
a525df98cd | ||
|
|
6a5c52ca0e | ||
|
|
57509b6bba | ||
|
|
0a4b7fe5c8 | ||
|
|
45f72e0e9e | ||
|
|
029e152d95 | ||
|
|
08d6fa00eb | ||
|
|
35bb803fb0 | ||
|
|
ec028c89e4 | ||
|
|
1de8a40bae | ||
|
|
8c682356bb | ||
|
|
e817675abc | ||
|
|
49ebd740b6 | ||
|
|
a96b550618 | ||
|
|
b1431b1be1 | ||
|
|
19400a71f2 | ||
|
|
87661224da | ||
|
|
92dc6fefe0 | ||
|
|
f7adaa6100 | ||
|
|
7381ef6a02 | ||
|
|
a54acc48e7 | ||
|
|
5478db4e32 | ||
|
|
c99b1503cb | ||
|
|
8ede54739b | ||
|
|
921f3796c1 | ||
|
|
225d170ee3 | ||
|
|
5e3479eb8f | ||
|
|
13379eb8d0 | ||
|
|
47f05d0b37 | ||
|
|
5f6bfa03aa | ||
|
|
83ac0388d6 | ||
|
|
454c2b368a | ||
|
|
4395514376 | ||
|
|
5f55cbb5d3 | ||
|
|
a8f7141c14 | ||
|
|
eba32fbf60 | ||
|
|
57a3ad9c9b | ||
|
|
40c2c843a2 | ||
|
|
b20db43afa | ||
|
|
e81c025152 | ||
|
|
39a9c60a84 | ||
|
|
dd3787896b | ||
|
|
80ddbaf50c | ||
|
|
62c9654f97 | ||
|
|
98b5d69d01 | ||
|
|
87f0811c2b | ||
|
|
dfa104d8cf | ||
|
|
6ff53c0be3 | ||
|
|
ec58079b4f | ||
|
|
7c3cf3f498 | ||
|
|
a7c0a911e3 | ||
|
|
fee8634661 | ||
|
|
68a517332f | ||
|
|
088159bab2 | ||
|
|
6682049be1 | ||
|
|
fa2bbdbb10 | ||
|
|
b78bdd727f | ||
|
|
610e197236 | ||
|
|
27ee34573d | ||
|
|
e4bd024567 | ||
|
|
e41d94b5dc | ||
|
|
00ae3841db | ||
|
|
b0a54a408f | ||
|
|
a34735891a | ||
|
|
17552017f9 | ||
|
|
d90cd5b9a8 | ||
|
|
33fe1a7c32 | ||
|
|
17096f3bb7 | ||
|
|
81f733e89f | ||
|
|
fac7419225 | ||
|
|
69d174b6a6 | ||
|
|
d66f534b95 | ||
|
|
6f342045f4 | ||
|
|
726aeac836 | ||
|
|
f01c5a5ceb | ||
|
|
5876d83147 | ||
|
|
ae1a55fa98 | ||
|
|
417fefa911 | ||
|
|
e30cc3dce8 | ||
|
|
63f721bc9b | ||
|
|
27248fd17d | ||
|
|
c198aee827 | ||
|
|
a8c6d58499 | ||
|
|
9e748cc9cf | ||
|
|
5890918e04 | ||
|
|
c0567ac11f | ||
|
|
5036e334dc | ||
|
|
9f798cddf5 | ||
|
|
eb2828e0a4 | ||
|
|
53f127fc23 | ||
|
|
c463bb6e06 | ||
|
|
4e9d45d38c | ||
|
|
4e2f7d3bc5 | ||
|
|
8975b099ad | ||
|
|
308380706a | ||
|
|
ef80924526 | ||
|
|
fadf57046d | ||
|
|
13cedaaf73 | ||
|
|
0a0806716b | ||
|
|
af59cb5e58 | ||
|
|
c0f8e37206 | ||
|
|
e64aaf66ab | ||
|
|
a946dfea1f | ||
|
|
f2c459cc06 | ||
|
|
6f12f53e85 | ||
|
|
073ee8e283 | ||
|
|
d3a5ad8efa | ||
|
|
62a2dcc606 | ||
|
|
a7f71eb437 | ||
|
|
b65dab7f30 | ||
|
|
ac76878002 | ||
|
|
fe219e52e6 | ||
|
|
bfd28ec9b0 | ||
|
|
1063441b0e | ||
|
|
4e89f45253 | ||
|
|
2798f73397 | ||
|
|
56aa5ae8d8 | ||
|
|
156a7a70eb | ||
|
|
3b13b9f246 | ||
|
|
0a8d920285 | ||
|
|
f5418a8088 | ||
|
|
cae097bf2c | ||
|
|
f760003c3a | ||
|
|
38f70c5960 | ||
|
|
81b00d7f85 | ||
|
|
948ceeaa8d | ||
|
|
1eda446897 | ||
|
|
49d03c0336 | ||
|
|
c5d254cca7 | ||
|
|
4f7fda1e96 | ||
|
|
d3e10cb570 | ||
|
|
51d7d2cb04 | ||
|
|
6d52b8f690 | ||
|
|
ac53d2da95 | ||
|
|
17e41f5f0b | ||
|
|
4bd70698ce | ||
|
|
23b750d5e9 | ||
|
|
ab2b67c426 | ||
|
|
d68c912ca6 | ||
|
|
c391d1a5e0 | ||
|
|
0af39118eb | ||
|
|
392b69937f | ||
|
|
e32af733f1 | ||
|
|
e1509c9dab | ||
|
|
1cb6baee59 | ||
|
|
9403cb6296 | ||
|
|
fd157fae4f | ||
|
|
b1c804d567 | ||
|
|
b386d1a806 | ||
|
|
01ea8daedf | ||
|
|
9ca472ccaf | ||
|
|
13b7e0d418 | ||
|
|
a6ddc1e4ae | ||
|
|
a5b1b87ec5 | ||
|
|
b3255045fa | ||
|
|
90f3acebac | ||
|
|
0da91fb255 | ||
|
|
ba3b26ac74 | ||
|
|
966761776d | ||
|
|
24f07c58a0 | ||
|
|
a8b5f649a8 | ||
|
|
295c73ae69 | ||
|
|
899bdb38ac | ||
|
|
f30e5bda1e | ||
|
|
76c870b472 | ||
|
|
963448e173 | ||
|
|
48d2fc6e2e | ||
|
|
5868d39431 | ||
|
|
c47b3a21db | ||
|
|
0d12fb1f1c | ||
|
|
78c7188a11 | ||
|
|
ff5f63a998 | ||
|
|
b9a8a9be11 | ||
|
|
2046482252 | ||
|
|
6a737999a9 | ||
|
|
89d37e583b | ||
|
|
a449396dc3 | ||
|
|
ed3b0e9630 |
+98
-11
@@ -1,4 +1,91 @@
|
||||
# Changelog
|
||||
## [1.4.1](#1-4-1)
|
||||
|
||||
### Changes
|
||||
- Slightly lowered the volume of all cries
|
||||
- Updated Pokeball animations and model.
|
||||
- Turtwig can now be put on shoulder.
|
||||
- Updated Zubat line model, texture, and animations.
|
||||
- Added animations for Hitmontop, Tyrogue, and Mightyena.
|
||||
- Tweaked animations for Dusknoir, Ratatta, Bewear, Exeggutor, and Alolan Exeggutor.
|
||||
- Sized Kantonian Exeggutor down. Still big but not TOO BIG.
|
||||
- Tweaked cries for Pikachu, Raichu and Alolan Raichu.
|
||||
- Pasture blocks will now also connect their bottom left and right sides to walls, iron bars, glass panes and any other modded block that follows the same connection rules.
|
||||
- The config option `consumeHeldItems` has been removed, please see the Datapack & Resourcepack Creators for instructions on the updated method.
|
||||
- Using Potions, Status Heals, Ethers, and Antidotes will now return a glass bottle
|
||||
- Using a Remedy, Fine Remedy, or Superb Remedy will no longer lower friendship with a Pokémon
|
||||
- The Healing Machine now has a more difficult recipe, placing it later game.
|
||||
- Heal Powder can now be composted with a 75% chance of adding a layer
|
||||
- Mental, Power, White, and Mirror Herbs can now be composted with a 100% chance of adding a layer.
|
||||
- Added emissive to Hoothoot.
|
||||
- Mining Evolution Stone Ores with a Fortune pickaxe will now increase the amount of items recieved
|
||||
- Black Augurite can now be used to craft stone axes and obsidian.
|
||||
- Using Experience Candies brings up the Party Pokémon Select screen when not targeting a Pokémon.
|
||||
- Added tab completion for statuses to commands
|
||||
|
||||
### Additions
|
||||
- Added battle spectating, can disable in config
|
||||
- Cobblemon now has compatibility with [Adorn](https://modrinth.com/mod/adorn) allowing you to craft Apricorn wood furniture.
|
||||
- Berries can now be used in recipes from [Farmer's Delight](https://modrinth.com/mod/farmers-delight) and [Farmer's Delight (Fabric)](https://modrinth.com/mod/farmers-delight-fabric), as well as any other mods using the same berry tags.
|
||||
- The nature of cobblemon will now be displayed italicized when a mint has been applied. Hovering over the nature will display the mint that was applied. This is the intended behaviour, because the original nature and taste of the Cobblemon does not change when a mint is applied.
|
||||
- Giving Pokémon items now plays a sound
|
||||
- A boat, sign and hanging sign is now craftable with Apricorn wood. The recipes are the same shape as Minecraft's equivalent with Apricorn planks as replacements.
|
||||
- Added the [Cleanse Tag](https://wiki.cobblemon.com/index.php/Cleanse_Tag) and [Fairy Feather](https://wiki.cobblemon.com/index.php/Fairy_Feather)
|
||||
- Added Fairy Feather drops to some pokemon
|
||||
- Added the Inferno, Void, and Forsaken patterns for Vivillon. These can be obtained by evolving a Spewpa in the Nether, End, or Deep Dark respectively.
|
||||
- Added the Litwick line.
|
||||
- Bees can now be fed using Pep-Up Flowers.
|
||||
- Mooshtank can now be milked with a bowl for Mushroom Stew.
|
||||
- Added cries to Beldum, Metang and Metagross.
|
||||
|
||||
### Fixes
|
||||
- Fixed various stone related blocks not being valid for Big Roots to spread on the Fabric version.
|
||||
- Updated the registration of compostable items to improve compatibility with Fabric forks such as Quilt. Please note this does not mean we officially support Quilt, this change was only done since it was possible by correcting the registration to use the new intended way in the Fabric API.
|
||||
- Fixed Dispensers being unable to shear grown Apricorns.
|
||||
- Fixed Bowl not being given back to player after using Berry Juice
|
||||
- Added context for -fail and -block handlers for battle text and added 16 related battle texts for them
|
||||
- Fixed Battle text for Disable, Laser Focus, Foresight, Fire Spin, Telekinesis, Curse, Recharge and Encore
|
||||
- Fixed missing text for snowy weather in battles
|
||||
- Fixed missing text for attempting to catch an uncatchable Pokémon
|
||||
- Fixed Moonphases for Clefairy line
|
||||
- Fixed issue where Potions, Super Potions, and Hyper Potions did not work during battle
|
||||
- Fixed the compatibility patch with the Forge version of [Carry On](https://modrinth.com/mod/carry-on) due to a bug on the mod, the Fabric version was unchanged and is still compatible.
|
||||
- Added the ability to place Berries on modded Farmland blocks.
|
||||
- Shouldered Pokémon now hop off when selected in team and r is pressed. This also is in effect in battles leading to shouldered Pokémon jumping of the shoulder of the trainer when it is their turn.
|
||||
- Made more items compostable and changed the process for making items compostable.
|
||||
- Added the ability for Hoppers to fill Brewing Stands with Medicinal Brews and Potions.
|
||||
- Apricorn blocks are now flammable.
|
||||
- The default pose for Pokémon being passengers is now "standing".
|
||||
- Fixed issue where some IVs were changing every player relog.
|
||||
- Fixed cursed battle message
|
||||
- Fixed mistakes in pokemon spawning JSONs
|
||||
- Fixed advancement crash from bad datapack evolution data.
|
||||
- Fixed global influences being applied to TickingSpawners twice.
|
||||
- Reverted the default SpawningSelector back to FlatContextWeightedSelector. This fixes multiple weight related issues, including weights with SpawningInfluences.
|
||||
- Apricorn Planting advancement should work again.
|
||||
- Advancement "Patterned Wings" should now allow High Plains and Icy Snow Vivillon to register.
|
||||
- Fixed the last battle critical hits evolution requirement not working.
|
||||
- Fixed the damage taken evolution requirement not saving progress.
|
||||
- Fixed the defeated Pokémon evolution requirement not saving progress.
|
||||
- Fixed potion brewing recipes not showing up JEI and similar mods on the Forge version.
|
||||
- Fixed an exploit that could convert a single piece of Blaze Powder into an extra Medicinal Brew on the Forge version.
|
||||
- Fixed an issue where health percentages would show incorrectly after healing
|
||||
- Fixed the move Revival Blessing not allowing you to select from fainted party members.
|
||||
- Fixed Exeggcute faint.
|
||||
- Fixed Raticate, Onix, Unfezant, Bergmite, Avalugg, Boltund and Revavroom cries not playing.
|
||||
- Fixed Alolan Ratticate animations causing a crash.
|
||||
- Fixed Quaxwell not doing its cry.
|
||||
- Fixed Shroomish not using its idle.
|
||||
- Fixed a possible visual duplication of sent out Pokémon.
|
||||
|
||||
### Developer
|
||||
- Fixed the `SpawnEvent` not respecting usage of `Cancelable#cancel`.
|
||||
- Added the `EvolutionTestedEvent`, this allows listening and overriding the final result of evolution requirement tests.
|
||||
- The `HeldItemManager` has a new method `shouldConsumeItem`, this will return false by default to prevent breaking changes, see the documentation and update your implementations as needed.
|
||||
|
||||
### Datapack & Resourcepack Creators
|
||||
- Added 3 new item tags: `cobblemon:held/consumed_in_npc_battle`, `cobblemon:held/consumed_in_pvp_battle` & `cobblemon:held/consumed_in_wild_battle` these will determine which items get consumed in the implied battle types by Cobblemon, keep in mind the controller for this behaviour can be overriden by 3rd party.
|
||||
|
||||
## [1.4.0 - The Friends and Farms Update (October 13th, 2023)](#1-4-0)
|
||||
### Additions
|
||||
- Added pasture blocks, used to let your PC Pokémon roam around an area.
|
||||
@@ -406,7 +493,7 @@
|
||||
- Species and FormData have had their evolutions, pre-evolution and labels properties exposed. It is still recommended to work using a Pokémon instance when possible.
|
||||
- Added capture check to BattleVictoryEvent.
|
||||
- The various hardcoded potion shoulder effects have been removed, make use of PotionBaseEffect.
|
||||
- Added ContextManager for tracking causes and contexts of conditions created during a battle. See BattleContext for types of conditions that are tracked.
|
||||
- Added ContextManager for tracking causes and contexts of conditions created during a battle. See BattleContext for types of conditions that are tracked.
|
||||
- Added MongoDB support for storing Pokémon and Player data. Must be enabled in config, requires MongoDB core and sync drivers (4.10.0+).
|
||||
- CobblemonShowdown updated to version 10.
|
||||
- Generation of a battle can be set in BattleFormat.
|
||||
@@ -786,17 +873,17 @@
|
||||
- Fixed spawning in several biome tag categories.
|
||||
- Fixed resource pack support for Pokémon models and textures.
|
||||
- **Model Fixes**
|
||||
- Fixed Paras and Nidoqueen looking very weird.
|
||||
- Fixed Hitmonchan asserting dominance with a T-pose as well as Grimer and Muk pointing their hands to the sky.
|
||||
- Fixed specific Pokémon suddenly pausing their animation after staying still for a long time.
|
||||
- Fixed Mankey's feet being buried in the ground.
|
||||
- Updated the Substitute model and updated its shiny texture to be better for the red-green colorblind.
|
||||
- Improved Horsea, Seadra, and Kingdra animations, especially on land.
|
||||
- Fixed Paras and Nidoqueen looking very weird.
|
||||
- Fixed Hitmonchan asserting dominance with a T-pose as well as Grimer and Muk pointing their hands to the sky.
|
||||
- Fixed specific Pokémon suddenly pausing their animation after staying still for a long time.
|
||||
- Fixed Mankey's feet being buried in the ground.
|
||||
- Updated the Substitute model and updated its shiny texture to be better for the red-green colorblind.
|
||||
- Improved Horsea, Seadra, and Kingdra animations, especially on land.
|
||||
- **Battle Fixes**
|
||||
- Fixed an issue with battles where Pokémon had a different max HP causing some desync issues with the health bars.
|
||||
- Fixed Magnitude battle messages.
|
||||
- Moves that are disabled or out of PP now show transparently in the battle GUI instead of being hidden completely.
|
||||
- Statuses like sleep and frozen no longer last forever if it was carried over from a previous battle.
|
||||
- Fixed an issue with battles where Pokémon had a different max HP causing some desync issues with the health bars.
|
||||
- Fixed Magnitude battle messages.
|
||||
- Moves that are disabled or out of PP now show transparently in the battle GUI instead of being hidden completely.
|
||||
- Statuses like sleep and frozen no longer last forever if it was carried over from a previous battle.
|
||||
|
||||
### Localization
|
||||
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
|
||||
|
||||
@@ -19,6 +19,7 @@ architectury {
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
@@ -31,6 +32,7 @@ dependencies {
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
modApi(libs.molang)
|
||||
compileOnlyApi(libs.jeiApi)
|
||||
modCompileOnly(libs.adornFabric)
|
||||
|
||||
// For Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.mixin;
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonBlocks;
|
||||
import com.cobblemon.mod.common.block.PastureBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FenceBlock;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = FenceBlock.class)
|
||||
public abstract class FenceBlockMixin {
|
||||
|
||||
// This could be done with a modify variable but it just doesn't seem to want to work, very crude unfinished explanation I had on Fabric discord was
|
||||
// "boolean is a primitive, it isnt passed by reference but by value and you have your own object references anyway so assigning a new object to non-primitive references (variables) wont modify it after your mixin returns
|
||||
//(you cant modify a random argument that mixin passes you that way, target the boolean not the FenceBlock)"
|
||||
// However the issue is the only way to get all the params which we need is by passing in the entire method reference which enforces the return type.
|
||||
|
||||
@Redirect(method = "getStateForNeighborUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/FenceBlock;canConnect(Lnet/minecraft/block/BlockState;ZLnet/minecraft/util/math/Direction;)Z"))
|
||||
private boolean cobblemon$getStateForNeighborUpdate(FenceBlock instance, BlockState state, boolean neighborIsFullSquare, Direction dir) {
|
||||
return instance.canConnect(state, neighborIsFullSquare, dir) || this.cobblemon$canConnect(state, dir);
|
||||
}
|
||||
|
||||
@Redirect(method = "getPlacementState", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/FenceBlock;canConnect(Lnet/minecraft/block/BlockState;ZLnet/minecraft/util/math/Direction;)Z"))
|
||||
private boolean cobblemon$getPlacementState(FenceBlock instance, BlockState state, boolean neighborIsFullSquare, Direction dir) {
|
||||
return instance.canConnect(state, neighborIsFullSquare, dir) || this.cobblemon$canConnect(state, dir);
|
||||
}
|
||||
|
||||
private boolean cobblemon$canConnect(BlockState state, Direction dir) {
|
||||
if (state.isOf(CobblemonBlocks.PASTURE) && state.get(PastureBlock.Companion.getPART()) == PastureBlock.PasturePart.BOTTOM) {
|
||||
final Direction pastureFacing = state.get(HorizontalFacingBlock.FACING);
|
||||
return dir == pastureFacing.rotateYClockwise() || dir == pastureFacing.rotateYCounterclockwise();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.mixin;
|
||||
|
||||
import com.cobblemon.mod.common.api.spawning.mixins.CachedOnlyChunkAccessor;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import net.minecraft.server.world.ChunkHolder;
|
||||
import net.minecraft.server.world.ServerChunkManager;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkManager;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Mixin(ServerChunkManager.class)
|
||||
public abstract class ServerChunkManagerMixin extends ChunkManager implements CachedOnlyChunkAccessor {
|
||||
@Shadow @Nullable protected abstract ChunkHolder getChunkHolder(long pos);
|
||||
|
||||
@Override
|
||||
public Chunk cobblemon$request(int x, int z, @NotNull ChunkStatus status) {
|
||||
long l = ChunkPos.toLong(x, z);
|
||||
|
||||
ChunkHolder holder = getChunkHolder(l);
|
||||
if (holder != null) {
|
||||
CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>> future = holder.getFutureFor(status);
|
||||
if (future.isDone()) {
|
||||
return future.join().left().orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+8
-11
@@ -6,21 +6,18 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.forge.mixin.accessor;
|
||||
package com.cobblemon.mod.common.mixin.accessor;
|
||||
|
||||
import net.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.LootTable;
|
||||
import net.minecraft.loot.function.LootFunction;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(LootTable.Builder.class)
|
||||
public interface LootTableBuilderAccessor {
|
||||
@Accessor
|
||||
List<LootPool> getPools();
|
||||
@Mixin(BoatEntity.class)
|
||||
public interface BoatEntityAccessor {
|
||||
|
||||
@Accessor
|
||||
List<LootFunction> getFunctions();
|
||||
void setFallVelocity(double fallVelocity);
|
||||
|
||||
@Accessor
|
||||
BoatEntity.Location getLocation();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.mixin.invoker;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import net.minecraft.block.FireBlock;
|
||||
import net.minecraft.block.Blocks;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(FireBlock.class)
|
||||
public interface FireBlockInvoker {
|
||||
@Invoker("registerFlammableBlock") void registerNewFlammableBlock(Block block, int burnChance, int spreadChance);
|
||||
}
|
||||
@@ -8,10 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common
|
||||
|
||||
import com.cobblemon.mod.common.block.entity.BerryBlockEntity
|
||||
import com.cobblemon.mod.common.block.entity.HealingMachineBlockEntity
|
||||
import com.cobblemon.mod.common.block.entity.PCBlockEntity
|
||||
import com.cobblemon.mod.common.block.entity.PokemonPastureBlockEntity
|
||||
import com.cobblemon.mod.common.block.entity.*
|
||||
import com.cobblemon.mod.common.platform.PlatformRegistry
|
||||
import net.minecraft.block.entity.BlockEntityType
|
||||
import net.minecraft.registry.Registries
|
||||
@@ -31,5 +28,9 @@ object CobblemonBlockEntities : PlatformRegistry<Registry<BlockEntityType<*>>, R
|
||||
val BERRY = this.create("berry", BlockEntityType.Builder.create(::BerryBlockEntity, *CobblemonBlocks.berries().values.toTypedArray()).build(null))
|
||||
@JvmField
|
||||
val PASTURE: BlockEntityType<PokemonPastureBlockEntity> = this.create("pasture", BlockEntityType.Builder.create(::PokemonPastureBlockEntity, CobblemonBlocks.PASTURE).build(null))
|
||||
@JvmField
|
||||
val SIGN: BlockEntityType<CobblemonSignBlockEntity> = this.create("sign", BlockEntityType.Builder.create(::CobblemonSignBlockEntity, CobblemonBlocks.APRICORN_SIGN, CobblemonBlocks.APRICORN_WALL_SIGN).build(null))
|
||||
@JvmField
|
||||
val HANGING_SIGN: BlockEntityType<CobblemonHangingSignBlockEntity> = this.create("hanging_sign", BlockEntityType.Builder.create(::CobblemonHangingSignBlockEntity, CobblemonBlocks.APRICORN_HANGING_SIGN, CobblemonBlocks.APRICORN_WALL_HANGING_SIGN).build(null))
|
||||
|
||||
}
|
||||
@@ -19,6 +19,10 @@ import com.cobblemon.mod.common.mixin.invoker.*
|
||||
import com.cobblemon.mod.common.platform.PlatformRegistry
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.block.BerryBlock
|
||||
import com.cobblemon.mod.common.block.sign.CobblemonHangingSignBlock
|
||||
import com.cobblemon.mod.common.block.sign.CobblemonSignBlock
|
||||
import com.cobblemon.mod.common.block.sign.CobblemonWallHangingSignBlock
|
||||
import com.cobblemon.mod.common.block.sign.CobblemonWallSignBlock
|
||||
import net.minecraft.block.*
|
||||
import net.minecraft.block.piston.PistonBehavior
|
||||
import net.minecraft.entity.effect.StatusEffects
|
||||
@@ -33,6 +37,8 @@ import net.minecraft.util.math.intprovider.UniformIntProvider
|
||||
@Suppress("SameParameterValue", "HasPlatformType", "MemberVisibilityCanBePrivate", "unused")
|
||||
object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<Block>>, Block>() {
|
||||
|
||||
|
||||
|
||||
override val registry: Registry<Block> = Registries.BLOCK
|
||||
override val registryKey: RegistryKey<Registry<Block>> = RegistryKeys.BLOCK
|
||||
|
||||
@@ -105,9 +111,14 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
|
||||
val APRICORN_BUTTON = this.create("apricorn_button", BlocksInvoker.createWoodenButtonBlock(BlockSetType.OAK))
|
||||
@JvmField
|
||||
val APRICORN_PRESSURE_PLATE = this.create("apricorn_pressure_plate", PressurePlateBlockInvoker.`cobblemon$create`(PressurePlateBlock.ActivationRule.EVERYTHING, AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD), APRICORN_BLOCK_SET_TYPE))
|
||||
// Tag was removed be sure to add it back when implemented
|
||||
//val APRICORN_SIGN = queue("apricorn_sign") { StandingSignBlock(AbstractBlock.Settings.of(Material.WOOD).noCollission().strength(1.0f).sounds(BlockSoundGroup.WOOD), APRICORN_WOOD_TYPE) }
|
||||
//val APRICORN_WALL_SIGN = queue("apricorn_wall_sign") { WallSignBlock(AbstractBlock.Settings.of(Material.WOOD).noCollission().strength(1.0f).sounds(BlockSoundGroup.WOOD).dropsLike(APRICORN_SIGN), APRICORN_WOOD_TYPE) }
|
||||
@JvmField
|
||||
val APRICORN_SIGN = this.create("apricorn_sign", CobblemonSignBlock(AbstractBlock.Settings.copy(Blocks.OAK_SIGN), APRICORN_WOOD_TYPE))
|
||||
@JvmField
|
||||
val APRICORN_WALL_SIGN = this.create("apricorn_wall_sign", CobblemonWallSignBlock(AbstractBlock.Settings.copy(Blocks.OAK_WALL_SIGN), APRICORN_WOOD_TYPE))
|
||||
@JvmField
|
||||
val APRICORN_HANGING_SIGN = this.create("apricorn_hanging_sign", CobblemonHangingSignBlock(AbstractBlock.Settings.copy(Blocks.OAK_WALL_HANGING_SIGN), APRICORN_WOOD_TYPE))
|
||||
@JvmField
|
||||
val APRICORN_WALL_HANGING_SIGN = this.create("apricorn_wall_hanging_sign", CobblemonWallHangingSignBlock(AbstractBlock.Settings.copy(Blocks.OAK_HANGING_SIGN), APRICORN_WOOD_TYPE))
|
||||
@JvmField
|
||||
val APRICORN_SLAB = this.create("apricorn_slab", SlabBlock(AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
|
||||
@JvmField
|
||||
@@ -228,6 +239,8 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
|
||||
APRICORN_LOG to STRIPPED_APRICORN_LOG
|
||||
)
|
||||
|
||||
|
||||
|
||||
private fun apricornBlock(name: String, apricorn: Apricorn): ApricornBlock = this.create(name, ApricornBlock(AbstractBlock.Settings.create().mapColor(apricorn.mapColor()).ticksRandomly().strength(Blocks.OAK_LOG.hardness, Blocks.OAK_LOG.blastResistance).sounds(BlockSoundGroup.WOOD).nonOpaque(), apricorn))
|
||||
|
||||
private val berries = mutableMapOf<Identifier, BerryBlock>()
|
||||
@@ -302,6 +315,25 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
|
||||
val WIKI_BERRY = this.berryBlock("wiki")
|
||||
val YACHE_BERRY = this.berryBlock("yache")
|
||||
|
||||
init {
|
||||
/**
|
||||
* Makes all blocks in array flammable by adding them to FireBlock's flammableRegistry.
|
||||
* second value is burn chance and third value is spread chance
|
||||
*/
|
||||
arrayOf(
|
||||
Triple(APRICORN_LOG, 5, 5),
|
||||
Triple(STRIPPED_APRICORN_LOG, 5, 5),
|
||||
Triple(APRICORN_WOOD, 5, 5),
|
||||
Triple(STRIPPED_APRICORN_WOOD, 5, 5),
|
||||
Triple(APRICORN_PLANKS, 5, 20),
|
||||
Triple(APRICORN_LEAVES, 30, 60),
|
||||
Triple(APRICORN_FENCE, 5, 20),
|
||||
Triple(APRICORN_FENCE_GATE, 5, 20),
|
||||
Triple(APRICORN_SLAB, 5, 20),
|
||||
Triple(APRICORN_STAIRS, 5, 20)
|
||||
).onEach{ data -> setFlammable(data.first, data.second, data.third) }
|
||||
}
|
||||
|
||||
fun berries() = this.berries.toMap()
|
||||
|
||||
private fun berryBlock(name: String): BerryBlock {
|
||||
@@ -312,14 +344,28 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for creating logs
|
||||
* copied over from Vanilla
|
||||
* Calls helper method from Vanilla
|
||||
*/
|
||||
private fun log(name: String, arg: MapColor = MapColor.DIRT_BROWN, arg2: MapColor = MapColor.DIRT_BROWN): PillarBlock {
|
||||
val block = BlocksInvoker.createLogBlock(arg, arg2)
|
||||
return this.create(name, block)
|
||||
}
|
||||
|
||||
/**
|
||||
* Method uses generic E in order to keep the block as the same return type.
|
||||
* If E is not a block then it will not be set as flammable.
|
||||
* Calls Vanilla implementation of registering a flammable block.
|
||||
* Mixins looks cursed but it is java's fault.
|
||||
*/
|
||||
private fun <E> setFlammable(block: E, burnChance: Int, spreadChance: Int): E {
|
||||
if(block !is Block) return block
|
||||
|
||||
var fireBlock: FireBlock = Blocks.FIRE as FireBlock
|
||||
//Cursed Mixin stuff
|
||||
(fireBlock as FireBlockInvoker).registerNewFlammableBlock(block as Block, burnChance, spreadChance)
|
||||
return block
|
||||
}
|
||||
|
||||
private fun evolutionStoneOre(name: String) = this.create(name, ExperienceDroppingBlock(AbstractBlock.Settings.copy(Blocks.IRON_ORE), UniformIntProvider.create(1, 2)))
|
||||
|
||||
private fun deepslateEvolutionStoneOre(name: String) = this.create(name, ExperienceDroppingBlock(AbstractBlock.Settings.copy(Blocks.DEEPSLATE_IRON_ORE), UniformIntProvider.create(1, 2)))
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common
|
||||
|
||||
import java.util.function.Supplier
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
import net.minecraft.block.entity.BlockEntityType
|
||||
@@ -19,11 +18,14 @@ import net.minecraft.client.particle.ParticleFactory
|
||||
import net.minecraft.client.particle.SpriteProvider
|
||||
import net.minecraft.client.render.RenderLayer
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer
|
||||
import net.minecraft.entity.Entity
|
||||
import net.minecraft.entity.EntityType
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.particle.ParticleEffect
|
||||
import net.minecraft.particle.ParticleType
|
||||
import net.minecraft.resource.SynchronousResourceReloader
|
||||
import java.util.function.Supplier
|
||||
|
||||
interface CobblemonClientImplementation {
|
||||
fun registerLayer(modelLayer: EntityModelLayer, supplier: Supplier<TexturedModelData>)
|
||||
@@ -38,5 +40,7 @@ interface CobblemonClientImplementation {
|
||||
|
||||
fun registerBlockColors(provider: BlockColorProvider, vararg blocks: Block)
|
||||
|
||||
fun <T : BlockEntity> registerBlockEntityRenderer(type: BlockEntityType<T>, factory: BlockEntityRendererFactory<T>)
|
||||
fun <T : BlockEntity> registerBlockEntityRenderer(type: BlockEntityType<out T>, factory: BlockEntityRendererFactory<T>)
|
||||
|
||||
fun <T : Entity> registerEntityRenderer(type: EntityType<out T>, factory: EntityRendererFactory<T>)
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
package com.cobblemon.mod.common
|
||||
|
||||
import com.cobblemon.mod.common.api.pokeball.PokeBalls
|
||||
import com.cobblemon.mod.common.entity.boat.CobblemonBoatEntity
|
||||
import com.cobblemon.mod.common.entity.boat.CobblemonChestBoatEntity
|
||||
import com.cobblemon.mod.common.entity.pokeball.EmptyPokeBallEntity
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.platform.PlatformRegistry
|
||||
@@ -45,6 +47,24 @@ object CobblemonEntities : PlatformRegistry<Registry<EntityType<*>>, RegistryKey
|
||||
.build(EMPTY_POKEBALL_KEY.toString())
|
||||
)
|
||||
|
||||
@JvmField
|
||||
val BOAT_KEY = cobblemonResource("boat")
|
||||
@JvmField
|
||||
val BOAT: EntityType<CobblemonBoatEntity> = this.create(
|
||||
BOAT_KEY.path,
|
||||
EntityType.Builder.create(::CobblemonBoatEntity, SpawnGroup.MISC).setDimensions(1.375F, 0.5625F).maxTrackingRange(10)
|
||||
.build(BOAT_KEY.toString())
|
||||
)
|
||||
|
||||
@JvmField
|
||||
val CHEST_BOAT_KEY = cobblemonResource("chest_boat")
|
||||
@JvmField
|
||||
val CHEST_BOAT: EntityType<CobblemonChestBoatEntity> = this.create(
|
||||
CHEST_BOAT_KEY.path,
|
||||
EntityType.Builder.create(::CobblemonChestBoatEntity, SpawnGroup.MISC).setDimensions(1.375F, 0.5625F).maxTrackingRange(10)
|
||||
.build(CHEST_BOAT_KEY.toString())
|
||||
)
|
||||
|
||||
fun registerAttributes(consumer: (EntityType<out LivingEntity>, DefaultAttributeContainer.Builder) -> Unit) {
|
||||
consumer(POKEMON, PokemonEntity.createAttributes())
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
|
||||
import com.mojang.brigadier.arguments.ArgumentType
|
||||
import kotlin.reflect.KClass
|
||||
import net.minecraft.advancement.criterion.Criterion
|
||||
import net.minecraft.block.ComposterBlock
|
||||
import net.minecraft.command.argument.serialize.ArgumentSerializer
|
||||
import net.minecraft.item.ItemConvertible
|
||||
import net.minecraft.network.PacketByteBuf
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener
|
||||
import net.minecraft.network.packet.Packet
|
||||
@@ -26,6 +28,7 @@ import net.minecraft.resource.ResourceReloader
|
||||
import net.minecraft.resource.ResourceType
|
||||
import net.minecraft.server.MinecraftServer
|
||||
import net.minecraft.server.network.ServerPlayerEntity
|
||||
import net.minecraft.text.Text
|
||||
import net.minecraft.util.Identifier
|
||||
import net.minecraft.world.GameRules
|
||||
import net.minecraft.world.biome.Biome
|
||||
@@ -169,6 +172,44 @@ interface CobblemonImplementation {
|
||||
* @param manager The [ResourceManager] to reload from.
|
||||
*/
|
||||
fun <T> reloadJsonRegistry(registry: JsonDataRegistry<T>, manager: ResourceManager): HashMap<Identifier, T>
|
||||
|
||||
/**
|
||||
* Registers an item to the [ComposterBlock].
|
||||
*
|
||||
* @param item The [ItemConvertible] being registered.
|
||||
* @param chance The chance % of increasing the composter level, 0 to 1 expected.
|
||||
*/
|
||||
fun registerCompostable(item: ItemConvertible, chance: Float)
|
||||
|
||||
/**
|
||||
* Registers a builtin resource pack.
|
||||
*
|
||||
* @param id The unique [Identifier] of this pack.
|
||||
* @param title The title displayed in the resource pack GUI, the description is still a part of the pack metadata.
|
||||
* @param activationBehaviour The [ResourcePackActivationBehaviour] for this pack.
|
||||
*/
|
||||
fun registerBuiltinResourcePack(id: Identifier, title: Text, activationBehaviour: ResourcePackActivationBehaviour)
|
||||
|
||||
}
|
||||
|
||||
enum class ResourcePackActivationBehaviour {
|
||||
|
||||
/**
|
||||
* The resource pack will start disabled.
|
||||
*/
|
||||
NORMAL,
|
||||
|
||||
/**
|
||||
* The resource pack will start enabled.
|
||||
*/
|
||||
DEFAULT_ENABLED,
|
||||
|
||||
/**
|
||||
* The resource pack will always be enabled.
|
||||
* The user can reorder it but cannot remove it.
|
||||
*/
|
||||
ALWAYS_ENABLED;
|
||||
|
||||
}
|
||||
|
||||
enum class ModAPI {
|
||||
|
||||
@@ -14,7 +14,9 @@ import com.cobblemon.mod.common.api.pokemon.Natures
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.api.pokemon.status.Statuses
|
||||
import com.cobblemon.mod.common.block.BerryBlock
|
||||
import com.cobblemon.mod.common.block.MintBlock
|
||||
import com.cobblemon.mod.common.block.MintBlock.MintType
|
||||
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
|
||||
import com.cobblemon.mod.common.item.*
|
||||
import com.cobblemon.mod.common.item.battle.DireHitItem
|
||||
import com.cobblemon.mod.common.item.battle.GuardSpecItem
|
||||
@@ -32,7 +34,6 @@ import com.cobblemon.mod.common.pokeball.PokeBall
|
||||
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.ComposterBlock
|
||||
import net.minecraft.entity.LivingEntity
|
||||
import net.minecraft.entity.effect.StatusEffectInstance
|
||||
import net.minecraft.entity.effect.StatusEffects
|
||||
@@ -117,40 +118,40 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
val CHERISH_BALL = pokeBallItem(PokeBalls.CHERISH_BALL)
|
||||
|
||||
@JvmField
|
||||
val VIVICHOKE = create("vivichoke", Item(Item.Settings()))
|
||||
val VIVICHOKE = compostableItem("vivichoke")
|
||||
|
||||
@JvmField
|
||||
val VIVICHOKE_SEEDS = create("vivichoke_seeds", VivichokeItem(CobblemonBlocks.VIVICHOKE_SEEDS))
|
||||
val VIVICHOKE_SEEDS = compostableItem("vivichoke_seeds", VivichokeItem(CobblemonBlocks.VIVICHOKE_SEEDS))
|
||||
|
||||
@JvmField
|
||||
val RED_APRICORN = create("red_apricorn", ApricornItem(CobblemonBlocks.RED_APRICORN))
|
||||
val RED_APRICORN = apricornItem("red", ApricornItem(CobblemonBlocks.RED_APRICORN))
|
||||
@JvmField
|
||||
val YELLOW_APRICORN = create("yellow_apricorn", ApricornItem(CobblemonBlocks.YELLOW_APRICORN))
|
||||
val YELLOW_APRICORN = apricornItem("yellow", ApricornItem(CobblemonBlocks.YELLOW_APRICORN))
|
||||
@JvmField
|
||||
val GREEN_APRICORN = create("green_apricorn", ApricornItem(CobblemonBlocks.GREEN_APRICORN))
|
||||
val GREEN_APRICORN = apricornItem("green", ApricornItem(CobblemonBlocks.GREEN_APRICORN))
|
||||
@JvmField
|
||||
val BLUE_APRICORN = create("blue_apricorn", ApricornItem(CobblemonBlocks.BLUE_APRICORN))
|
||||
val BLUE_APRICORN = apricornItem("blue", ApricornItem(CobblemonBlocks.BLUE_APRICORN))
|
||||
@JvmField
|
||||
val PINK_APRICORN = create("pink_apricorn", ApricornItem(CobblemonBlocks.PINK_APRICORN))
|
||||
val PINK_APRICORN = apricornItem("pink", ApricornItem(CobblemonBlocks.PINK_APRICORN))
|
||||
@JvmField
|
||||
val BLACK_APRICORN = create("black_apricorn", ApricornItem(CobblemonBlocks.BLACK_APRICORN))
|
||||
val BLACK_APRICORN = apricornItem("black", ApricornItem(CobblemonBlocks.BLACK_APRICORN))
|
||||
@JvmField
|
||||
val WHITE_APRICORN = create("white_apricorn", ApricornItem(CobblemonBlocks.WHITE_APRICORN))
|
||||
val WHITE_APRICORN = apricornItem("white", ApricornItem(CobblemonBlocks.WHITE_APRICORN))
|
||||
|
||||
@JvmField
|
||||
val RED_APRICORN_SEED = create("red_apricorn_seed", ApricornSeedItem(CobblemonBlocks.RED_APRICORN_SAPLING))
|
||||
val RED_APRICORN_SEED = apricornSeedItem("red", ApricornSeedItem(CobblemonBlocks.RED_APRICORN_SAPLING))
|
||||
@JvmField
|
||||
val YELLOW_APRICORN_SEED = create("yellow_apricorn_seed", ApricornSeedItem(CobblemonBlocks.YELLOW_APRICORN_SAPLING))
|
||||
val YELLOW_APRICORN_SEED = apricornSeedItem("yellow", ApricornSeedItem(CobblemonBlocks.YELLOW_APRICORN_SAPLING))
|
||||
@JvmField
|
||||
val GREEN_APRICORN_SEED = create("green_apricorn_seed", ApricornSeedItem(CobblemonBlocks.GREEN_APRICORN_SAPLING))
|
||||
val GREEN_APRICORN_SEED = apricornSeedItem("green", ApricornSeedItem(CobblemonBlocks.GREEN_APRICORN_SAPLING))
|
||||
@JvmField
|
||||
val BLUE_APRICORN_SEED = create("blue_apricorn_seed", ApricornSeedItem(CobblemonBlocks.BLUE_APRICORN_SAPLING))
|
||||
val BLUE_APRICORN_SEED = apricornSeedItem("blue", ApricornSeedItem(CobblemonBlocks.BLUE_APRICORN_SAPLING))
|
||||
@JvmField
|
||||
val PINK_APRICORN_SEED = create("pink_apricorn_seed", ApricornSeedItem(CobblemonBlocks.PINK_APRICORN_SAPLING))
|
||||
val PINK_APRICORN_SEED = apricornSeedItem("pink", ApricornSeedItem(CobblemonBlocks.PINK_APRICORN_SAPLING))
|
||||
@JvmField
|
||||
val BLACK_APRICORN_SEED = create("black_apricorn_seed", ApricornSeedItem(CobblemonBlocks.BLACK_APRICORN_SAPLING))
|
||||
val BLACK_APRICORN_SEED = apricornSeedItem("black", ApricornSeedItem(CobblemonBlocks.BLACK_APRICORN_SAPLING))
|
||||
@JvmField
|
||||
val WHITE_APRICORN_SEED = create("white_apricorn_seed", ApricornSeedItem(CobblemonBlocks.WHITE_APRICORN_SAPLING))
|
||||
val WHITE_APRICORN_SEED = apricornSeedItem("white", ApricornSeedItem(CobblemonBlocks.WHITE_APRICORN_SAPLING))
|
||||
|
||||
@JvmField
|
||||
val APRICORN_LOG = blockItem("apricorn_log", CobblemonBlocks.APRICORN_LOG)
|
||||
@@ -163,13 +164,11 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
@JvmField
|
||||
val APRICORN_PLANKS = blockItem("apricorn_planks", CobblemonBlocks.APRICORN_PLANKS)
|
||||
@JvmField
|
||||
val APRICORN_LEAVES = blockItem("apricorn_leaves", CobblemonBlocks.APRICORN_LEAVES).also {
|
||||
val compostChance = ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.getFloat(Items.OAK_LEAVES)
|
||||
// Should always pass unless Mojang reworks leaves to no longer work in the Composter, in that case we already updated w.o doing anything
|
||||
if (compostChance != ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.defaultReturnValue()) {
|
||||
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE[it] = compostChance
|
||||
}
|
||||
}
|
||||
val APRICORN_LEAVES = compostableBlockItem("apricorn_leaves", CobblemonBlocks.APRICORN_LEAVES)
|
||||
@JvmField
|
||||
val APRICORN_BOAT = create("apricorn_boat", CobblemonBoatItem(CobblemonBoatType.APRICORN, false, Item.Settings().maxCount(1)))
|
||||
@JvmField
|
||||
val APRICORN_CHEST_BOAT = create("apricorn_chest_boat", CobblemonBoatItem(CobblemonBoatType.APRICORN, true, Item.Settings().maxCount(1)))
|
||||
|
||||
@JvmField
|
||||
val APRICORN_DOOR = blockItem("apricorn_door", CobblemonBlocks.APRICORN_DOOR)
|
||||
@@ -183,12 +182,14 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
val APRICORN_BUTTON = blockItem("apricorn_button", CobblemonBlocks.APRICORN_BUTTON)
|
||||
@JvmField
|
||||
val APRICORN_PRESSURE_PLATE = blockItem("apricorn_pressure_plate", CobblemonBlocks.APRICORN_PRESSURE_PLATE)
|
||||
//@JvmField
|
||||
// val APRICORN_SIGN = create("apricorn_sign", SignItem(Item.Properties().stacksTo(16).tab(CreativeModeTab.TAB_DECORATIONS), CobblemonBlocks.APRICORN_SIGN, CobblemonBlocks.APRICORN_WALL_SIGN))
|
||||
@JvmField
|
||||
val APRICORN_SLAB = blockItem("apricorn_slab", CobblemonBlocks.APRICORN_SLAB)
|
||||
@JvmField
|
||||
val APRICORN_STAIRS = blockItem("apricorn_stairs", CobblemonBlocks.APRICORN_STAIRS)
|
||||
@JvmField
|
||||
val APRICORN_SIGN = this.create("apricorn_sign", SignItem(Item.Settings().maxCount(16), CobblemonBlocks.APRICORN_SIGN, CobblemonBlocks.APRICORN_WALL_SIGN))
|
||||
@JvmField
|
||||
val APRICORN_HANGING_SIGN = this.create("apricorn_hanging_sign", HangingSignItem(CobblemonBlocks.APRICORN_HANGING_SIGN, CobblemonBlocks.APRICORN_WALL_HANGING_SIGN, Item.Settings().maxCount(16)))
|
||||
|
||||
@JvmField
|
||||
val HEALING_MACHINE = blockItem("healing_machine", CobblemonBlocks.HEALING_MACHINE)
|
||||
@@ -353,11 +354,11 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
}
|
||||
})
|
||||
@JvmField
|
||||
val ENERGY_ROOT = create("energy_root", EnergyRootItem(CobblemonBlocks.ENERGY_ROOT, Item.Settings().food(FoodComponent.Builder().hunger(1).snack().saturationModifier(0.2f).build())))
|
||||
val ENERGY_ROOT = compostableItem("energy_root", EnergyRootItem(CobblemonBlocks.ENERGY_ROOT, Item.Settings().food(FoodComponent.Builder().hunger(1).snack().saturationModifier(0.2f).build())))
|
||||
@JvmField
|
||||
val REVIVAL_HERB = create("revival_herb", RevivalHerbItem(CobblemonBlocks.REVIVAL_HERB))
|
||||
val REVIVAL_HERB = compostableItem("revival_herb", RevivalHerbItem(CobblemonBlocks.REVIVAL_HERB))
|
||||
@JvmField
|
||||
val PEP_UP_FLOWER = blockItem("pep_up_flower", CobblemonBlocks.PEP_UP_FLOWER)
|
||||
val PEP_UP_FLOWER = compostableBlockItem("pep_up_flower", CobblemonBlocks.PEP_UP_FLOWER)
|
||||
@JvmField
|
||||
val MEDICINAL_BREW = create("medicinal_brew", Item(Item.Settings()))
|
||||
@JvmField
|
||||
@@ -392,72 +393,74 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
val PP_MAX = create("pp_max", PPUpItem(3))
|
||||
|
||||
@JvmField
|
||||
val RED_MINT_SEEDS = blockItem("red_mint_seeds", MintType.RED.getCropBlock())
|
||||
val RED_MINT_SEEDS = mintSeed("red", MintType.RED.getCropBlock())
|
||||
@JvmField
|
||||
val RED_MINT_LEAF = create("red_mint_leaf", MintLeafItem(MintType.RED))
|
||||
val RED_MINT_LEAF = mintLeaf("red", MintLeafItem(MintType.RED))
|
||||
@JvmField
|
||||
val BLUE_MINT_SEEDS = blockItem("blue_mint_seeds", MintType.BLUE.getCropBlock())
|
||||
val BLUE_MINT_SEEDS = mintSeed("blue", MintType.BLUE.getCropBlock())
|
||||
@JvmField
|
||||
val BLUE_MINT_LEAF = create("blue_mint_leaf", MintLeafItem(MintType.BLUE))
|
||||
val BLUE_MINT_LEAF = mintLeaf("blue", MintLeafItem(MintType.BLUE))
|
||||
@JvmField
|
||||
val CYAN_MINT_SEEDS = blockItem("cyan_mint_seeds", MintType.CYAN.getCropBlock())
|
||||
val CYAN_MINT_SEEDS = mintSeed("cyan", MintType.CYAN.getCropBlock())
|
||||
@JvmField
|
||||
val CYAN_MINT_LEAF = create("cyan_mint_leaf", MintLeafItem(MintType.CYAN))
|
||||
val CYAN_MINT_LEAF = mintLeaf("cyan", MintLeafItem(MintType.CYAN))
|
||||
@JvmField
|
||||
val PINK_MINT_SEEDS = blockItem("pink_mint_seeds", MintType.PINK.getCropBlock())
|
||||
val PINK_MINT_SEEDS = mintSeed("pink", MintType.PINK.getCropBlock())
|
||||
@JvmField
|
||||
val PINK_MINT_LEAF = create("pink_mint_leaf", MintLeafItem(MintType.PINK))
|
||||
val PINK_MINT_LEAF = mintLeaf("pink", MintLeafItem(MintType.PINK))
|
||||
@JvmField
|
||||
val GREEN_MINT_SEEDS = blockItem("green_mint_seeds", MintType.GREEN.getCropBlock())
|
||||
val GREEN_MINT_SEEDS = mintSeed("green", MintType.GREEN.getCropBlock())
|
||||
@JvmField
|
||||
val GREEN_MINT_LEAF = create("green_mint_leaf", MintLeafItem(MintType.GREEN))
|
||||
val GREEN_MINT_LEAF = mintLeaf("green", MintLeafItem(MintType.GREEN))
|
||||
@JvmField
|
||||
val WHITE_MINT_SEEDS = blockItem("white_mint_seeds", MintType.WHITE.getCropBlock())
|
||||
val WHITE_MINT_SEEDS = mintSeed("white", MintType.WHITE.getCropBlock())
|
||||
@JvmField
|
||||
val WHITE_MINT_LEAF = create("white_mint_leaf", MintLeafItem(MintType.WHITE))
|
||||
val WHITE_MINT_LEAF = mintLeaf("white", MintLeafItem(MintType.WHITE))
|
||||
|
||||
val mints = mutableMapOf<String, MintItem>()
|
||||
|
||||
@JvmField
|
||||
val LONELY_MINT = create("lonely_mint", MintItem(Natures.LONELY))
|
||||
val LONELY_MINT = mintItem("lonely_mint", MintItem(Natures.LONELY))
|
||||
@JvmField
|
||||
val ADAMANT_MINT = create("adamant_mint", MintItem(Natures.ADAMANT))
|
||||
val ADAMANT_MINT = mintItem("adamant_mint", MintItem(Natures.ADAMANT))
|
||||
@JvmField
|
||||
val NAUGHTY_MINT = create("naughty_mint", MintItem(Natures.NAUGHTY))
|
||||
val NAUGHTY_MINT = mintItem("naughty_mint", MintItem(Natures.NAUGHTY))
|
||||
@JvmField
|
||||
val BRAVE_MINT = create("brave_mint", MintItem(Natures.BRAVE))
|
||||
val BRAVE_MINT = mintItem("brave_mint", MintItem(Natures.BRAVE))
|
||||
@JvmField
|
||||
val BOLD_MINT = create("bold_mint", MintItem(Natures.BOLD))
|
||||
val BOLD_MINT = mintItem("bold_mint", MintItem(Natures.BOLD))
|
||||
@JvmField
|
||||
val IMPISH_MINT = create("impish_mint", MintItem(Natures.IMPISH))
|
||||
val IMPISH_MINT = mintItem("impish_mint", MintItem(Natures.IMPISH))
|
||||
@JvmField
|
||||
val LAX_MINT = create("lax_mint", MintItem(Natures.LAX))
|
||||
val LAX_MINT = mintItem("lax_mint", MintItem(Natures.LAX))
|
||||
@JvmField
|
||||
val RELAXED_MINT = create("relaxed_mint", MintItem(Natures.RELAXED))
|
||||
val RELAXED_MINT = mintItem("relaxed_mint", MintItem(Natures.RELAXED))
|
||||
@JvmField
|
||||
val MODEST_MINT = create("modest_mint", MintItem(Natures.MODEST))
|
||||
val MODEST_MINT = mintItem("modest_mint", MintItem(Natures.MODEST))
|
||||
@JvmField
|
||||
val MILD_MINT = create("mild_mint", MintItem(Natures.MILD))
|
||||
val MILD_MINT = mintItem("mild_mint", MintItem(Natures.MILD))
|
||||
@JvmField
|
||||
val RASH_MINT = create("rash_mint", MintItem(Natures.RASH))
|
||||
val RASH_MINT = mintItem("rash_mint", MintItem(Natures.RASH))
|
||||
@JvmField
|
||||
val QUIET_MINT = create("quiet_mint", MintItem(Natures.QUIET))
|
||||
val QUIET_MINT = mintItem("quiet_mint", MintItem(Natures.QUIET))
|
||||
@JvmField
|
||||
val CALM_MINT = create("calm_mint", MintItem(Natures.CALM))
|
||||
val CALM_MINT = mintItem("calm_mint", MintItem(Natures.CALM))
|
||||
@JvmField
|
||||
val GENTLE_MINT = create("gentle_mint", MintItem(Natures.GENTLE))
|
||||
val GENTLE_MINT = mintItem("gentle_mint", MintItem(Natures.GENTLE))
|
||||
@JvmField
|
||||
val CAREFUL_MINT = create("careful_mint", MintItem(Natures.CAREFUL))
|
||||
val CAREFUL_MINT = mintItem("careful_mint", MintItem(Natures.CAREFUL))
|
||||
@JvmField
|
||||
val SASSY_MINT = create("sassy_mint", MintItem(Natures.SASSY))
|
||||
val SASSY_MINT = mintItem("sassy_mint", MintItem(Natures.SASSY))
|
||||
@JvmField
|
||||
val TIMID_MINT = create("timid_mint", MintItem(Natures.TIMID))
|
||||
val TIMID_MINT = mintItem("timid_mint", MintItem(Natures.TIMID))
|
||||
@JvmField
|
||||
val HASTY_MINT = create("hasty_mint", MintItem(Natures.HASTY))
|
||||
val HASTY_MINT = mintItem("hasty_mint", MintItem(Natures.HASTY))
|
||||
@JvmField
|
||||
val JOLLY_MINT = create("jolly_mint", MintItem(Natures.JOLLY))
|
||||
val JOLLY_MINT = mintItem("jolly_mint", MintItem(Natures.JOLLY))
|
||||
@JvmField
|
||||
val NAIVE_MINT = create("naive_mint", MintItem(Natures.NAIVE))
|
||||
val NAIVE_MINT = mintItem("naive_mint", MintItem(Natures.NAIVE))
|
||||
@JvmField
|
||||
val SERIOUS_MINT = create("serious_mint", MintItem(Natures.SERIOUS))
|
||||
val SERIOUS_MINT = mintItem("serious_mint", MintItem(Natures.SERIOUS))
|
||||
|
||||
@JvmField val X_ACCURACY = create("x_${Stats.ACCURACY.identifier.path}", XStatItem(Stats.ACCURACY))
|
||||
@JvmField val X_ATTACK = create("x_${Stats.ATTACK.identifier.path}", XStatItem(Stats.ATTACK))
|
||||
@@ -568,10 +571,14 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
@JvmField
|
||||
val CHOICE_SPECS = heldItem("choice_specs")
|
||||
@JvmField
|
||||
val CLEANSE_TAG = heldItem("cleanse_tag")
|
||||
@JvmField
|
||||
val DRAGON_FANG = heldItem("dragon_fang")
|
||||
@JvmField
|
||||
val EXP_SHARE = heldItem("exp_share")
|
||||
@JvmField
|
||||
val FAIRY_FEATHER = heldItem("fairy_feather")
|
||||
@JvmField
|
||||
val FOCUS_BAND = heldItem("focus_band")
|
||||
@JvmField
|
||||
val HARD_STONE = heldItem("hard_stone")
|
||||
@@ -616,18 +623,20 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
@JvmField
|
||||
val WISE_GLASSES = heldItem("wise_glasses")
|
||||
@JvmField
|
||||
val MENTAL_HERB = heldItem("mental_herb")
|
||||
val MENTAL_HERB = compostableHeldItem("mental_herb", null, 1F)
|
||||
@JvmField
|
||||
val MIRROR_HERB = heldItem("mirror_herb")
|
||||
val MIRROR_HERB = compostableHeldItem("mirror_herb", null, 1F)
|
||||
@JvmField
|
||||
val POWER_HERB = heldItem("power_herb")
|
||||
val POWER_HERB = compostableHeldItem("power_herb", null, 1F)
|
||||
@JvmField
|
||||
val WHITE_HERB = heldItem("white_herb")
|
||||
val WHITE_HERB = compostableHeldItem("white_herb", null, 1F)
|
||||
@JvmField
|
||||
val BRIGHT_POWDER = heldItem("bright_powder")
|
||||
@JvmField
|
||||
val METAL_POWDER = heldItem("metal_powder")
|
||||
@JvmField
|
||||
val LIGHT_POWDER = heldItem("light_powder")
|
||||
@JvmField
|
||||
val QUICK_POWDER = heldItem("quick_powder")
|
||||
@JvmField
|
||||
val DESTINY_KNOT = heldItem("destiny_knot")
|
||||
@@ -645,6 +654,104 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
val POWER_LENS = heldItem("power_lens")
|
||||
@JvmField
|
||||
val POWER_WEIGHT = heldItem("power_weight")
|
||||
@JvmField
|
||||
val ABSORB_BULB = heldItem("absorb_bulb")
|
||||
@JvmField
|
||||
val ELECTRIC_SEED = heldItem("electric_seed")
|
||||
@JvmField
|
||||
val GRASSY_SEED = heldItem("grassy_seed")
|
||||
@JvmField
|
||||
val MISTY_SEED = heldItem("misty_seed")
|
||||
@JvmField
|
||||
val PSYCHIC_SEED = heldItem("psychic_seed")
|
||||
@JvmField
|
||||
val FLOAT_STONE = heldItem("float_stone")
|
||||
@JvmField
|
||||
val GRIP_CLAW = heldItem("grip_claw")
|
||||
@JvmField
|
||||
val LIGHT_BALL = heldItem("light_ball")
|
||||
@JvmField
|
||||
val SHED_SHELL = heldItem("shed_shell")
|
||||
@JvmField
|
||||
val STICKY_BARB = heldItem("sticky_barb")
|
||||
@JvmField
|
||||
val ABILITY_SHIELD = heldItem("ability_shield")
|
||||
@JvmField
|
||||
val AIR_BALLOON = heldItem("air_balloon")
|
||||
@JvmField
|
||||
val AMULET_COIN = heldItem("amulet_coin")
|
||||
@JvmField
|
||||
val BINDING_BAND = heldItem("binding_band")
|
||||
@JvmField
|
||||
val BLUNDER_POLICY = heldItem("blunder_policy")
|
||||
@JvmField
|
||||
val CELL_BATTERY = heldItem("cell_battery")
|
||||
@JvmField
|
||||
val CLEAR_AMULET = heldItem("clear_amulet")
|
||||
@JvmField
|
||||
val COVERT_CLOAK = heldItem("covert_cloak")
|
||||
@JvmField
|
||||
val EJECT_BUTTON = heldItem("eject_button")
|
||||
@JvmField
|
||||
val EJECT_PACK = heldItem("eject_pack")
|
||||
@JvmField
|
||||
val EXPERT_BELT = heldItem("expert_belt")
|
||||
@JvmField
|
||||
val FLAME_ORB = heldItem("flame_orb")
|
||||
@JvmField
|
||||
val FOCUS_SASH = heldItem("focus_sash")
|
||||
@JvmField
|
||||
val LAGGING_TAIL = heldItem("lagging_tail")
|
||||
@JvmField
|
||||
val LIFE_ORB = heldItem("life_orb")
|
||||
@JvmField
|
||||
val LOADED_DICE = heldItem("loaded_dice")
|
||||
@JvmField
|
||||
val LUMINOUS_MOSS = heldItem("luminous_moss")
|
||||
@JvmField
|
||||
val METRONOME = heldItem("metronome")
|
||||
@JvmField
|
||||
val PROTECTIVE_PADS = heldItem("protective_pads")
|
||||
@JvmField
|
||||
val PUNCHING_GLOVE = heldItem("punching_glove")
|
||||
@JvmField
|
||||
val RED_CARD = heldItem("red_card")
|
||||
@JvmField
|
||||
val RING_TARGET = heldItem("ring_target")
|
||||
@JvmField
|
||||
val ROOM_SERVICE = heldItem("room_service")
|
||||
@JvmField
|
||||
val SCOPE_LENS = heldItem("scope_lens")
|
||||
@JvmField
|
||||
val SHELL_BELL = heldItem("shell_bell")
|
||||
@JvmField
|
||||
val SOOTHE_BELL = heldItem("soothe_bell")
|
||||
@JvmField
|
||||
val TERRAIN_EXTRUDER = heldItem("terrain_extruder")
|
||||
@JvmField
|
||||
val THROAT_SPRAY = heldItem("throat_spray")
|
||||
@JvmField
|
||||
val TOXIC_ORB = heldItem("toxic_orb")
|
||||
@JvmField
|
||||
val UTILITY_UMBRELLA = heldItem("utility_umbrella")
|
||||
@JvmField
|
||||
val WEAKNESS_POLICY = heldItem("weakness_policy")
|
||||
@JvmField
|
||||
val WIDE_LENS = heldItem("wide_lens")
|
||||
@JvmField
|
||||
val ZOOM_LENS = heldItem("zoom_lens")
|
||||
@JvmField
|
||||
val IRON_BALL = heldItem("iron_ball")
|
||||
@JvmField
|
||||
val SMOKE_BALL = heldItem("smoke_ball")
|
||||
@JvmField
|
||||
val HEAT_ROCK = heldItem("heat_rock")
|
||||
@JvmField
|
||||
val DAMP_ROCK = heldItem("damp_rock")
|
||||
@JvmField
|
||||
val SMOOTH_ROCK = heldItem("smooth_rock")
|
||||
@JvmField
|
||||
val ICY_ROCK = heldItem("icy_rock")
|
||||
|
||||
// Mulch
|
||||
@JvmField
|
||||
@@ -696,9 +803,12 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
}
|
||||
)
|
||||
|
||||
private fun compostable(item: Item, increaseLevelChance: Float) = Cobblemon.implementation.registerCompostable(item, increaseLevelChance)
|
||||
|
||||
private fun berryItem(name: String, berryBlock: BerryBlock): BerryItem {
|
||||
val finalName = "${name}_berry"
|
||||
val item = this.create(finalName, BerryItem(berryBlock))
|
||||
compostable(item, .65f)
|
||||
this.berries[cobblemonResource(finalName)] = item
|
||||
return item
|
||||
}
|
||||
@@ -706,7 +816,62 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
private fun berryItem(name: String, berryItem: BerryItem): BerryItem {
|
||||
val finalName = "${name}_berry"
|
||||
val item = this.create(finalName, berryItem)
|
||||
compostable(item, .65f)
|
||||
this.berries[cobblemonResource(finalName)] = item
|
||||
return item
|
||||
}
|
||||
|
||||
private fun mintItem(name: String, mintItem: MintItem): MintItem {
|
||||
val item = this.create(name, mintItem)
|
||||
mints[item.nature.displayName] = item
|
||||
compostable(item, .65f)
|
||||
return item
|
||||
}
|
||||
|
||||
private fun apricornItem(name: String, apricornItem: ApricornItem): ApricornItem {
|
||||
val finalName = "${name}_apricorn"
|
||||
val item = this.create(finalName, apricornItem)
|
||||
compostable(item, .65f)
|
||||
return item
|
||||
}
|
||||
|
||||
private fun apricornSeedItem(name: String, apricornSeedItem: ApricornSeedItem): ApricornSeedItem {
|
||||
val finalName = "${name}_apricorn_seed"
|
||||
val item = this.create(finalName, apricornSeedItem)
|
||||
compostable(item, .65f)
|
||||
return item
|
||||
}
|
||||
|
||||
private fun mintSeed(name: String, mintBlock: MintBlock): Item {
|
||||
val finalName = "${name}_mint_seeds"
|
||||
val item = this.blockItem(finalName, mintBlock)
|
||||
compostable(item, .65f)
|
||||
return item
|
||||
}
|
||||
|
||||
private fun mintLeaf(name: String, mintLeafItem: MintLeafItem): MintLeafItem {
|
||||
val finalName = "${name}_mint_leaf"
|
||||
val item = this.create(finalName, mintLeafItem)
|
||||
compostable(item, .65f)
|
||||
return item
|
||||
}
|
||||
|
||||
private fun compostableItem(name: String, item: Item? = null, increaseLevelChance: Float = .65f): Item {
|
||||
val createdItem = this.create(name, item ?: Item(Item.Settings()))
|
||||
compostable(createdItem, increaseLevelChance)
|
||||
return createdItem
|
||||
}
|
||||
|
||||
private fun compostableHeldItem(name: String, remappedName: String? = null, increaseLevelChance: Float = .65f): CobblemonItem {
|
||||
val createdItem = heldItem(name, remappedName)
|
||||
compostable(createdItem, increaseLevelChance)
|
||||
return createdItem
|
||||
}
|
||||
|
||||
private fun compostableBlockItem(name: String, block: Block, increaseLevelChance: Float = .65f): Item {
|
||||
val createdItem = this.blockItem(name, block)
|
||||
compostable(createdItem, increaseLevelChance)
|
||||
return createdItem
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,8 +11,27 @@ package com.cobblemon.mod.common
|
||||
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.api.net.NetworkPacket
|
||||
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.client.net.PlayerInteractOptionsHandler
|
||||
import com.cobblemon.mod.common.client.net.SetClientPlayerDataHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.*
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleApplyPassResponseHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleCaptureEndHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleCaptureShakeHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleCaptureStartHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleChallengeExpiredHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleChallengeNotificationHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleEndHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleFaintHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleHealthChangeHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleInitializeHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleMadeInvalidChoiceHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleMakeChoiceHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleMessageHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleMusicHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattlePersistentStatusHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleQueueRequestHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleSetTeamPokemonHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleSwitchPokemonHandler
|
||||
import com.cobblemon.mod.common.client.net.battle.BattleUpdateTeamPokemonHandler
|
||||
import com.cobblemon.mod.common.client.net.callback.move.OpenMoveCallbackHandler
|
||||
import com.cobblemon.mod.common.client.net.callback.party.OpenPartyCallbackHandler
|
||||
import com.cobblemon.mod.common.client.net.callback.partymove.OpenPartyMoveCallbackHandler
|
||||
@@ -51,6 +70,7 @@ import com.cobblemon.mod.common.client.net.trade.TradeOfferExpiredHandler
|
||||
import com.cobblemon.mod.common.client.net.trade.TradeOfferNotificationHandler
|
||||
import com.cobblemon.mod.common.client.net.trade.TradeStartedHandler
|
||||
import com.cobblemon.mod.common.client.net.trade.TradeUpdatedHandler
|
||||
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.battle.*
|
||||
import com.cobblemon.mod.common.net.messages.client.callback.OpenMoveCallbackPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.callback.OpenPartyCallbackPacket
|
||||
@@ -99,12 +119,10 @@ import com.cobblemon.mod.common.net.messages.client.trade.TradeStartedPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.trade.TradeUpdatedPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.ui.InteractPokemonUIPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.ui.SummaryUIPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.BattleChallengePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.BenchMovePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.RequestMoveSwapPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.SelectStarterPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.SendOutPokemonPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.*
|
||||
import com.cobblemon.mod.common.net.messages.server.battle.BattleSelectActionsPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.battle.RemoveSpectatorPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.battle.SpectateBattlePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.callback.move.MoveSelectCancelledPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.callback.move.MoveSelectedPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.callback.party.PartyPokemonSelectedPacket
|
||||
@@ -134,7 +152,10 @@ import com.cobblemon.mod.common.net.messages.server.trade.ChangeTradeAcceptanceP
|
||||
import com.cobblemon.mod.common.net.messages.server.trade.OfferTradePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.trade.UpdateTradeOfferPacket
|
||||
import com.cobblemon.mod.common.net.serverhandling.ChallengeHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.RequestInteractionsHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.battle.BattleSelectActionsHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.battle.RemoveSpectatorHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.battle.SpectateBattleHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.callback.move.MoveSelectCancelledHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.callback.move.MoveSelectedHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.callback.party.PartyPokemonSelectedHandler
|
||||
@@ -168,12 +189,12 @@ import com.cobblemon.mod.common.net.serverhandling.trade.ChangeTradeAcceptanceHa
|
||||
import com.cobblemon.mod.common.net.serverhandling.trade.OfferTradeHandler
|
||||
import com.cobblemon.mod.common.net.serverhandling.trade.UpdateTradeOfferHandler
|
||||
import com.cobblemon.mod.common.util.server
|
||||
import kotlin.reflect.KClass
|
||||
import net.minecraft.network.PacketByteBuf
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener
|
||||
import net.minecraft.network.packet.Packet
|
||||
import net.minecraft.server.network.ServerPlayerEntity
|
||||
import net.minecraft.util.Identifier
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Registers Cobblemon network packets.
|
||||
@@ -238,6 +259,7 @@ object CobblemonNetwork : NetworkManager {
|
||||
// UI Packets
|
||||
this.createClientBound(SummaryUIPacket.ID, SummaryUIPacket::decode, SummaryUIPacketHandler)
|
||||
this.createClientBound(InteractPokemonUIPacket.ID, InteractPokemonUIPacket::decode, InteractPokemonUIPacketHandler)
|
||||
this.createClientBound(PlayerInteractOptionsPacket.ID, PlayerInteractOptionsPacket::decode, PlayerInteractOptionsHandler)
|
||||
|
||||
// Starter packets
|
||||
this.createClientBound(OpenStarterUIPacket.ID, OpenStarterUIPacket::decode, StarterUIPacketHandler)
|
||||
@@ -323,6 +345,7 @@ object CobblemonNetwork : NetworkManager {
|
||||
|
||||
// Interaction Packets
|
||||
this.createServerBound(InteractPokemonPacket.ID, InteractPokemonPacket::decode, InteractPokemonHandler)
|
||||
this.createServerBound(RequestPlayerInteractionsPacket.ID, RequestPlayerInteractionsPacket::decode, RequestInteractionsHandler)
|
||||
|
||||
// Storage Packets
|
||||
this.createServerBound(SendOutPokemonPacket.ID, SendOutPokemonPacket::decode, SendOutPokemonHandler)
|
||||
@@ -350,6 +373,8 @@ object CobblemonNetwork : NetworkManager {
|
||||
|
||||
// Battle packets
|
||||
this.createServerBound(BattleSelectActionsPacket.ID, BattleSelectActionsPacket::decode, BattleSelectActionsHandler)
|
||||
this.createServerBound(SpectateBattlePacket.ID, SpectateBattlePacket::decode, SpectateBattleHandler)
|
||||
this.createServerBound(RemoveSpectatorPacket.ID, RemoveSpectatorPacket::decode, RemoveSpectatorHandler)
|
||||
|
||||
// Trade
|
||||
this.createServerBound(AcceptTradeRequestPacket.ID, AcceptTradeRequestPacket::decode, AcceptTradeRequestHandler)
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.cobblemon.mod.common.net.messages.client.battle.BattleEndPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.battle.BattleMessagePacket
|
||||
import com.cobblemon.mod.common.net.messages.client.battle.BattleMusicPacket
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.DefeatEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.LastBattleCriticalHitsEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.requirements.DefeatRequirement
|
||||
import com.cobblemon.mod.common.util.battleLang
|
||||
import com.cobblemon.mod.common.util.getPlayer
|
||||
@@ -55,6 +56,7 @@ import net.minecraft.text.Text
|
||||
* @since January 16th, 2022
|
||||
* @author Deltric, Hiroku
|
||||
*/
|
||||
@Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
open class PokemonBattle(
|
||||
val format: BattleFormat,
|
||||
val side1: BattleSide,
|
||||
@@ -68,7 +70,9 @@ open class PokemonBattle(
|
||||
side2.battle = this
|
||||
this.actors.forEach { actor ->
|
||||
actor.pokemonList.forEach { battlePokemon ->
|
||||
battlePokemon.criticalHits = 0
|
||||
battlePokemon.effectedPokemon.evolutionProxy.current().progress()
|
||||
.filterIsInstance<LastBattleCriticalHitsEvolutionProgress>()
|
||||
.forEach { it.reset() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,12 +86,13 @@ open class PokemonBattle(
|
||||
val playerUUIDs: Iterable<UUID>
|
||||
get() = actors.flatMap { it.getPlayerUUIDs() }
|
||||
val players = playerUUIDs.mapNotNull { it.getPlayer() }
|
||||
val spectators = mutableListOf<UUID>()
|
||||
val spectators = mutableSetOf<UUID>()
|
||||
|
||||
val battleId = UUID.randomUUID()
|
||||
|
||||
val showdownMessages = mutableListOf<String>()
|
||||
val battleLog = mutableListOf<String>()
|
||||
val chatLog = mutableListOf<Text>()
|
||||
var started = false
|
||||
var ended = false
|
||||
// TEMP battle showcase stuff
|
||||
@@ -175,11 +180,8 @@ open class PokemonBattle(
|
||||
}
|
||||
|
||||
fun broadcastChatMessage(component: Text) {
|
||||
spectators.forEach { spectatorId ->
|
||||
spectatorId.getPlayer()?.let {
|
||||
CobblemonNetwork.sendPacketToPlayer(it, BattleMessagePacket(component))
|
||||
}
|
||||
}
|
||||
chatLog.add(component)
|
||||
sendSpectatorUpdate(BattleMessagePacket(component))
|
||||
return actors.forEach { it.sendMessage(component) }
|
||||
}
|
||||
|
||||
|
||||
+14
-7
@@ -26,13 +26,20 @@ abstract class AIBattleActor(
|
||||
super.sendUpdate(packet)
|
||||
|
||||
if (packet is BattleMakeChoicePacket) {
|
||||
try {
|
||||
setActionResponses(request!!.iterate(this.activePokemon, battleAI::choose))
|
||||
} catch (exception: IllegalActionChoiceException) {
|
||||
LOGGER.error("AI was unable to choose a move, we're going to need to pass!")
|
||||
exception.printStackTrace()
|
||||
setActionResponses(request!!.iterate(this.activePokemon) { _, _, _ -> PassActionResponse })
|
||||
}
|
||||
this.onChoiceRequested()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the AI is requested to make a choice.
|
||||
*/
|
||||
open fun onChoiceRequested() {
|
||||
try {
|
||||
setActionResponses(request!!.iterate(this.activePokemon, battleAI::choose))
|
||||
} catch (exception: IllegalActionChoiceException) {
|
||||
LOGGER.error("AI was unable to choose a move, we're going to need to pass!")
|
||||
exception.printStackTrace()
|
||||
setActionResponses(request!!.iterate(this.activePokemon) { _, _, _ -> PassActionResponse })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.cobblemon.mod.common.api.events.pokemon.*
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionAcceptedEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionCompleteEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionDisplayEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionTestedEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.interaction.ExperienceCandyUseEvent
|
||||
import com.cobblemon.mod.common.api.events.starter.StarterChosenEvent
|
||||
import com.cobblemon.mod.common.api.events.storage.ReleasePokemonEvent
|
||||
@@ -43,6 +44,7 @@ import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import net.minecraft.server.network.ServerPlayerEntity
|
||||
|
||||
@Suppress("unused")
|
||||
object CobblemonEvents {
|
||||
|
||||
@JvmField
|
||||
@@ -58,6 +60,8 @@ object CobblemonEvents {
|
||||
@JvmField
|
||||
val EVOLUTION_DISPLAY = EventObservable<EvolutionDisplayEvent>()
|
||||
@JvmField
|
||||
val EVOLUTION_TESTED = EventObservable<EvolutionTestedEvent>()
|
||||
@JvmField
|
||||
val EVOLUTION_COMPLETE = EventObservable<EvolutionCompleteEvent>()
|
||||
@JvmField
|
||||
val POKEMON_NICKNAMED = CancelableObservable<PokemonNicknamedEvent>()
|
||||
@@ -109,7 +113,10 @@ object CobblemonEvents {
|
||||
val POKEMON_ENTITY_SPAWN = ENTITY_SPAWN
|
||||
.pipe(
|
||||
filter { it.entity is PokemonEntity },
|
||||
map { it as SpawnEvent<PokemonEntity> }
|
||||
map {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
it as SpawnEvent<PokemonEntity>
|
||||
}
|
||||
)
|
||||
|
||||
@JvmField
|
||||
|
||||
+3
-3
@@ -23,6 +23,6 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
* @since April 28th, 2022
|
||||
*/
|
||||
data class EvolutionAcceptedEvent(
|
||||
val pokemon: Pokemon,
|
||||
val evolution: Evolution
|
||||
) : Cancelable()
|
||||
override val pokemon: Pokemon,
|
||||
override val evolution: Evolution
|
||||
) : Cancelable(), EvolutionEvent
|
||||
+3
-3
@@ -21,6 +21,6 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
* @since October 2nd, 2022
|
||||
*/
|
||||
data class EvolutionCompleteEvent(
|
||||
val pokemon: Pokemon,
|
||||
val evolution: Evolution
|
||||
)
|
||||
override val pokemon: Pokemon,
|
||||
override val evolution: Evolution
|
||||
) : EvolutionEvent
|
||||
+3
-3
@@ -25,7 +25,7 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
* @since May 3rd, 2022
|
||||
*/
|
||||
data class EvolutionDisplayEvent(
|
||||
val pokemon: Pokemon,
|
||||
override val pokemon: Pokemon,
|
||||
var display: EvolutionDisplay,
|
||||
val evolution: Evolution
|
||||
)
|
||||
override val evolution: Evolution
|
||||
) : EvolutionEvent
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon.evolution
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
* The root of the various evolution related events.
|
||||
*/
|
||||
interface EvolutionEvent {
|
||||
|
||||
/**
|
||||
* The Pokémon impacted in this event.
|
||||
*/
|
||||
val pokemon: Pokemon
|
||||
|
||||
/**
|
||||
* The evolution triggering this event.
|
||||
*/
|
||||
val evolution: Evolution
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon.evolution
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
* An event fired when [Evolution.test] has been performed.
|
||||
* The final state [result] will be the return value of the test function.
|
||||
*
|
||||
* @property pokemon The [Pokemon] being tested against.
|
||||
* @property evolution The [Evolution] instance performing the test.
|
||||
* @property originalResult The base result from the Cobblemon implementation.
|
||||
* @property result The final value returned by [Evolution.test].
|
||||
*/
|
||||
data class EvolutionTestedEvent(
|
||||
override val pokemon: Pokemon,
|
||||
override val evolution: Evolution,
|
||||
val originalResult: Boolean,
|
||||
var result: Boolean
|
||||
) : EvolutionEvent
|
||||
@@ -122,16 +122,27 @@ fun drawText(
|
||||
y: Number,
|
||||
centered: Boolean = false,
|
||||
colour: Int,
|
||||
shadow: Boolean = true
|
||||
) {
|
||||
shadow: Boolean = true,
|
||||
pMouseX: Number? = null,
|
||||
pMouseY: Number? = null
|
||||
): Boolean {
|
||||
val comp = if (font == null) text else text.setStyle(text.style.withFont(font))
|
||||
val textRenderer = MinecraftClient.getInstance().textRenderer
|
||||
var x = x
|
||||
val width = textRenderer.getWidth(comp)
|
||||
if (centered) {
|
||||
val width = textRenderer.getWidth(comp)
|
||||
x = x.toDouble() - width / 2
|
||||
}
|
||||
context.drawText(textRenderer, comp, x.toInt(), y.toInt(), colour, shadow)
|
||||
var isHovered = false
|
||||
if (pMouseY != null && pMouseX != null) {
|
||||
if (pMouseX.toInt() >= x.toInt() && pMouseX.toInt() <= x.toInt() + width &&
|
||||
pMouseY.toInt() >= y.toInt() && pMouseY.toInt() <= y.toInt() + textRenderer.fontHeight
|
||||
) {
|
||||
isHovered = true
|
||||
}
|
||||
}
|
||||
return isHovered
|
||||
}
|
||||
|
||||
fun drawText(
|
||||
|
||||
@@ -66,7 +66,15 @@ interface PokemonSelectingItem {
|
||||
return if (entity != null) {
|
||||
val pokemon = entity.pokemon
|
||||
if (entity.ownerUuid == player.uuid) {
|
||||
applyToPokemon(player, stack, pokemon) ?: TypedActionResult.pass(stack)
|
||||
val typedActionResult = applyToPokemon(player, stack, pokemon)
|
||||
if (typedActionResult != null)
|
||||
{
|
||||
CobblemonCriteria.POKEMON_INTERACT.trigger(player, PokemonInteractContext(pokemon.species.resourceIdentifier, Registries.ITEM.getId(stack.item)))
|
||||
typedActionResult
|
||||
}
|
||||
else {
|
||||
TypedActionResult.pass(stack)
|
||||
}
|
||||
} else {
|
||||
TypedActionResult.fail(stack)
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
package com.cobblemon.mod.common.api.pokemon.evolution
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.abilities.AbilityPool
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionCompleteEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionTestedEvent
|
||||
import com.cobblemon.mod.common.api.moves.BenchedMove
|
||||
import com.cobblemon.mod.common.api.moves.MoveTemplate
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
|
||||
@@ -67,7 +67,12 @@ interface Evolution : EvolutionLike {
|
||||
* @param pokemon The [Pokemon] being queried.
|
||||
* @return If the [Evolution] can start.
|
||||
*/
|
||||
fun test(pokemon: Pokemon) = this.requirements.all { requirement -> requirement.check(pokemon) }
|
||||
fun test(pokemon: Pokemon): Boolean {
|
||||
val result = this.requirements.all { requirement -> requirement.check(pokemon) }
|
||||
val event = EvolutionTestedEvent(pokemon, this, result, result)
|
||||
CobblemonEvents.EVOLUTION_TESTED.post(event)
|
||||
return event.result
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts this evolution or queues it if [optional] is true.
|
||||
|
||||
+4
-2
@@ -8,14 +8,16 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.pokemon.evolution.progress
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.RecoilEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.UseMoveEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.*
|
||||
|
||||
object EvolutionProgressFactory {
|
||||
|
||||
private val variants = hashMapOf<String, () -> EvolutionProgress<*>>()
|
||||
|
||||
init {
|
||||
registerVariant(DamageTakenEvolutionProgress.ID.toString()) { DamageTakenEvolutionProgress() }
|
||||
registerVariant(DefeatEvolutionProgress.ID.toString()) { DefeatEvolutionProgress() }
|
||||
registerVariant(LastBattleCriticalHitsEvolutionProgress.ID.toString()) { LastBattleCriticalHitsEvolutionProgress() }
|
||||
registerVariant(RecoilEvolutionProgress.ID.toString()) { RecoilEvolutionProgress() }
|
||||
registerVariant(UseMoveEvolutionProgress.ID.toString()) { UseMoveEvolutionProgress() }
|
||||
}
|
||||
|
||||
+10
@@ -79,6 +79,16 @@ interface HeldItemManager {
|
||||
*/
|
||||
fun take(pokemon: BattlePokemon, showdownId: String)
|
||||
|
||||
/**
|
||||
* Tests if the given [BattlePokemon] should have their item consumed.
|
||||
* This method is expected to be used in each implementation when needed.
|
||||
*
|
||||
* @param pokemon The [BattlePokemon] being tested.
|
||||
* @param battle The [PokemonBattle] the [pokemon] is participating in.
|
||||
* @param showdownId The literal ID of the held item on Showdown.
|
||||
*/
|
||||
fun shouldConsumeItem(pokemon: BattlePokemon, battle: PokemonBattle, showdownId: String): Boolean = false
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.pokemon.status
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
|
||||
import com.cobblemon.mod.common.pokemon.status.statuses.BurnStatus
|
||||
import com.cobblemon.mod.common.pokemon.status.statuses.FrozenStatus
|
||||
import com.cobblemon.mod.common.pokemon.status.statuses.ParalysisStatus
|
||||
@@ -39,4 +40,5 @@ object Statuses {
|
||||
|
||||
fun getStatus(name: Identifier) = allStatuses.find { status -> status.name == name }
|
||||
fun getStatus(showdownName: String) = allStatuses.find { it.showdownName == showdownName }
|
||||
fun getPersistentStatuses() = allStatuses.filterIsInstance<PersistentStatus>()
|
||||
}
|
||||
+1
-3
@@ -10,7 +10,6 @@ package com.cobblemon.mod.common.api.spawning
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.Cobblemon.config
|
||||
import com.cobblemon.mod.common.api.spawning.mixins.CachedOnlyChunkAccessor
|
||||
import com.cobblemon.mod.common.api.spawning.prospecting.SpawningProspector
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.Spawner
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.SpawningArea
|
||||
@@ -81,8 +80,7 @@ object CobblemonSpawningProspector : SpawningProspector {
|
||||
for (x in area.baseX until area.baseX + area.length) {
|
||||
for (z in area.baseZ until area.baseZ + area.width) {
|
||||
val query = chunks.computeIfAbsent(Pair(getSectionCoord(x), getSectionCoord(z))) {
|
||||
val manager = world.chunkManager as CachedOnlyChunkAccessor
|
||||
manager.`cobblemon$request`(it.first, it.second, ChunkStatus.FULL)
|
||||
world.getChunk(it.first, it.second, ChunkStatus.FULL, false)
|
||||
} ?: continue
|
||||
|
||||
var canSeeSky = world.isSkyVisibleAllowingSea(pos.set(x, yRange.first, z))
|
||||
|
||||
@@ -31,12 +31,16 @@ open class SpawnerManager {
|
||||
|
||||
open fun registerSpawner(spawner: Spawner) {
|
||||
spawners.add(spawner)
|
||||
spawner.influences.addAll(influences)
|
||||
if (spawner !is TickingSpawner) {
|
||||
spawner.influences.addAll(influences)
|
||||
}
|
||||
}
|
||||
|
||||
open fun unregisterSpawner(spawner: Spawner) {
|
||||
spawners.remove(spawner)
|
||||
spawner.influences.removeAll(influences)
|
||||
if (spawner !is TickingSpawner) {
|
||||
spawner.influences.removeAll(influences)
|
||||
}
|
||||
}
|
||||
|
||||
open fun onServerStarted() {
|
||||
|
||||
@@ -28,13 +28,12 @@ abstract class SpawnAction<T : Entity>(
|
||||
) {
|
||||
abstract fun createEntity(): T?
|
||||
|
||||
fun run() {
|
||||
open fun run() {
|
||||
ctx.influences.forEach { it.affectAction(this) }
|
||||
val e = createEntity() ?: return
|
||||
e.setPosition(ctx.position.toVec3d().add(0.5, 1.0, 0.5))
|
||||
entity.emit(e)
|
||||
CobblemonEvents.ENTITY_SPAWN.post(SpawnEvent(e, ctx))
|
||||
ctx.world.spawnEntity(e)
|
||||
CobblemonEvents.ENTITY_SPAWN.postThen(SpawnEvent(e, ctx), ifSucceeded = { ctx.world.spawnEntity(e) })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,4 +46,4 @@ abstract class SpawnAction<T : Entity>(
|
||||
val entity: SimpleObservable<T> = SimpleObservable<T>().apply {
|
||||
subscribe { entity -> ctx.afterSpawn(entity) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.spawning.mixins
|
||||
|
||||
import net.minecraft.world.chunk.Chunk
|
||||
import net.minecraft.world.chunk.ChunkStatus
|
||||
|
||||
interface CachedOnlyChunkAccessor {
|
||||
|
||||
fun `cobblemon$request`(x: Int, z: Int, status: ChunkStatus): Chunk?
|
||||
|
||||
}
|
||||
+15
-3
@@ -17,9 +17,9 @@ import com.cobblemon.mod.common.api.spawning.context.calculators.AreaSpawningCon
|
||||
import com.cobblemon.mod.common.api.spawning.context.calculators.SpawningContextCalculator.Companion.prioritizedAreaCalculators
|
||||
import com.cobblemon.mod.common.api.spawning.detail.SpawnDetail
|
||||
import com.cobblemon.mod.common.api.spawning.detail.SpawnPool
|
||||
import com.cobblemon.mod.common.api.spawning.mixins.CachedOnlyChunkAccessor
|
||||
import com.cobblemon.mod.common.api.spawning.prospecting.SpawningProspector
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.util.isBoxLoaded
|
||||
import com.cobblemon.mod.common.util.squeezeWithinBounds
|
||||
import com.cobblemon.mod.common.util.toVec3f
|
||||
import net.minecraft.entity.ai.pathing.NavigationType
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.world.World
|
||||
import net.minecraft.world.chunk.Chunk
|
||||
import net.minecraft.world.chunk.ChunkStatus
|
||||
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules.DO_POKEMON_SPAWNING
|
||||
import net.minecraft.util.math.ChunkPos
|
||||
|
||||
/**
|
||||
* A type of [TickingSpawner] that operates within some area. When this spawner type
|
||||
@@ -59,6 +60,7 @@ abstract class AreaSpawner(
|
||||
var resolver: AreaContextResolver = Cobblemon.areaContextResolver
|
||||
var contextCalculators: List<AreaSpawningContextCalculator<*>> = prioritizedAreaCalculators
|
||||
|
||||
|
||||
override fun run(cause: SpawnCause): Pair<SpawningContext, SpawnDetail>? {
|
||||
val area = getArea(cause)
|
||||
if (area?.world?.gameRules?.getBoolean(DO_POKEMON_SPAWNING) == false) {
|
||||
@@ -66,9 +68,15 @@ abstract class AreaSpawner(
|
||||
}
|
||||
val constrainedArea = if (area != null) constrainArea(area) else null
|
||||
if (constrainedArea != null) {
|
||||
|
||||
val areaBox = Box.of(Vec3d(constrainedArea.getCenter().toVec3f()), CHUNK_REACH * 16.0 * 2, 1000.0, CHUNK_REACH * 16.0 * 2)
|
||||
if (!constrainedArea.world.isBoxLoaded(areaBox)) {
|
||||
return null
|
||||
}
|
||||
|
||||
val numberNearby = constrainedArea.world.getEntitiesByClass(
|
||||
PokemonEntity::class.java,
|
||||
Box.of(Vec3d(constrainedArea.getCenter().toVec3f()), CHUNK_REACH * 16.0 * 2, 1000.0, CHUNK_REACH * 16.0 * 2)
|
||||
areaBox
|
||||
) { true }.size
|
||||
|
||||
val chunksCovered = CHUNK_REACH * CHUNK_REACH
|
||||
@@ -117,7 +125,11 @@ abstract class AreaSpawner(
|
||||
val originalY = area.baseY
|
||||
|
||||
val (chunkX, chunkZ) = Pair(ChunkSectionPos.getSectionCoord(area.baseX), ChunkSectionPos.getSectionCoord(area.baseZ))
|
||||
val chunk = (area.world.chunkManager as CachedOnlyChunkAccessor).`cobblemon$request`(chunkX, chunkZ, ChunkStatus.FULL) ?: return null
|
||||
|
||||
// if the chunk isn't loaded, we don't want to go further & we don't want the getChunk function below to load/create the chunk.
|
||||
if (!area.world.isChunkLoaded(ChunkPos.toLong(chunkX, chunkZ))) return null
|
||||
|
||||
val chunk = area.world.getChunk(chunkX, chunkZ, ChunkStatus.FULL) ?: return null
|
||||
|
||||
var valid = isValidStartPoint(area.world, chunk, basePos)
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import com.cobblemon.mod.common.api.spawning.detail.SpawnAction
|
||||
import com.cobblemon.mod.common.api.spawning.detail.SpawnDetail
|
||||
import com.cobblemon.mod.common.api.spawning.detail.SpawnPool
|
||||
import com.cobblemon.mod.common.api.spawning.influence.SpawningInfluence
|
||||
import com.cobblemon.mod.common.api.spawning.selection.FlatSelector
|
||||
import com.cobblemon.mod.common.api.spawning.selection.FlatContextWeightedSelector
|
||||
import com.cobblemon.mod.common.api.spawning.selection.SpawningSelector
|
||||
import net.minecraft.entity.Entity
|
||||
|
||||
@@ -32,7 +32,7 @@ abstract class TickingSpawner(
|
||||
var spawns: SpawnPool,
|
||||
val manager: SpawnerManager
|
||||
) : Spawner {
|
||||
private var selector: SpawningSelector = FlatSelector()
|
||||
private var selector: SpawningSelector = FlatContextWeightedSelector()
|
||||
override val influences = mutableListOf<SpawningInfluence>()
|
||||
|
||||
override fun canSpawn() = active
|
||||
|
||||
+19
-18
@@ -32,29 +32,19 @@ import java.util.UUID
|
||||
* @author Pebbles
|
||||
* @since August 23rd, 2023
|
||||
*/
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
open class MongoDBStoreAdapter(
|
||||
private val mongoClient: MongoClient,
|
||||
private val databaseName: String,
|
||||
protected val mongoClient: MongoClient,
|
||||
protected val databaseName: String,
|
||||
) : CobblemonAdapterParent<JsonObject>(), FileStoreAdapter<JsonObject> {
|
||||
private fun getCollection(storeClass: Class<out PokemonStore<*>>): MongoCollection<Document> {
|
||||
val collectionName = when (storeClass) {
|
||||
PlayerPartyStore::class.java -> "PlayerPartyCollection"
|
||||
PCStore::class.java -> "PCCollection"
|
||||
else -> "OtherCollection"
|
||||
}
|
||||
return mongoClient.getDatabase(databaseName).getCollection(collectionName)
|
||||
}
|
||||
|
||||
private val gson: Gson = Gson()
|
||||
protected val gson: Gson = this.createGson()
|
||||
|
||||
override fun <E : StorePosition, T : PokemonStore<E>> serialize(store: T): JsonObject {
|
||||
return store.saveToJSON(JsonObject())
|
||||
}
|
||||
override fun <E : StorePosition, T : PokemonStore<E>> serialize(store: T): JsonObject = store.saveToJSON(JsonObject())
|
||||
|
||||
override fun save(storeClass: Class<out PokemonStore<*>>, uuid: UUID, serialized: JsonObject) {
|
||||
val document = Document.parse(gson.toJson(serialized))
|
||||
document.put("uuid", uuid.toString())
|
||||
|
||||
val document = Document.parse(this.gson.toJson(serialized))
|
||||
document["uuid"] = uuid.toString()
|
||||
val collection = getCollection(storeClass)
|
||||
val filter = Document("uuid", uuid.toString())
|
||||
collection.replaceOne(filter, document, ReplaceOptions().upsert(true))
|
||||
@@ -76,7 +66,7 @@ open class MongoDBStoreAdapter(
|
||||
val document = collection.find(filter).first()
|
||||
|
||||
if (document != null) {
|
||||
val json = gson.fromJson(document.toJson(), JsonObject::class.java)
|
||||
val json = this.gson.fromJson(document.toJson(), JsonObject::class.java)
|
||||
val store = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
store.loadFromJSON(json)
|
||||
return store
|
||||
@@ -98,4 +88,15 @@ open class MongoDBStoreAdapter(
|
||||
return null
|
||||
}
|
||||
|
||||
protected open fun createGson(): Gson = Gson()
|
||||
|
||||
protected open fun getCollection(storeClass: Class<out PokemonStore<*>>): MongoCollection<Document> {
|
||||
val collectionName = when (storeClass) {
|
||||
PlayerPartyStore::class.java -> "PlayerPartyCollection"
|
||||
PCStore::class.java -> "PCCollection"
|
||||
else -> "OtherCollection"
|
||||
}
|
||||
return this.mongoClient.getDatabase(this.databaseName).getCollection(collectionName)
|
||||
}
|
||||
|
||||
}
|
||||
+5
-1
@@ -48,7 +48,11 @@ open class JSONStoreAdapter(
|
||||
val br = BufferedReader(FileReader(file))
|
||||
val json = gson.fromJson<JsonObject>(br)
|
||||
br.close()
|
||||
val store = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
val store = try {
|
||||
storeClass.getConstructor(UUID::class.java, UUID::class.java).newInstance(uuid, uuid)
|
||||
} catch (exception: NoSuchMethodException) {
|
||||
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
}
|
||||
store.loadFromJSON(json)
|
||||
store
|
||||
} catch (e: Exception) {
|
||||
|
||||
+6
-1
@@ -31,7 +31,12 @@ open class NBTStoreAdapter(
|
||||
override fun <E : StorePosition, T : PokemonStore<E>> serialize(store: T) = store.saveToNBT(NbtCompound())
|
||||
override fun save(file: File, serialized: NbtCompound) = NbtIo.writeCompressed(serialized, file)
|
||||
override fun <E, T : PokemonStore<E>> load(file: File, storeClass: Class<out T>, uuid: UUID): T? {
|
||||
val store = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
val store = try {
|
||||
storeClass.getConstructor(UUID::class.java, UUID::class.java).newInstance(uuid, uuid)
|
||||
} catch (exception: NoSuchMethodException) {
|
||||
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
}
|
||||
|
||||
return try {
|
||||
val nbt = NbtIo.readCompressed(file)
|
||||
store.loadFromNBT(nbt)
|
||||
|
||||
+4
-2
@@ -38,8 +38,10 @@ import kotlin.random.Random
|
||||
*/
|
||||
open class PlayerPartyStore(
|
||||
/** The UUID of the player this store is for. */
|
||||
val playerUUID: UUID
|
||||
) : PartyStore(playerUUID) {
|
||||
val playerUUID: UUID,
|
||||
/** The UUID of the store. This is the same as [playerUUID] by default, but can be changed to allow for multiple parties. */
|
||||
storageUUID: UUID = playerUUID
|
||||
) : PartyStore(storageUUID) {
|
||||
|
||||
private var secondsSinceFriendshipUpdate = 0
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import net.minecraft.registry.tag.TagKey
|
||||
@Suppress("HasPlatformType", "unused")
|
||||
object CobblemonBlockTags {
|
||||
|
||||
@JvmField val ALL_HANGING_SIGNS = createTag("all_hanging_signs")
|
||||
@JvmField val ALL_SIGNS = createTag("all_signs")
|
||||
@JvmField val APRICORN_LEAVES = createTag("apricorn_leaves")
|
||||
@JvmField val APRICORN_LOGS = createTag("apricorn_logs")
|
||||
@JvmField val APRICORN_SAPLINGS = createTag("apricorn_saplings")
|
||||
@@ -29,6 +31,7 @@ object CobblemonBlockTags {
|
||||
@JvmField val BERRY_WILD_SOIL = createTag("berry_wild_soil")
|
||||
@JvmField val BERRY_SOIL = createTag("berry_soil")
|
||||
@JvmField val BERRY_REPLACEABLE = createTag("berry_replaceable")
|
||||
@JvmField val CEILING_HANGING_SIGNS = createTag("ceiling_hanging_signs")
|
||||
@JvmField val CROPS = createTag("crops")
|
||||
@JvmField val DRIPSTONE_GROWABLE = createTag("dripstone_growable")
|
||||
@JvmField val DRIPSTONE_REPLACEABLES = createTag("dripstone_replaceables")
|
||||
@@ -36,10 +39,15 @@ object CobblemonBlockTags {
|
||||
@JvmField val MEDICINAL_LEEK_PLANTABLE = createTag("medicinal_leek_plantable")
|
||||
@JvmField val MINTS = createTag("mints")
|
||||
@JvmField val ROOTS_SPREADABLE = createTag("roots_spreadable")
|
||||
@JvmField val SIGNS = createTag("signs")
|
||||
@JvmField val SMALL_FLOWERS = createTag("small_flowers")
|
||||
@JvmField val SEES_SKY = createTag("sees_sky")
|
||||
@JvmField val SNOW_BLOCK = createTag("snow_block")
|
||||
@JvmField val ROOTS = createTag("roots")
|
||||
@JvmField val STANDING_SIGNS = createTag("standing_signs")
|
||||
@JvmField val WALL_HANGING_SIGNS = createTag("wall_hanging_signs")
|
||||
@JvmField val WALL_SIGNS = createTag("wall_signs")
|
||||
|
||||
private fun createTag(name: String) = TagKey.of(RegistryKeys.BLOCK, cobblemonResource(name))
|
||||
|
||||
}
|
||||
|
||||
@@ -9,15 +9,17 @@
|
||||
package com.cobblemon.mod.common.api.tags
|
||||
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.registry.Registries
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
|
||||
/**
|
||||
* A collection of the Cobblemon [TagKey]s related to the [Registry.ENTITY_TYPE].
|
||||
* A collection of the Cobblemon [TagKey]s related to the [Registries.ENTITY_TYPE].
|
||||
*
|
||||
* @author Licious
|
||||
* @since March 6th, 2023
|
||||
*/
|
||||
@Suppress("HasPlatformType", "unused")
|
||||
object CobblemonEntityTypeTags {
|
||||
|
||||
|
||||
@@ -27,6 +29,9 @@ object CobblemonEntityTypeTags {
|
||||
@JvmField
|
||||
val CANNOT_HAVE_NAME_TAG = create("cannot_have_name_tag")
|
||||
|
||||
@JvmField
|
||||
val BOATS = create("boats")
|
||||
|
||||
private fun create(path: String) = TagKey.of(RegistryKeys.ENTITY_TYPE, cobblemonResource(path))
|
||||
|
||||
}
|
||||
@@ -9,16 +9,17 @@
|
||||
package com.cobblemon.mod.common.api.tags
|
||||
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.registry.Registry
|
||||
import net.minecraft.registry.Registries
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
|
||||
/**
|
||||
* A collection of the Cobblemon [TagKey]s related to the [Registry.ITEM].
|
||||
* A collection of the Cobblemon [TagKey]s related to the [Registries.ITEM].
|
||||
*
|
||||
* @author Licious
|
||||
* @since January 8th, 2023
|
||||
*/
|
||||
@Suppress("unused", "HasPlatformType")
|
||||
object CobblemonItemTags {
|
||||
|
||||
@JvmField
|
||||
@@ -27,11 +28,47 @@ object CobblemonItemTags {
|
||||
val APRICORN_SEEDS = create("apricorn_seeds")
|
||||
@JvmField
|
||||
val APRICORNS = create("apricorns")
|
||||
/**
|
||||
* This tag is only used for a Torterra aspect based easter egg evolution at the moment.
|
||||
* It simply includes the 'minecraft:azalea' and 'minecraft:flowering_azalea' items by default.
|
||||
*/
|
||||
@JvmField
|
||||
val AZALEA_TREE = create("azalea_tree")
|
||||
@JvmField
|
||||
val BERRIES = create("berries")
|
||||
@JvmField
|
||||
val BOATS = create("boats")
|
||||
@JvmField
|
||||
val COBBLEMON_SEEDS = create("cobblemon_seeds")
|
||||
@JvmField
|
||||
val EVOLUTION_ITEMS = create("evolution_items")
|
||||
@JvmField
|
||||
val EVOLUTION_STONES = create("evolution_stones")
|
||||
@JvmField
|
||||
val EXPERIENCE_CANDIES = create("experience_candies")
|
||||
@JvmField
|
||||
val HANGING_SIGNS = create("hanging_signs")
|
||||
@JvmField
|
||||
val HERBS = create("herbs")
|
||||
@JvmField
|
||||
val MINT_LEAF = create("mint_leaf")
|
||||
@JvmField
|
||||
val MINTS = create("mints")
|
||||
@JvmField
|
||||
val MUTATED_BERRIES = create("mutated_berries")
|
||||
@JvmField
|
||||
val PLANTS = create("plants")
|
||||
@JvmField
|
||||
val POKEBALLS = create("poke_balls")
|
||||
@JvmField
|
||||
val PROTEIN_INGREDIENTS = create("protein_ingredients")
|
||||
@JvmField
|
||||
val SEEDS = create("seeds")
|
||||
@JvmField
|
||||
val SIGNS = create("signs")
|
||||
@JvmField
|
||||
val ZINC_INGREDIENTS = create("zinc_ingredients")
|
||||
@JvmField
|
||||
val ANY_HELD_ITEM = create("held/is_held_item")
|
||||
@JvmField
|
||||
val EXPERIENCE_SHARE = create("held/experience_share")
|
||||
@@ -54,19 +91,11 @@ object CobblemonItemTags {
|
||||
@JvmField
|
||||
val POWER_WEIGHT = create("held/power_weight")
|
||||
@JvmField
|
||||
val EVOLUTION_STONES = create("evolution_stones")
|
||||
val CONSUMED_IN_NPC_BATTLE = create("held/consumed_in_npc_battle")
|
||||
@JvmField
|
||||
val EVOLUTION_ITEMS = create("evolution_items")
|
||||
val CONSUMED_IN_PVP_BATTLE = create("held/consumed_in_pvp_battle")
|
||||
@JvmField
|
||||
val MINTS = create("mints")
|
||||
@JvmField
|
||||
val MINT_LEAVES = create("mint_leaves")
|
||||
|
||||
/**
|
||||
* This tag is only used for a Torterra aspect based easter egg evolution at the moment.
|
||||
* It simply includes the 'minecraft:azalea' and 'minecraft:flowering_azalea' items by default.
|
||||
*/
|
||||
val AZALEA_TREE = create("azalea_tree")
|
||||
val CONSUMED_IN_WILD_BATTLE = create("held/consumed_in_wild_battle")
|
||||
|
||||
private fun create(path: String) = TagKey.of(RegistryKeys.ITEM, cobblemonResource(path))
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ fun String.stripCodes(): String = this.replace("[&§][A-Ea-e0-9K-Ok-oRr]".toRege
|
||||
fun MutableText.onClick(consumed: AtomicBoolean, action: (p: ServerPlayerEntity) -> Unit) = also { it.style = it.style.withClickEvent(click(consumed, action)) }
|
||||
fun MutableText.onClick(onlyOnce: Boolean = false, action: (p: ServerPlayerEntity) -> Unit) = also { it.style = it.style.withClickEvent(click(onlyOnce, action)) }
|
||||
fun MutableText.onHover(string: String) = also { it.style = it.style.withHoverEvent(hover(string)) }
|
||||
fun MutableText.onHover(text: Text) = also { it.style = it.style.withHoverEvent(hover(text)) }
|
||||
fun MutableText.onHover(text: MutableText) = also { it.style = it.style.withHoverEvent(hover(text)) }
|
||||
fun MutableText.underline() = also { it.style = it.style.withUnderline(true) }
|
||||
fun MutableText.bold() = also { it.style = it.style.withBold(true) }
|
||||
|
||||
@@ -221,6 +221,10 @@ object BattleRegistry {
|
||||
return battleMap.values.find { it.getActor(serverPlayerEntity) != null }
|
||||
}
|
||||
|
||||
fun getBattleByParticipatingPlayerId(playerId: UUID): PokemonBattle? {
|
||||
return battleMap.values.find { playerId in it.playerUUIDs }
|
||||
}
|
||||
|
||||
fun tick() {
|
||||
battleMap.forEachValue(Long.MAX_VALUE) { it.tick() }
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ data class SwitchActionResponse(var newPokemonId: UUID) : ShowdownActionResponse
|
||||
val pokemon = activeBattlePokemon.actor.pokemonList.find { it.uuid == newPokemonId }
|
||||
return when {
|
||||
pokemon == null -> false // No such Pokémon
|
||||
pokemon.health <= 0 -> false // Pokémon is dead
|
||||
(!activeBattlePokemon.actor.request?.side?.pokemon?.get(0)?.reviving!! && pokemon.health <= 0) -> false // Checks if the active Pokémon is reviving, if so ignore this check. If not, return false if dead
|
||||
showdownMoveSet != null && showdownMoveSet.trapped -> false // You're not allowed to switch
|
||||
activeBattlePokemon.actor.getSide().activePokemon.any { it.battlePokemon?.uuid == newPokemonId } -> false // Pokémon is already sent out
|
||||
else -> true
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.Cobblemon.LOGGER
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.battles.interpreter.*
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.EntityBackedBattleActor
|
||||
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
|
||||
@@ -24,6 +25,7 @@ import com.cobblemon.mod.common.api.pokemon.status.Statuses
|
||||
import com.cobblemon.mod.common.api.scheduling.after
|
||||
import com.cobblemon.mod.common.api.text.*
|
||||
import com.cobblemon.mod.common.api.types.ElementalTypes
|
||||
import com.cobblemon.mod.common.battles.actor.PlayerBattleActor
|
||||
import com.cobblemon.mod.common.battles.dispatch.BattleDispatch
|
||||
import com.cobblemon.mod.common.battles.dispatch.DispatchResult
|
||||
import com.cobblemon.mod.common.battles.dispatch.GO
|
||||
@@ -33,6 +35,7 @@ import com.cobblemon.mod.common.battles.interpreter.ContextManager
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.net.messages.client.battle.*
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.DamageTakenEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.LastBattleCriticalHitsEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.RecoilEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.evolution.progress.UseMoveEvolutionProgress
|
||||
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
|
||||
@@ -45,6 +48,7 @@ import net.minecraft.server.world.ServerWorld
|
||||
import net.minecraft.text.MutableText
|
||||
import net.minecraft.text.Text
|
||||
|
||||
@Suppress("KotlinPlaceholderCountMatchesArgumentCount", "UNUSED_PARAMETER")
|
||||
object ShowdownInterpreter {
|
||||
private val updateInstructions = mutableMapOf<String, (PokemonBattle, BattleMessage, MutableList<String>) -> Unit>()
|
||||
private val sideUpdateInstructions = mutableMapOf<String, (PokemonBattle, BattleActor, BattleMessage) -> Unit>()
|
||||
@@ -79,6 +83,7 @@ object ShowdownInterpreter {
|
||||
updateInstructions["|-mustrecharge|"] = this::handleRechargeInstructions
|
||||
updateInstructions["|-fail|"] = this::handleFailInstruction
|
||||
updateInstructions["|-start|"] = this::handleStartInstructions
|
||||
updateInstructions["|-block|"] = this::handleBlockInstructions
|
||||
updateInstructions["|-activate|"] = this::handleActivateInstructions
|
||||
updateInstructions["|-curestatus|"] = this::handleCureStatusInstruction
|
||||
updateInstructions["|-fieldstart|"] = this::handleFieldStartInstructions
|
||||
@@ -579,6 +584,17 @@ object ShowdownInterpreter {
|
||||
battle.end()
|
||||
|
||||
val wasCaught = battle.showdownMessages.any { "capture" in it }
|
||||
|
||||
// If the battle was a PvW battle, we need to set the killer of the wild Pokémon to the player
|
||||
if (battle.isPvW) {
|
||||
val nonPlayerActor = battle.actors.first { it.type == ActorType.WILD }
|
||||
val wildPokemon: BattlePokemon = nonPlayerActor.pokemonList.first()
|
||||
|
||||
if (!wasCaught && losers.any { it.uuid == wildPokemon.uuid }) {
|
||||
wildPokemon.effectedPokemon.entity?.killer = (battle.actors.firstOrNull { it.type == ActorType.PLAYER } as? PlayerBattleActor)?.entity
|
||||
}
|
||||
}
|
||||
|
||||
CobblemonEvents.BATTLE_VICTORY.post(BattleVictoryEvent(battle, winners, losers, wasCaught))
|
||||
|
||||
this.lastCauser.remove(battle.battleId)
|
||||
@@ -766,7 +782,10 @@ object ShowdownInterpreter {
|
||||
battle.broadcastChatMessage(battleLang("crit").yellow())
|
||||
this.lastCauser[battle.battleId]?.let { message ->
|
||||
val battlePokemon = message.getBattlePokemon(0, battle) ?: return@let
|
||||
battlePokemon.criticalHits++
|
||||
if (LastBattleCriticalHitsEvolutionProgress.supports(battlePokemon.effectedPokemon)) {
|
||||
val progress = battlePokemon.effectedPokemon.evolutionProxy.current().progressFirstOrCreate({ it is LastBattleCriticalHitsEvolutionProgress }) { LastBattleCriticalHitsEvolutionProgress() }
|
||||
progress.updateProgress(LastBattleCriticalHitsEvolutionProgress.Progress(progress.currentProgress().amount + 1))
|
||||
}
|
||||
}
|
||||
battle.minorBattleActions[pokemon.uuid] = message
|
||||
}
|
||||
@@ -809,10 +828,19 @@ object ShowdownInterpreter {
|
||||
*
|
||||
* The specified ACTION has failed against the POKEMON targetted.
|
||||
*/
|
||||
private fun handleFailInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList<String>){
|
||||
private fun handleFailInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList<String>) {
|
||||
battle.dispatchWaiting(1.5F){
|
||||
val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting
|
||||
battle.broadcastChatMessage(battleLang("fail").red())
|
||||
val pokemonName = pokemon.getName()
|
||||
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
|
||||
|
||||
val lang = when (effectID) {
|
||||
"shedtail" -> battleLang("fail.substitute", pokemonName)
|
||||
"hyperspacefury" -> battleLang("fail.darkvoid", pokemonName)
|
||||
"corrosivegas" -> battleLang("fail.healblock", pokemonName)
|
||||
else -> battleLang("fail.$effectID", pokemonName)
|
||||
}
|
||||
battle.broadcastChatMessage(lang.red())
|
||||
battle.minorBattleActions[pokemon.uuid] = message
|
||||
}
|
||||
}
|
||||
@@ -888,6 +916,8 @@ object ShowdownInterpreter {
|
||||
"confusion", "perish3" -> return@dispatch GO // Skip
|
||||
"perish2", "perish1", "perish0" -> battleLang("start.perish", pokemon.getName(), effectID.last().digitToInt())
|
||||
"dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow()
|
||||
"curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName())
|
||||
"disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData)
|
||||
else -> battleLang("start.$effectID", pokemon.getName())
|
||||
}
|
||||
battle.broadcastChatMessage(lang)
|
||||
@@ -931,6 +961,27 @@ object ShowdownInterpreter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format:
|
||||
* |-block|POKEMON|EFFECT|MOVE|ATTACKER
|
||||
*
|
||||
* An effect targeted at POKEMON was blocked by EFFECT. This may optionally specify that the effect was a MOVE from ATTACKER. [of]SOURCE will note the owner of the EFFECT, in the case that it's not EFFECT (for instance, an ally with Aroma Veil.)
|
||||
*/
|
||||
private fun handleBlockInstructions(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList<String>) {
|
||||
battle.dispatchWaiting(1.5F) {
|
||||
val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting
|
||||
val pokemonName = pokemon.getName()
|
||||
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
|
||||
val lang = when (effectID) {
|
||||
"matblock" -> battleLang("block.matblock", message.effectAt(2)!!.rawData)
|
||||
else -> battleLang("block.$effectID", pokemonName)
|
||||
}
|
||||
|
||||
battle.broadcastChatMessage(lang)
|
||||
battle.minorBattleActions[pokemon.uuid] = message
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format:
|
||||
* |-activate|POKEMON|EFFECT
|
||||
@@ -955,6 +1006,7 @@ object ShowdownInterpreter {
|
||||
"spite" -> battleLang("activate.spite", pokemonName, message.argumentAt(2)!!, message.argumentAt(3)!!)
|
||||
// Don't need additional lang, announced elsewhere
|
||||
"toxicdebris", "shedskin" -> return@dispatch GO
|
||||
"matblock" -> battleLang("activate.matblock", message.effectAt(2)!!.rawData)
|
||||
// Add activation to each Pokemon's history
|
||||
"destinybond" -> {
|
||||
battle.activePokemon.mapNotNull { it.battlePokemon?.uuid }.forEach { battle.minorBattleActions[it] = message }
|
||||
@@ -967,6 +1019,7 @@ object ShowdownInterpreter {
|
||||
}
|
||||
"focussash", "focusband" -> battleLang("activate.focusband", pokemonName, message.effectAt(1)!!.typelessData)
|
||||
"maxguard", "protect" -> battleLang("activate.protect", pokemonName)
|
||||
"shadowforce", "hyperspacefury", "hyperspacehole" -> battleLang("activate.phantomforce", pokemonName)
|
||||
else -> battleLang("activate.${effect.id}", pokemonName, sourceName)
|
||||
}
|
||||
battle.broadcastChatMessage(lang)
|
||||
@@ -1033,7 +1086,7 @@ object ShowdownInterpreter {
|
||||
|
||||
/**
|
||||
* Format:
|
||||
* |-ability|POKEMON|ABILITY|[from]EFFECT
|
||||
* |-ability|POKEMON|ABILITY|[from]EFFECT
|
||||
*
|
||||
* The ABILITY of the POKEMON has been changed due to a move/ability EFFECT.
|
||||
*
|
||||
@@ -1101,6 +1154,8 @@ object ShowdownInterpreter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Format:
|
||||
* |-swapboost|SOURCE|TARGET|STATS
|
||||
@@ -1398,6 +1453,8 @@ object ShowdownInterpreter {
|
||||
lang("status.$status.hurt", pokemonName)
|
||||
}
|
||||
"aftermath" -> battleLang("damage.generic", pokemonName)
|
||||
"chloroblast", "steelbeam" -> battleLang("damage.mindblown", pokemonName)
|
||||
"jumpkick" -> battleLang("damage.highjumpkick", pokemonName)
|
||||
else -> battleLang("damage.${effect.id}", pokemonName, sourceName)
|
||||
}
|
||||
battle.broadcastChatMessage(lang.red())
|
||||
@@ -1428,7 +1485,9 @@ object ShowdownInterpreter {
|
||||
GO
|
||||
}
|
||||
}
|
||||
privateMessage.pnxAndUuid(0)?.let { (pnx, _) -> battle.sendSidedUpdate(actor, BattleHealthChangePacket(pnx, remainingHealth.toFloat()), BattleHealthChangePacket(pnx, newHealthRatio)) }
|
||||
privateMessage.pnxAndUuid(0)?.let { (pnx, _) -> {
|
||||
battle.sendSidedUpdate(actor, BattleHealthChangePacket(pnx, remainingHealth.toFloat()), BattleHealthChangePacket(pnx, newHealthRatio))
|
||||
}}
|
||||
|
||||
battle.minorBattleActions[battlePokemon.uuid] = privateMessage
|
||||
WaitDispatch(1F)
|
||||
@@ -1488,7 +1547,7 @@ object ShowdownInterpreter {
|
||||
|
||||
/**
|
||||
* Format:
|
||||
* |-item|POKEMON|ITEM|[from]EFFECT
|
||||
* |-item|POKEMON|ITEM|[from]EFFECT
|
||||
*
|
||||
* The ITEM held by the POKEMON has been changed or revealed due to a move or ability EFFECT.
|
||||
*
|
||||
@@ -1511,7 +1570,7 @@ object ShowdownInterpreter {
|
||||
|
||||
/**
|
||||
* Format:
|
||||
* |-enditem|POKEMON|ITEM|[from]EFFECT
|
||||
* |-enditem|POKEMON|ITEM|[from]EFFECT
|
||||
*
|
||||
* The ITEM held by POKEMON has been destroyed by a move or ability, and it now holds no item.
|
||||
*
|
||||
@@ -1545,7 +1604,7 @@ object ShowdownInterpreter {
|
||||
val rawHpAndStatus = privateMessage.argumentAt(1)?.split(" ") ?: return
|
||||
val rawHpRatio = rawHpAndStatus.getOrNull(0) ?: return
|
||||
val newHealth = rawHpRatio.split("/").map { it.toFloatOrNull() ?: return }
|
||||
val newHealthRatio = rawHpRatio.split("/").map { it.toFloatOrNull()?.div(100) ?: return }
|
||||
val newHealthRatio = rawHpRatio.split("/").map { it.toFloatOrNull()?.div(newHealth[1]) ?: return }
|
||||
val effect = privateMessage.effect()
|
||||
val pokemonName = battlePokemon.getName()
|
||||
broadcastOptionalAbility(battle, effect, pokemonName)
|
||||
|
||||
@@ -64,11 +64,6 @@ open class BattlePokemon(
|
||||
/** A set of all the BattlePokemon that they faced during the battle (for exp purposes) */
|
||||
val facedOpponents = mutableSetOf<BattlePokemon>()
|
||||
|
||||
/**
|
||||
* A counter of critical hits during this battle, this is used for an evolution requirement.
|
||||
*/
|
||||
var criticalHits: Int = 0
|
||||
|
||||
/**
|
||||
* The [HeldItemManager] backing this [BattlePokemon].
|
||||
*/
|
||||
@@ -89,7 +84,12 @@ open class BattlePokemon(
|
||||
}
|
||||
|
||||
fun isSentOut() = actor.battle.activePokemon.any { it.battlePokemon == this }
|
||||
fun canBeSentOut() = !isSentOut() && !willBeSwitchedIn && health > 0
|
||||
fun canBeSentOut() =
|
||||
if (actor.request?.side?.pokemon?.get(0)?.reviving == true) {
|
||||
!isSentOut() && !willBeSwitchedIn && health <= 0
|
||||
} else {
|
||||
!isSentOut() && !willBeSwitchedIn && health > 0
|
||||
}
|
||||
|
||||
fun writeVariables(struct: VariableStruct) {
|
||||
effectedPokemon.writeVariables(struct)
|
||||
|
||||
@@ -166,7 +166,7 @@ class ApricornBlock(settings: Settings, val apricorn: Apricorn) : HorizontalFaci
|
||||
}
|
||||
|
||||
override fun attemptShear(world: World, state: BlockState, pos: BlockPos, successCallback: () -> Unit): Boolean {
|
||||
if (state.get(AGE) == MAX_AGE) {
|
||||
if (state.get(AGE) != MAX_AGE) {
|
||||
return false
|
||||
}
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_SHEEP_SHEAR, SoundCategory.BLOCKS, 1F, 1F)
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.block.BlockRenderType
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.BlockWithEntity
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.block.FarmlandBlock
|
||||
import net.minecraft.block.Fertilizable
|
||||
import net.minecraft.block.ShapeContext
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
@@ -186,7 +187,9 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Settings) :
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun canPlaceAt(state: BlockState, world: WorldView, pos: BlockPos): Boolean {
|
||||
val below = world.getBlockState(pos.down())
|
||||
return (state.get(WAS_GENERATED) && below.isIn(CobblemonBlockTags.BERRY_WILD_SOIL)) || below.isIn(CobblemonBlockTags.BERRY_SOIL)
|
||||
return (state.get(WAS_GENERATED) && below.isIn(CobblemonBlockTags.BERRY_WILD_SOIL))
|
||||
|| below.isIn(CobblemonBlockTags.BERRY_SOIL)
|
||||
|| below.block is FarmlandBlock
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
|
||||
@@ -114,7 +114,10 @@ class PastureBlock(properties: Settings): BlockWithEntity(properties), Waterlogg
|
||||
voxelShape(0.1875, 0.25, 0.25, 0.1875, 0.4375, 0.875, direction),
|
||||
voxelShape(0.8125, 0.25, 0.25, 0.8125, 0.4375, 0.875, direction),
|
||||
voxelShape(0.1875, 0.3125, 0.3125, 0.8125, 0.5, 0.3125, direction),
|
||||
voxelShape(0.25, 0.75, 0.3125, 0.75, 1.0, 0.8125, direction)
|
||||
voxelShape(0.25, 0.75, 0.3125, 0.75, 1.0, 0.8125, direction),
|
||||
// I'm lazy and this gets optimized in union anyway
|
||||
voxelShape(0.0, 0.0, 0.0, 0.0625, 1.0, 1.0, direction),
|
||||
voxelShape(0.9375, 0.0, 0.0, 1.0, 1.0, 1.0, direction),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.entity
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonBlockEntities
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.entity.BlockEntityType
|
||||
import net.minecraft.block.entity.HangingSignBlockEntity
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
class CobblemonHangingSignBlockEntity(pos: BlockPos, state: BlockState) : HangingSignBlockEntity(pos, state) {
|
||||
|
||||
override fun getType(): BlockEntityType<*> = CobblemonBlockEntities.HANGING_SIGN
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.entity
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonBlockEntities
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.entity.BlockEntityType
|
||||
import net.minecraft.block.entity.SignBlockEntity
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
class CobblemonSignBlockEntity(pos: BlockPos, state: BlockState) : SignBlockEntity(pos, state) {
|
||||
|
||||
override fun getType(): BlockEntityType<*> = CobblemonBlockEntities.SIGN
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.sign
|
||||
|
||||
import com.cobblemon.mod.common.block.entity.CobblemonHangingSignBlockEntity
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.HangingSignBlock
|
||||
import net.minecraft.block.WoodType
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
class CobblemonHangingSignBlock(settings: Settings, woodType: WoodType) : HangingSignBlock(settings, woodType) {
|
||||
|
||||
override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity = CobblemonHangingSignBlockEntity(pos, state)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.sign
|
||||
|
||||
import com.cobblemon.mod.common.block.entity.CobblemonSignBlockEntity
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.SignBlock
|
||||
import net.minecraft.block.WoodType
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
class CobblemonSignBlock(settings: Settings, woodType: WoodType) : SignBlock(settings, woodType) {
|
||||
|
||||
override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity = CobblemonSignBlockEntity(pos, state)
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.sign
|
||||
|
||||
import com.cobblemon.mod.common.block.entity.CobblemonHangingSignBlockEntity
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.WallHangingSignBlock
|
||||
import net.minecraft.block.WoodType
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
class CobblemonWallHangingSignBlock(settings: Settings, woodType: WoodType) : WallHangingSignBlock(settings, woodType) {
|
||||
|
||||
override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity = CobblemonHangingSignBlockEntity(pos, state)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.sign
|
||||
|
||||
import com.cobblemon.mod.common.block.entity.CobblemonSignBlockEntity
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.WallSignBlock
|
||||
import net.minecraft.block.WoodType
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
import net.minecraft.util.math.BlockPos
|
||||
|
||||
class CobblemonWallSignBlock(settings: Settings, woodType: WoodType) : WallSignBlock(settings, woodType) {
|
||||
|
||||
override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity = CobblemonSignBlockEntity(pos, state)
|
||||
|
||||
}
|
||||
@@ -9,74 +9,47 @@
|
||||
package com.cobblemon.mod.common.brewing
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonItems
|
||||
import com.cobblemon.mod.common.brewing.ingredient.CobblemonIngredient
|
||||
import com.cobblemon.mod.common.brewing.ingredient.CobblemonItemIngredient
|
||||
import com.cobblemon.mod.common.brewing.ingredient.CobblemonPotionIngredient
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.potion.Potion
|
||||
import net.minecraft.potion.Potions
|
||||
import net.minecraft.recipe.BrewingRecipeRegistry
|
||||
import net.minecraft.recipe.Ingredient
|
||||
|
||||
object BrewingRecipes {
|
||||
// Put things here if you want them to be add-able to the bottom of the brewing stand (like where potions go)
|
||||
@JvmField
|
||||
val brewableItems = mutableListOf(
|
||||
CobblemonItems.MEDICINAL_BREW,
|
||||
CobblemonItems.POTION,
|
||||
CobblemonItems.SUPER_POTION,
|
||||
CobblemonItems.HYPER_POTION,
|
||||
CobblemonItems.MAX_POTION,
|
||||
CobblemonItems.FULL_RESTORE,
|
||||
CobblemonItems.FULL_HEAL,
|
||||
CobblemonItems.ANTIDOTE,
|
||||
CobblemonItems.AWAKENING,
|
||||
CobblemonItems.BURN_HEAL,
|
||||
CobblemonItems.ICE_HEAL,
|
||||
CobblemonItems.PARALYZE_HEAL,
|
||||
CobblemonItems.ETHER,
|
||||
CobblemonItems.MAX_ETHER,
|
||||
CobblemonItems.ELIXIR,
|
||||
CobblemonItems.MAX_ELIXIR
|
||||
)
|
||||
|
||||
fun registerPotionTypes() {
|
||||
brewableItems.forEach { item ->
|
||||
BrewingRecipeRegistry.POTION_TYPES.add(Ingredient.ofItems(item))
|
||||
}
|
||||
}
|
||||
|
||||
fun getPotionRecipes(): List<Triple<Potion, Ingredient, Potion>> {
|
||||
return listOf(
|
||||
Triple(Potions.WATER, Ingredient.ofItems(CobblemonItems.MEDICINAL_LEEK), Potions.WATER), // This one is Mixin'd to result in brew rather than water
|
||||
val recipes: List<Triple<CobblemonIngredient, CobblemonIngredient, Item>> by lazy {
|
||||
listOf(
|
||||
Triple(CobblemonPotionIngredient(Potions.WATER), CobblemonItemIngredient(CobblemonItems.MEDICINAL_LEEK), CobblemonItems.MEDICINAL_BREW),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.LEPPA_BERRY, CobblemonItems.ETHER),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.HOPO_BERRY, CobblemonItems.ELIXIR),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.ORAN_BERRY, CobblemonItems.POTION),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.SITRUS_BERRY, CobblemonItems.HYPER_POTION),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_HEAL),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.PECHA_BERRY, CobblemonItems.ANTIDOTE),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.CHESTO_BERRY, CobblemonItems.AWAKENING),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.RAWST_BERRY, CobblemonItems.BURN_HEAL),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.ASPEAR_BERRY, CobblemonItems.ICE_HEAL),
|
||||
convert(CobblemonItems.MEDICINAL_BREW, CobblemonItems.CHERI_BERRY, CobblemonItems.PARALYZE_HEAL),
|
||||
convert(CobblemonItems.BURN_HEAL, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_HEAL),
|
||||
convert(CobblemonItems.ANTIDOTE, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_HEAL),
|
||||
convert(CobblemonItems.AWAKENING, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_HEAL),
|
||||
convert(CobblemonItems.ICE_HEAL, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_HEAL),
|
||||
convert(CobblemonItems.PARALYZE_HEAL, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_HEAL),
|
||||
convert(CobblemonItems.ETHER, CobblemonItems.PEP_UP_FLOWER, CobblemonItems.MAX_ETHER),
|
||||
convert(CobblemonItems.ELIXIR, CobblemonItems.PEP_UP_FLOWER, CobblemonItems.MAX_ELIXIR),
|
||||
convert(CobblemonItems.POTION, CobblemonItems.ENERGY_ROOT, CobblemonItems.SUPER_POTION),
|
||||
convert(CobblemonItems.SUPER_POTION, CobblemonItems.FIGY_BERRY, CobblemonItems.HYPER_POTION),
|
||||
convert(CobblemonItems.SUPER_POTION, CobblemonItems.WIKI_BERRY, CobblemonItems.HYPER_POTION),
|
||||
convert(CobblemonItems.SUPER_POTION, CobblemonItems.MAGO_BERRY, CobblemonItems.HYPER_POTION),
|
||||
convert(CobblemonItems.SUPER_POTION, CobblemonItems.AGUAV_BERRY, CobblemonItems.HYPER_POTION),
|
||||
convert(CobblemonItems.SUPER_POTION, CobblemonItems.IAPAPA_BERRY, CobblemonItems.HYPER_POTION),
|
||||
convert(CobblemonItems.HYPER_POTION, CobblemonItems.VIVICHOKE, CobblemonItems.MAX_POTION),
|
||||
convert(CobblemonItems.MAX_POTION, CobblemonItems.LUM_BERRY, CobblemonItems.FULL_RESTORE)
|
||||
)
|
||||
}
|
||||
|
||||
fun getItemRecipes(): List<Triple<Item, Ingredient, Item>> {
|
||||
// This is where the majority of our recipes go. First arg is thing down the bottom, second is thing up the top, third is results.
|
||||
return listOf(
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.LEPPA_BERRY), CobblemonItems.ETHER),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.HOPO_BERRY), CobblemonItems.ELIXIR),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.ORAN_BERRY), CobblemonItems.POTION),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.SITRUS_BERRY), CobblemonItems.HYPER_POTION),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_HEAL),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.PECHA_BERRY), CobblemonItems.ANTIDOTE),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.CHESTO_BERRY), CobblemonItems.AWAKENING),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.RAWST_BERRY), CobblemonItems.BURN_HEAL),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.ASPEAR_BERRY), CobblemonItems.ICE_HEAL),
|
||||
Triple(CobblemonItems.MEDICINAL_BREW, Ingredient.ofItems(CobblemonItems.CHERI_BERRY), CobblemonItems.PARALYZE_HEAL),
|
||||
Triple(CobblemonItems.BURN_HEAL, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_HEAL),
|
||||
Triple(CobblemonItems.ANTIDOTE, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_HEAL),
|
||||
Triple(CobblemonItems.AWAKENING, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_HEAL),
|
||||
Triple(CobblemonItems.ICE_HEAL, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_HEAL),
|
||||
Triple(CobblemonItems.PARALYZE_HEAL, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_HEAL),
|
||||
Triple(CobblemonItems.ETHER, Ingredient.ofItems(CobblemonItems.PEP_UP_FLOWER), CobblemonItems.MAX_ETHER),
|
||||
Triple(CobblemonItems.ELIXIR, Ingredient.ofItems(CobblemonItems.PEP_UP_FLOWER), CobblemonItems.MAX_ELIXIR),
|
||||
Triple(CobblemonItems.POTION, Ingredient.ofItems(CobblemonItems.ENERGY_ROOT), CobblemonItems.SUPER_POTION),
|
||||
Triple(CobblemonItems.SUPER_POTION, Ingredient.ofItems(CobblemonItems.FIGY_BERRY), CobblemonItems.HYPER_POTION),
|
||||
Triple(CobblemonItems.SUPER_POTION, Ingredient.ofItems(CobblemonItems.WIKI_BERRY), CobblemonItems.HYPER_POTION),
|
||||
Triple(CobblemonItems.SUPER_POTION, Ingredient.ofItems(CobblemonItems.MAGO_BERRY), CobblemonItems.HYPER_POTION),
|
||||
Triple(CobblemonItems.SUPER_POTION, Ingredient.ofItems(CobblemonItems.AGUAV_BERRY), CobblemonItems.HYPER_POTION),
|
||||
Triple(CobblemonItems.SUPER_POTION, Ingredient.ofItems(CobblemonItems.IAPAPA_BERRY), CobblemonItems.HYPER_POTION),
|
||||
Triple(CobblemonItems.HYPER_POTION, Ingredient.ofItems(CobblemonItems.VIVICHOKE), CobblemonItems.MAX_POTION),
|
||||
Triple(CobblemonItems.MAX_POTION, Ingredient.ofItems(CobblemonItems.LUM_BERRY), CobblemonItems.FULL_RESTORE)
|
||||
)
|
||||
|
||||
private fun convert(input: Item, ingredient: Item, output: Item): Triple<CobblemonIngredient, CobblemonIngredient, Item> {
|
||||
return Triple(CobblemonItemIngredient(input), CobblemonItemIngredient(ingredient), output)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.brewing.ingredient
|
||||
|
||||
import net.minecraft.item.ItemStack
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
/**
|
||||
* The Cobblemon representation of a brewing ingredient.
|
||||
* This is done to abstract platform specific requirements for a more custom solution to brewing.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
sealed interface CobblemonIngredient {
|
||||
|
||||
/**
|
||||
* Tests if a given [stack] is valid for this ingredient.
|
||||
*
|
||||
* @param stack The [ItemStack] being tested.
|
||||
* @return If the given [stack] is valid for this ingredient.
|
||||
*/
|
||||
fun matches(stack: ItemStack): Boolean
|
||||
|
||||
/**
|
||||
* Resolves list of [ItemStack]s that is used by the vanilla Ingredient implementation when a platform requires wrapping.
|
||||
*
|
||||
* @return A list of [ItemStack]s
|
||||
*/
|
||||
fun matchingStacks(): List<ItemStack>
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.brewing.ingredient
|
||||
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class CobblemonItemIngredient(val item: Item) : CobblemonIngredient {
|
||||
|
||||
override fun matches(stack: ItemStack): Boolean = stack.isOf(this.item)
|
||||
|
||||
override fun matchingStacks(): List<ItemStack> = listOf(this.item.defaultStack)
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.brewing.ingredient
|
||||
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.potion.Potion
|
||||
import net.minecraft.potion.PotionUtil
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
class CobblemonPotionIngredient(val potion: Potion) : CobblemonIngredient {
|
||||
|
||||
override fun matches(stack: ItemStack): Boolean {
|
||||
val potion = PotionUtil.getPotion(stack)
|
||||
return potion == this.potion
|
||||
}
|
||||
|
||||
override fun matchingStacks(): List<ItemStack> {
|
||||
val list = arrayListOf<ItemStack>()
|
||||
list += PotionUtil.setPotion(Items.POTION.defaultStack, this.potion)
|
||||
list += PotionUtil.setPotion(Items.SPLASH_POTION.defaultStack, this.potion)
|
||||
list += PotionUtil.setPotion(Items.LINGERING_POTION.defaultStack, this.potion)
|
||||
return list
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,10 +18,12 @@ import com.cobblemon.mod.common.client.gui.battle.BattleOverlay
|
||||
import com.cobblemon.mod.common.client.particle.BedrockParticleEffectRepository
|
||||
import com.cobblemon.mod.common.client.render.block.BerryBlockRenderer
|
||||
import com.cobblemon.mod.common.client.render.block.HealingMachineRenderer
|
||||
import com.cobblemon.mod.common.client.render.boat.CobblemonBoatRenderer
|
||||
import com.cobblemon.mod.common.client.render.item.CobblemonBuiltinItemRendererRegistry
|
||||
import com.cobblemon.mod.common.client.render.item.PokemonItemRenderer
|
||||
import com.cobblemon.mod.common.client.render.layer.PokemonOnShoulderRenderer
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.bedrock.animation.BedrockAnimationRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.BerryModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokeBallModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokemonModelRepository
|
||||
import com.cobblemon.mod.common.client.render.pokeball.PokeBallRenderer
|
||||
@@ -30,16 +32,19 @@ import com.cobblemon.mod.common.client.starter.ClientPlayerData
|
||||
import com.cobblemon.mod.common.client.storage.ClientStorageManager
|
||||
import com.cobblemon.mod.common.client.trade.ClientTrade
|
||||
import com.cobblemon.mod.common.data.CobblemonDataProvider
|
||||
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
|
||||
import com.cobblemon.mod.common.item.PokeBallItem
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.BerryModelRepository
|
||||
import com.cobblemon.mod.common.platform.events.PlatformEvents
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.render.RenderLayer
|
||||
import net.minecraft.client.render.block.entity.HangingSignBlockEntityRenderer
|
||||
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer
|
||||
import net.minecraft.client.render.entity.EntityRenderer
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory
|
||||
import net.minecraft.client.render.entity.LivingEntityRenderer
|
||||
import net.minecraft.client.render.entity.model.BoatEntityModel
|
||||
import net.minecraft.client.render.entity.model.ChestBoatEntityModel
|
||||
import net.minecraft.client.render.entity.model.PlayerEntityModel
|
||||
import net.minecraft.entity.player.PlayerEntity
|
||||
import net.minecraft.item.ItemStack
|
||||
@@ -83,12 +88,11 @@ object CobblemonClient {
|
||||
PlatformEvents.CLIENT_PLAYER_LOGIN.subscribe { onLogin() }
|
||||
PlatformEvents.CLIENT_PLAYER_LOGOUT.subscribe { onLogout() }
|
||||
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.HEALING_MACHINE, ::HealingMachineRenderer)
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.BERRY, ::BerryBlockRenderer)
|
||||
|
||||
this.registerBlockEntityRenderers()
|
||||
registerBlockRenderTypes()
|
||||
//registerColors()
|
||||
registerFlywheelRenderers()
|
||||
this.registerEntityRenderers()
|
||||
|
||||
LOGGER.info("Registering custom BuiltinItemRenderers")
|
||||
CobblemonBuiltinItemRendererRegistry.register(CobblemonItems.POKEMON_MODEL, PokemonItemRenderer())
|
||||
@@ -143,6 +147,10 @@ object CobblemonClient {
|
||||
RenderLayer.getCutout(),
|
||||
CobblemonBlocks.APRICORN_DOOR,
|
||||
CobblemonBlocks.APRICORN_TRAPDOOR,
|
||||
CobblemonBlocks.APRICORN_SIGN,
|
||||
CobblemonBlocks.APRICORN_WALL_SIGN,
|
||||
CobblemonBlocks.APRICORN_HANGING_SIGN,
|
||||
CobblemonBlocks.APRICORN_WALL_HANGING_SIGN,
|
||||
CobblemonBlocks.BLACK_APRICORN_SAPLING,
|
||||
CobblemonBlocks.BLUE_APRICORN_SAPLING,
|
||||
CobblemonBlocks.GREEN_APRICORN_SAPLING,
|
||||
@@ -176,6 +184,8 @@ object CobblemonClient {
|
||||
CobblemonBlocks.REVIVAL_HERB,
|
||||
*CobblemonBlocks.berries().values.toTypedArray()
|
||||
)
|
||||
|
||||
this.createBoatModelLayers()
|
||||
}
|
||||
|
||||
fun beforeChatRender(context: DrawContext, partialDeltaTicks: Float) {
|
||||
@@ -194,14 +204,22 @@ object CobblemonClient {
|
||||
renderer?.addFeature(PokemonOnShoulderRenderer(renderer))
|
||||
}
|
||||
|
||||
fun registerPokemonRenderer(context: EntityRendererFactory.Context): PokemonRenderer {
|
||||
LOGGER.info("Registering Pokémon renderer")
|
||||
return PokemonRenderer(context)
|
||||
private fun registerBlockEntityRenderers() {
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.HEALING_MACHINE, ::HealingMachineRenderer)
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.BERRY, ::BerryBlockRenderer)
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.SIGN, ::SignBlockEntityRenderer)
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.HANGING_SIGN, ::HangingSignBlockEntityRenderer)
|
||||
}
|
||||
|
||||
fun registerPokeBallRenderer(context: EntityRendererFactory.Context): PokeBallRenderer {
|
||||
private fun registerEntityRenderers() {
|
||||
LOGGER.info("Registering Pokémon renderer")
|
||||
this.implementation.registerEntityRenderer(CobblemonEntities.POKEMON, ::PokemonRenderer)
|
||||
LOGGER.info("Registering PokéBall renderer")
|
||||
return PokeBallRenderer(context)
|
||||
this.implementation.registerEntityRenderer(CobblemonEntities.EMPTY_POKEBALL, ::PokeBallRenderer)
|
||||
LOGGER.info("Registering Boat renderer")
|
||||
this.implementation.registerEntityRenderer(CobblemonEntities.BOAT) { ctx -> CobblemonBoatRenderer(ctx, false) }
|
||||
LOGGER.info("Registering Boat with Chest renderer")
|
||||
this.implementation.registerEntityRenderer(CobblemonEntities.CHEST_BOAT) { ctx -> CobblemonBoatRenderer(ctx, true) }
|
||||
}
|
||||
|
||||
fun reloadCodedAssets(resourceManager: ResourceManager) {
|
||||
@@ -215,7 +233,6 @@ object CobblemonClient {
|
||||
PokeBallModelRepository.reload(resourceManager)
|
||||
BerryModelRepository.reload(resourceManager)
|
||||
LOGGER.info("Loaded assets")
|
||||
// PokeBallModelRepository.reload(resourceManager)
|
||||
}
|
||||
|
||||
fun endBattle() {
|
||||
@@ -230,4 +247,11 @@ object CobblemonClient {
|
||||
return "${stack.translationKey}.tooltip"
|
||||
}
|
||||
|
||||
private fun createBoatModelLayers() {
|
||||
CobblemonBoatType.values().forEach { type ->
|
||||
this.implementation.registerLayer(CobblemonBoatRenderer.createBoatModelLayer(type, false), BoatEntityModel::getTexturedModelData)
|
||||
this.implementation.registerLayer(CobblemonBoatRenderer.createBoatModelLayer(type, true), ChestBoatEntityModel::getTexturedModelData)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,12 +13,14 @@ import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.battle.ClientBattleActor
|
||||
import com.cobblemon.mod.common.client.battle.SingleActionRequest
|
||||
import com.cobblemon.mod.common.client.gui.battle.subscreen.BattleActionSelection
|
||||
import com.cobblemon.mod.common.client.gui.battle.subscreen.BattleBackButton
|
||||
import com.cobblemon.mod.common.client.gui.battle.subscreen.BattleGeneralActionSelection
|
||||
import com.cobblemon.mod.common.client.gui.battle.subscreen.BattleSwitchPokemonSelection
|
||||
import com.cobblemon.mod.common.client.gui.battle.widgets.BattleMessagePane
|
||||
import com.cobblemon.mod.common.client.keybind.boundKey
|
||||
import com.cobblemon.mod.common.client.keybind.keybinds.PartySendBinding
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.net.messages.server.battle.RemoveSpectatorPacket
|
||||
import com.cobblemon.mod.common.util.battleLang
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.client.MinecraftClient
|
||||
@@ -41,6 +43,7 @@ class BattleGUI : Screen(battleLang("gui.title")) {
|
||||
private lateinit var messagePane: BattleMessagePane
|
||||
var opacity = 0F
|
||||
val actor = CobblemonClient.battle?.side1?.actors?.find { it.uuid == MinecraftClient.getInstance().player?.uuid }
|
||||
val specBackButton = BattleBackButton(12f, MinecraftClient.getInstance().window.scaledHeight - 32f)
|
||||
|
||||
var queuedActions = mutableListOf<() -> Unit>()
|
||||
|
||||
@@ -106,6 +109,10 @@ class BattleGUI : Screen(battleLang("gui.title")) {
|
||||
}
|
||||
}
|
||||
|
||||
if (battle.spectating) {
|
||||
specBackButton.render(context.matrices, mouseX, mouseY, delta)
|
||||
}
|
||||
|
||||
val currentSelection = getCurrentActionSelection()
|
||||
if (currentSelection == null || currentSelection is BattleGeneralActionSelection ) {
|
||||
drawScaledText(
|
||||
@@ -153,4 +160,13 @@ class BattleGUI : Screen(battleLang("gui.title")) {
|
||||
}
|
||||
return super.charTyped(chr, modifiers)
|
||||
}
|
||||
|
||||
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
|
||||
val battle = CobblemonClient.battle
|
||||
if (battle?.spectating == true && specBackButton.isHovered(mouseX, mouseY)) {
|
||||
RemoveSpectatorPacket(battle.battleId).sendToServer()
|
||||
CobblemonClient.endBattle()
|
||||
}
|
||||
return super.mouseClicked(mouseX, mouseY, button)
|
||||
}
|
||||
}
|
||||
+9
-4
@@ -9,8 +9,7 @@
|
||||
package com.cobblemon.mod.common.client.gui.battle.subscreen
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.battles.ShowdownPokemon
|
||||
import com.cobblemon.mod.common.battles.SwitchActionResponse
|
||||
import com.cobblemon.mod.common.battles.*
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.battle.SingleActionRequest
|
||||
import com.cobblemon.mod.common.client.gui.battle.BattleGUI
|
||||
@@ -24,6 +23,7 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder
|
||||
import net.minecraft.client.sound.PositionedSoundInstance
|
||||
import net.minecraft.client.sound.SoundManager
|
||||
import net.minecraft.client.util.math.MatrixStack
|
||||
import net.minecraft.server.network.ServerPlayerEntity
|
||||
import net.minecraft.util.math.MathHelper.ceil
|
||||
class BattleSwitchPokemonSelection(
|
||||
battleGUI: BattleGUI,
|
||||
@@ -83,7 +83,6 @@ class BattleSwitchPokemonSelection(
|
||||
partialTicks = deltaTicks
|
||||
)
|
||||
} catch (exception: Exception) {
|
||||
println(showdownPokemon.condition)
|
||||
throw exception
|
||||
}
|
||||
}
|
||||
@@ -98,9 +97,15 @@ class BattleSwitchPokemonSelection(
|
||||
.find { it.uuid == showdownPokemon.uuid }
|
||||
?.let { showdownPokemon to it }
|
||||
}
|
||||
.filter {
|
||||
if (request.side.pokemon[0].reviving) {
|
||||
"fnt" in it.first.condition
|
||||
} else {
|
||||
"fnt" !in it.first.condition
|
||||
}
|
||||
}
|
||||
.filter { it.second.uuid !in battleGUI.actor!!.activePokemon.map { it.battlePokemon?.uuid } }
|
||||
.filter { it.second.uuid !in switchingInPokemon }
|
||||
.filter { "fnt" !in it.first.condition || it.first.reviving }
|
||||
|
||||
showdownPokemonToPokemon.forEachIndexed { index, (showdownPokemon, pokemon) ->
|
||||
val row = index / 2
|
||||
|
||||
+29
-10
@@ -10,7 +10,9 @@ package com.cobblemon.mod.common.client.gui.interact.wheel
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonNetwork
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.BattleChallengePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.battle.SpectateBattlePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.pokemon.interact.InteractPokemonPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.trade.AcceptTradeRequestPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.trade.OfferTradePacket
|
||||
@@ -48,14 +50,14 @@ fun createPokemonInteractGui(pokemonID: UUID, canMountShoulder: Boolean): Intera
|
||||
return InteractWheelGUI(options, Text.translatable("cobblemon.ui.interact.pokemon"))
|
||||
}
|
||||
|
||||
fun createPlayerInteractGui(targetPlayer: PlayerEntity, pokemon: Pokemon): InteractWheelGUI {
|
||||
fun createPlayerInteractGui(optionsPacket: PlayerInteractOptionsPacket): InteractWheelGUI {
|
||||
val trade = InteractWheelOption(
|
||||
iconResource = cobblemonResource("textures/gui/interact/icon_trade.png"),
|
||||
colour = { if (CobblemonClient.requests.tradeOffers.any { it.traderId == targetPlayer.uuid }) Vector3f(0F, 0.6F, 0F) else null },
|
||||
colour = { if (CobblemonClient.requests.tradeOffers.any { it.traderId == optionsPacket.targetId }) Vector3f(0F, 0.6F, 0F) else null },
|
||||
onPress = {
|
||||
val tradeOffer = CobblemonClient.requests.tradeOffers.find { it.traderId == targetPlayer.uuid }
|
||||
val tradeOffer = CobblemonClient.requests.tradeOffers.find { it.traderId == optionsPacket.targetId }
|
||||
if (tradeOffer == null) {
|
||||
CobblemonNetwork.sendToServer(OfferTradePacket(targetPlayer.uuid))
|
||||
CobblemonNetwork.sendToServer(OfferTradePacket(optionsPacket.targetId))
|
||||
} else {
|
||||
CobblemonClient.requests.tradeOffers -= tradeOffer
|
||||
CobblemonNetwork.sendToServer(AcceptTradeRequestPacket(tradeOffer.tradeOfferId))
|
||||
@@ -65,18 +67,35 @@ fun createPlayerInteractGui(targetPlayer: PlayerEntity, pokemon: Pokemon): Inter
|
||||
)
|
||||
val battle = InteractWheelOption(
|
||||
iconResource = cobblemonResource("textures/gui/interact/icon_battle.png"),
|
||||
colour = { if (CobblemonClient.requests.battleChallenges.any { it.challengerId == targetPlayer.uuid }) Vector3f(0F, 0.6F, 0F) else null },
|
||||
colour = { if (CobblemonClient.requests.battleChallenges.any { it.challengerId == optionsPacket.targetId }) Vector3f(0F, 0.6F, 0F) else null },
|
||||
onPress = {
|
||||
val battleRequest = CobblemonClient.requests.battleChallenges.find { it.challengerId == targetPlayer.uuid }
|
||||
val battleRequest = CobblemonClient.requests.battleChallenges.find { it.challengerId == optionsPacket.targetId }
|
||||
// This can be improved in future with more detailed battle challenge data.
|
||||
BattleChallengePacket(targetPlayer.id, pokemon.uuid).sendToServer()
|
||||
BattleChallengePacket(optionsPacket.numericTargetId, optionsPacket.selectedPokemonId).sendToServer()
|
||||
closeGUI()
|
||||
}
|
||||
)
|
||||
val options = mutableMapOf(
|
||||
Orientation.TOP_LEFT to trade,
|
||||
Orientation.TOP_RIGHT to battle
|
||||
val spectate = InteractWheelOption(
|
||||
iconResource = cobblemonResource("textures/gui/interact/icon_spectate_battle.png"),
|
||||
colour = { if (CobblemonClient.requests.battleChallenges.any { it.challengerId == optionsPacket.targetId }) Vector3f(0F, 0.6F, 0F) else null },
|
||||
onPress = {
|
||||
SpectateBattlePacket(optionsPacket.targetId).sendToServer()
|
||||
closeGUI()
|
||||
}
|
||||
)
|
||||
val options = mutableMapOf<Orientation, InteractWheelOption>()
|
||||
//The way things are positioned should probably be more thought out if more options are added
|
||||
optionsPacket.options.map {
|
||||
if (it.equals(PlayerInteractOptionsPacket.Options.TRADE)) {
|
||||
options[Orientation.TOP_LEFT] = trade
|
||||
}
|
||||
if (it.equals(PlayerInteractOptionsPacket.Options.BATTLE)) {
|
||||
options[Orientation.TOP_RIGHT] = battle
|
||||
}
|
||||
if (it.equals(PlayerInteractOptionsPacket.Options.SPECTATE_BATTLE)) {
|
||||
options[Orientation.TOP_RIGHT] = spectate
|
||||
}
|
||||
}
|
||||
return InteractWheelGUI(options, Text.translatable("cobblemon.ui.interact.player"))
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.cobblemon.mod.common.client.gui.ExitButton
|
||||
import com.cobblemon.mod.common.client.gui.TypeIcon
|
||||
import com.cobblemon.mod.common.client.gui.summary.Summary
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.ModelWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.common.reformatNatureTextIfMinted
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.client.storage.ClientPC
|
||||
import com.cobblemon.mod.common.client.storage.ClientParty
|
||||
@@ -31,7 +32,6 @@ import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.gui.screen.Screen
|
||||
import net.minecraft.client.sound.PositionedSoundInstance
|
||||
import net.minecraft.client.util.InputUtil
|
||||
import net.minecraft.client.util.math.MatrixStack
|
||||
import net.minecraft.sound.SoundEvent
|
||||
import net.minecraft.text.Text
|
||||
|
||||
@@ -309,14 +309,18 @@ class PCGUI(
|
||||
).render(context)
|
||||
|
||||
// Nature
|
||||
val natureText = reformatNatureTextIfMinted(pokemon)
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = pokemon.nature.displayName.asTranslated(),
|
||||
text = natureText,
|
||||
x = x + 39,
|
||||
y = y + 137,
|
||||
centered = true,
|
||||
shadow = true,
|
||||
scale = SCALE
|
||||
scale = SCALE,
|
||||
colour = 0x32CBFF,
|
||||
pMouseX = mouseX,
|
||||
pMouseY = mouseY
|
||||
)
|
||||
|
||||
// Ability
|
||||
@@ -402,8 +406,14 @@ class PCGUI(
|
||||
if (pokemon != null && !pokemon.heldItemNoCopy().isEmpty) {
|
||||
val itemX = x + 3
|
||||
val itemY = y + 98
|
||||
val itemHovered = mouseX.toFloat() in (itemX.toFloat()..(itemX.toFloat() + 16)) && mouseY.toFloat() in (itemY.toFloat()..(itemY.toFloat() + 16))
|
||||
if (itemHovered) context.drawItemTooltip(MinecraftClient.getInstance().textRenderer, pokemon.heldItemNoCopy(), mouseX, mouseY)
|
||||
val itemHovered =
|
||||
mouseX.toFloat() in (itemX.toFloat()..(itemX.toFloat() + 16)) && mouseY.toFloat() in (itemY.toFloat()..(itemY.toFloat() + 16))
|
||||
if (itemHovered) context.drawItemTooltip(
|
||||
MinecraftClient.getInstance().textRenderer,
|
||||
pokemon.heldItemNoCopy(),
|
||||
mouseX,
|
||||
mouseY
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,12 +426,22 @@ class PCGUI(
|
||||
}
|
||||
|
||||
override fun mouseScrolled(mouseX: Double, mouseY: Double, amount: Double): Boolean {
|
||||
if (storageWidget.pastureWidget != null) storageWidget.pastureWidget!!.pastureScrollList.mouseScrolled(mouseX, mouseY, amount)
|
||||
if (storageWidget.pastureWidget != null) storageWidget.pastureWidget!!.pastureScrollList.mouseScrolled(
|
||||
mouseX,
|
||||
mouseY,
|
||||
amount
|
||||
)
|
||||
return children().any { it.mouseScrolled(mouseX, mouseY, amount) }
|
||||
}
|
||||
|
||||
override fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, deltaX: Double, deltaY: Double): Boolean {
|
||||
if (storageWidget.pastureWidget != null) storageWidget.pastureWidget!!.pastureScrollList.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)
|
||||
if (storageWidget.pastureWidget != null) storageWidget.pastureWidget!!.pastureScrollList.mouseDragged(
|
||||
mouseX,
|
||||
mouseY,
|
||||
button,
|
||||
deltaX,
|
||||
deltaY
|
||||
)
|
||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)
|
||||
}
|
||||
|
||||
@@ -431,10 +451,12 @@ class PCGUI(
|
||||
playSound(CobblemonSounds.PC_OFF)
|
||||
UnlinkPlayerFromPCPacket().sendToServer()
|
||||
}
|
||||
|
||||
InputUtil.GLFW_KEY_RIGHT -> {
|
||||
playSound(CobblemonSounds.PC_CLICK)
|
||||
this.storageWidget.box += 1
|
||||
}
|
||||
|
||||
InputUtil.GLFW_KEY_LEFT -> {
|
||||
playSound(CobblemonSounds.PC_CLICK)
|
||||
this.storageWidget.box -= 1
|
||||
@@ -454,7 +476,7 @@ class PCGUI(
|
||||
ticksElapsed++
|
||||
|
||||
// Calculate select pointer offset
|
||||
var delayFactor = 3
|
||||
val delayFactor = 3
|
||||
if (ticksElapsed % (2 * delayFactor) == 0) selectPointerOffsetIncrement = !selectPointerOffsetIncrement
|
||||
if (ticksElapsed % delayFactor == 0) selectPointerOffsetY += if (selectPointerOffsetIncrement) 1 else -1
|
||||
}
|
||||
@@ -480,8 +502,8 @@ class PCGUI(
|
||||
offsetY = -10.0
|
||||
)
|
||||
} else {
|
||||
previewPokemon = null;
|
||||
modelWidget = null;
|
||||
previewPokemon = null
|
||||
modelWidget = null
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.summary.widgets.common
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonItems
|
||||
import com.cobblemon.mod.common.api.text.italicise
|
||||
import com.cobblemon.mod.common.api.text.onHover
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
import net.minecraft.text.MutableText
|
||||
|
||||
|
||||
/**
|
||||
* Italicizes the nature text and makes it include the name of the MintItem used to mint the Pokémon's nature
|
||||
*/
|
||||
fun reformatNatureTextIfMinted(pokemon: Pokemon): MutableText {
|
||||
var natureText = pokemon.nature.displayName.asTranslated()
|
||||
if (pokemon.mintedNature != null) {
|
||||
CobblemonItems.mints[pokemon.mintedNature!!.displayName]?.let { mint ->
|
||||
natureText = natureText.italicise().onHover(mint.name)
|
||||
}
|
||||
}
|
||||
return natureText
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.summary.widgets.screens.info
|
||||
|
||||
import com.cobblemon.mod.common.api.text.*
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.text.MutableText
|
||||
import net.minecraft.text.Text
|
||||
import net.minecraft.util.Identifier
|
||||
|
||||
class InfoBlockWidget(
|
||||
pX: Int,
|
||||
pY: Int,
|
||||
blockWidth: Int,
|
||||
blockHeight: Int,
|
||||
private val text: MutableText,
|
||||
private val withinRowVerticalTextOffset: Int,
|
||||
private val font: Identifier,
|
||||
) : SoundlessWidget(pX, pY, blockWidth, blockHeight, Text.literal("InfoBlockWidget")) {
|
||||
|
||||
|
||||
override fun renderButton(context: DrawContext, pMouseX: Int, pMouseY: Int, pPartialTicks: Float) {
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = font,
|
||||
text = text.bold(),
|
||||
x = x,
|
||||
y = y + withinRowVerticalTextOffset,
|
||||
shadow = true,
|
||||
pMouseX = pMouseX,
|
||||
pMouseY = pMouseY
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.summary.widgets.screens.info
|
||||
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.text.MutableText
|
||||
import net.minecraft.text.Text
|
||||
|
||||
class InfoOneLineWidget(
|
||||
pX: Int,
|
||||
pY: Int,
|
||||
width: Int,
|
||||
height: Int = ROW_HEIGHT,
|
||||
private val label: MutableText,
|
||||
private val value: MutableText,
|
||||
) : SoundlessWidget(pX, pY, width, height, Text.literal("InfoOneLineWidget")) {
|
||||
companion object {
|
||||
private val FONT = CobblemonResources.DEFAULT_LARGE
|
||||
private const val ROW_HEIGHT = 15
|
||||
private const val WITHIN_ROW_VERTICAL_OFFSET = 6
|
||||
private const val LABEL_HORIZONTAL_OFFSET = 8
|
||||
private const val VALUE_HORIZONTAL_OFFSET = 53
|
||||
}
|
||||
|
||||
|
||||
override fun renderButton(context: DrawContext, pMouseX: Int, pMouseY: Int, pPartialTicks: Float) {
|
||||
|
||||
// Label
|
||||
val label = InfoBlockWidget(
|
||||
pX = x + LABEL_HORIZONTAL_OFFSET,
|
||||
pY = y,
|
||||
blockWidth = MinecraftClient.getInstance().textRenderer.getWidth(label),
|
||||
blockHeight = height,
|
||||
text = label,
|
||||
font = FONT,
|
||||
withinRowVerticalTextOffset = WITHIN_ROW_VERTICAL_OFFSET
|
||||
)
|
||||
label.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
// Value
|
||||
val value = InfoBlockWidget(
|
||||
pX = x + VALUE_HORIZONTAL_OFFSET,
|
||||
pY = y,
|
||||
blockWidth = MinecraftClient.getInstance().textRenderer.getWidth(value),
|
||||
blockHeight = height,
|
||||
text = value,
|
||||
font = FONT,
|
||||
withinRowVerticalTextOffset = WITHIN_ROW_VERTICAL_OFFSET
|
||||
)
|
||||
value.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
}
|
||||
|
||||
}
|
||||
+65
-108
@@ -11,11 +11,10 @@ package com.cobblemon.mod.common.client.gui.summary.widgets.screens.info
|
||||
import com.cobblemon.mod.common.api.gui.ColourLibrary
|
||||
import com.cobblemon.mod.common.api.gui.MultiLineLabelK
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.text.bold
|
||||
import com.cobblemon.mod.common.api.text.plus
|
||||
import com.cobblemon.mod.common.api.text.text
|
||||
import com.cobblemon.mod.common.api.text.*
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.common.reformatNatureTextIfMinted
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
@@ -23,17 +22,21 @@ import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.text.MutableText
|
||||
import net.minecraft.text.Text
|
||||
import net.minecraft.text.TextContent
|
||||
|
||||
|
||||
class InfoWidget(
|
||||
pX: Int,
|
||||
pY: Int,
|
||||
private val pokemon: Pokemon
|
||||
): SoundlessWidget(pX, pY, WIDTH, HEIGHT, Text.literal("InfoWidget")) {
|
||||
) : SoundlessWidget(pX, pY, WIDTH, HEIGHT, Text.literal("InfoWidget")) {
|
||||
companion object {
|
||||
private const val WIDTH = 134
|
||||
private const val HEIGHT = 148
|
||||
private val infoBaseResource = cobblemonResource("textures/gui/summary/summary_info_base.png")
|
||||
private const val ROW_HEIGHT = 15
|
||||
}
|
||||
|
||||
override fun renderButton(context: DrawContext, pMouseX: Int, pMouseY: Int, pPartialTicks: Float) {
|
||||
@@ -42,137 +45,89 @@ class InfoWidget(
|
||||
blitk(
|
||||
matrixStack = matrices,
|
||||
texture = infoBaseResource,
|
||||
x= x,
|
||||
x = x,
|
||||
y = y,
|
||||
width = width,
|
||||
height = height
|
||||
)
|
||||
|
||||
// Pokédex Number
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.info.pokedex_number").bold(),
|
||||
x = x + 8,
|
||||
y = y + 6,
|
||||
shadow = true
|
||||
)
|
||||
|
||||
// Pokédex Number
|
||||
// Add preceding zeroes if Pokédex number is less than 3 digits
|
||||
var dexNo = pokemon.species.nationalPokedexNumber.toString()
|
||||
while(dexNo.length < 3) {
|
||||
dexNo = "0$dexNo";
|
||||
while (dexNo.length < 3) {
|
||||
dexNo = "0$dexNo"
|
||||
}
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = dexNo.text().bold(),
|
||||
x = x + 53,
|
||||
y = y + 6,
|
||||
shadow = true
|
||||
val pokedexNumberWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y,
|
||||
width = width,
|
||||
label = lang("ui.info.pokedex_number"),
|
||||
value = dexNo.text()
|
||||
)
|
||||
pokedexNumberWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
|
||||
// Species
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.info.species").bold(),
|
||||
x = x + 8,
|
||||
y = y + 21,
|
||||
shadow = true
|
||||
)
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = pokemon.species.translatedName.bold(),
|
||||
x = x + 53,
|
||||
y = y + 21,
|
||||
shadow = true
|
||||
val speciesWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + ROW_HEIGHT,
|
||||
width = width,
|
||||
label = lang("ui.info.species"),
|
||||
value = pokemon.species.translatedName
|
||||
)
|
||||
speciesWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
// Type
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.info.type").bold(),
|
||||
x = x + 8,
|
||||
y = y + 36,
|
||||
shadow = true
|
||||
)
|
||||
|
||||
val type = pokemon.types.map { it.displayName.copy() }.reduce { acc, next -> acc.plus("/").plus(next) }
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = type.bold(),
|
||||
x = x + 53,
|
||||
y = y + 36,
|
||||
shadow = true
|
||||
val typeWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + 2 * ROW_HEIGHT,
|
||||
width = width,
|
||||
label = lang("ui.info.type"),
|
||||
value = type
|
||||
)
|
||||
typeWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
// OT
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.info.original_trainer").bold(),
|
||||
x = x + 8,
|
||||
y = y + 51,
|
||||
shadow = true
|
||||
)
|
||||
|
||||
var displayName: MutableText = MutableText.of(TextContent.EMPTY)
|
||||
if (pokemon.isPlayerOwned() && pokemon.getOwnerPlayer() != null) {
|
||||
pokemon.getOwnerPlayer()?.displayName?.copy()?.let {
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = it.bold(),
|
||||
x = x + 53,
|
||||
y = y + 51,
|
||||
shadow = true
|
||||
)
|
||||
}
|
||||
displayName = pokemon.getOwnerPlayer()!!.displayName.copy()
|
||||
}
|
||||
val otWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + 3 * ROW_HEIGHT,
|
||||
width = width,
|
||||
label = lang("ui.info.original_trainer"),
|
||||
value = displayName // You'll need to provide the value for the Original Trainer
|
||||
)
|
||||
otWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
|
||||
// Nature
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.info.nature").bold(),
|
||||
x = x + 8,
|
||||
y = y + 66,
|
||||
shadow = true
|
||||
)
|
||||
// Get the name of the MintItem used to mint the Pokémon's nature
|
||||
val natureText = reformatNatureTextIfMinted(pokemon)
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = pokemon.nature.displayName.asTranslated().bold(),
|
||||
x = x + 53,
|
||||
y = y + 66,
|
||||
shadow = true
|
||||
val natureWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + 4 * ROW_HEIGHT,
|
||||
width = width,
|
||||
label = lang("ui.info.nature"),
|
||||
value = natureText,
|
||||
)
|
||||
natureWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
|
||||
// Ability
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.info.ability").bold(),
|
||||
x = x + 8,
|
||||
y = y + 81,
|
||||
shadow = true
|
||||
)
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = pokemon.ability.displayName.asTranslated().bold(),
|
||||
x = x + 53,
|
||||
y = y + 81,
|
||||
shadow = true
|
||||
val abilityWidget = InfoOneLineWidget(
|
||||
pX = x,
|
||||
pY = y + 5 * ROW_HEIGHT,
|
||||
width = width,
|
||||
label = lang("ui.info.ability").bold(),
|
||||
value = pokemon.ability.displayName.asTranslated().bold()
|
||||
)
|
||||
abilityWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
val smallTextScale = 0.5F
|
||||
|
||||
@@ -212,8 +167,10 @@ class InfoWidget(
|
||||
|
||||
val mcFont = MinecraftClient.getInstance().textRenderer
|
||||
val experience = pokemon.experience.toString().text()
|
||||
val experienceForThisLevel = pokemon.experience - if (pokemon.level == 1) 0 else pokemon.experienceGroup.getExperience(pokemon.level)
|
||||
val experienceToNext = pokemon.experienceGroup.getExperience(pokemon.level + 1) - pokemon.experienceGroup.getExperience(pokemon.level)
|
||||
val experienceForThisLevel =
|
||||
pokemon.experience - if (pokemon.level == 1) 0 else pokemon.experienceGroup.getExperience(pokemon.level)
|
||||
val experienceToNext =
|
||||
pokemon.experienceGroup.getExperience(pokemon.level + 1) - pokemon.experienceGroup.getExperience(pokemon.level)
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.ExitButton
|
||||
import com.cobblemon.mod.common.client.gui.TypeIcon
|
||||
import com.cobblemon.mod.common.client.gui.summary.Summary
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.common.reformatNatureTextIfMinted
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.client.trade.ClientTrade
|
||||
import com.cobblemon.mod.common.net.messages.client.trade.TradeStartedPacket.TradeablePokemon
|
||||
@@ -36,7 +37,6 @@ import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.gui.screen.Screen
|
||||
import net.minecraft.client.sound.PositionedSoundInstance
|
||||
import net.minecraft.client.util.InputUtil
|
||||
import net.minecraft.client.util.math.MatrixStack
|
||||
import net.minecraft.sound.SoundEvent
|
||||
import net.minecraft.text.MutableText
|
||||
|
||||
@@ -266,8 +266,8 @@ class TradeGUI(
|
||||
|
||||
renderInfoLabels(context, x, y)
|
||||
|
||||
renderPokemonInfo(offeredPokemon, false, context, x, y)
|
||||
renderPokemonInfo(opposingOfferedPokemon, true, context, x, y)
|
||||
renderPokemonInfo(offeredPokemon, false, context, x, y, mouseX, mouseY)
|
||||
renderPokemonInfo(opposingOfferedPokemon, true, context, x, y, mouseX, mouseY)
|
||||
|
||||
if (trade.acceptedOppositeOffer) {
|
||||
blitk(
|
||||
@@ -373,7 +373,7 @@ class TradeGUI(
|
||||
}
|
||||
|
||||
// Calculate select pointer offset
|
||||
var delayFactor = 3
|
||||
val delayFactor = 3
|
||||
if (ticksElapsed % (2 * delayFactor) == 0) selectPointerOffsetIncrement = !selectPointerOffsetIncrement
|
||||
if (ticksElapsed % delayFactor == 0) selectPointerOffsetY += if (selectPointerOffsetIncrement) 1 else -1
|
||||
|
||||
@@ -422,7 +422,7 @@ class TradeGUI(
|
||||
MinecraftClient.getInstance().soundManager.play(PositionedSoundInstance.master(soundEvent, 1.0F))
|
||||
}
|
||||
|
||||
private fun renderPokemonInfo(pokemon: Pokemon?, isOpposing: Boolean, context: DrawContext, x: Int, y: Int) {
|
||||
private fun renderPokemonInfo(pokemon: Pokemon?, isOpposing: Boolean, context: DrawContext, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
||||
if (pokemon != null) {
|
||||
val matrices = context.matrices
|
||||
// Level
|
||||
@@ -530,14 +530,17 @@ class TradeGUI(
|
||||
val labelXOffset = if (isOpposing) 77 else 0
|
||||
|
||||
// Nature
|
||||
val natureText = reformatNatureTextIfMinted(pokemon)
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = pokemon.nature.displayName.asTranslated(),
|
||||
text = natureText,
|
||||
x = x + 108 + labelXOffset,
|
||||
y = y + 146.5,
|
||||
centered = true,
|
||||
shadow = true,
|
||||
scale = SCALE
|
||||
scale = SCALE,
|
||||
pMouseX = mouseX,
|
||||
pMouseY = mouseY
|
||||
)
|
||||
|
||||
// Ability
|
||||
|
||||
+4
-3
@@ -11,15 +11,14 @@ package com.cobblemon.mod.common.client.keybind.keybinds
|
||||
import com.cobblemon.mod.common.CobblemonNetwork.sendPacketToServer
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.gui.battle.BattleGUI
|
||||
import com.cobblemon.mod.common.client.gui.interact.wheel.createPlayerInteractGui
|
||||
import com.cobblemon.mod.common.client.keybind.CobblemonBlockingKeyBinding
|
||||
import com.cobblemon.mod.common.client.keybind.KeybindCategories
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.net.messages.server.BattleChallengePacket
|
||||
import com.cobblemon.mod.common.net.messages.server.RequestPlayerInteractionsPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.SendOutPokemonPacket
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.traceFirstEntityCollision
|
||||
import javax.swing.plaf.basic.BasicSliderUI.ScrollListener
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.network.ClientPlayerEntity
|
||||
import net.minecraft.client.util.InputUtil
|
||||
@@ -90,7 +89,9 @@ object PartySendBinding : CobblemonBlockingKeyBinding(
|
||||
private fun processEntityTarget(player: ClientPlayerEntity, pokemon: Pokemon, entity: LivingEntity) {
|
||||
when (entity) {
|
||||
is PlayerEntity -> {
|
||||
MinecraftClient.getInstance().setScreen(createPlayerInteractGui(entity, pokemon))
|
||||
//This sends a packet to the server with the id of the player
|
||||
//The server sends a packet back that opens the player interaction menu with the proper options
|
||||
sendPacketToServer(RequestPlayerInteractionsPacket(entity.uuid, entity.id, pokemon.uuid))
|
||||
}
|
||||
is PokemonEntity -> {
|
||||
if (!entity.canBattle(player)) return
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.net
|
||||
|
||||
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.client.gui.interact.wheel.createPlayerInteractGui
|
||||
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
|
||||
import net.minecraft.client.MinecraftClient
|
||||
|
||||
object PlayerInteractOptionsHandler : ClientNetworkPacketHandler<PlayerInteractOptionsPacket> {
|
||||
override fun handle(packet: PlayerInteractOptionsPacket, client: MinecraftClient) {
|
||||
MinecraftClient.getInstance().setScreen(createPlayerInteractGui(packet))
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -32,10 +32,10 @@ object BattleInitializeHandler : ClientNetworkPacketHandler<BattleInitializePack
|
||||
}
|
||||
|
||||
val otherSide = if (mySide == packet.side1) packet.side2 else packet.side1
|
||||
|
||||
side1.actors.addAll(mySide.actors.map{ actorFromDTO(it, true) })
|
||||
val sides = listOf(packet.side1, packet.side2)
|
||||
spectating = !sides.any { it.actors.any { it.uuid == MinecraftClient.getInstance().player?.uuid } }
|
||||
side1.actors.addAll(mySide.actors.map{ actorFromDTO(it, !spectating) })
|
||||
side2.actors.addAll(otherSide.actors.map{ actorFromDTO(it, false) })
|
||||
spectating = sides.any { it.actors.any { it.uuid == MinecraftClient.getInstance().player?.uuid } }
|
||||
for (side in listOf(side1, side2)) {
|
||||
side.battle = this
|
||||
for (actor in side.actors) {
|
||||
|
||||
@@ -115,6 +115,7 @@ fun getDepletableRedGreen(
|
||||
return r.toFloat() to g.toFloat()
|
||||
}
|
||||
|
||||
|
||||
fun drawScaledText(
|
||||
context: DrawContext,
|
||||
font: Identifier? = null,
|
||||
@@ -126,7 +127,9 @@ fun drawScaledText(
|
||||
maxCharacterWidth: Int = Int.MAX_VALUE,
|
||||
colour: Int = 0x00FFFFFF + ((opacity.toFloat() * 255).toInt() shl 24),
|
||||
centered: Boolean = false,
|
||||
shadow: Boolean = false
|
||||
shadow: Boolean = false,
|
||||
pMouseX: Int? = null,
|
||||
pMouseY: Int? = null
|
||||
) {
|
||||
if (opacity.toFloat() < 0.05F) {
|
||||
return
|
||||
@@ -138,7 +141,7 @@ fun drawScaledText(
|
||||
val matrices = context.matrices
|
||||
matrices.push()
|
||||
matrices.scale(scale * extraScale, scale * extraScale, 1F)
|
||||
drawText(
|
||||
val isHovered = drawText(
|
||||
context = context,
|
||||
font = font,
|
||||
text = text,
|
||||
@@ -146,9 +149,15 @@ fun drawScaledText(
|
||||
y = y.toFloat() / (scale * extraScale) + (1 - extraScale) * fontHeight * scale,
|
||||
centered = centered,
|
||||
colour = colour,
|
||||
shadow = shadow
|
||||
shadow = shadow,
|
||||
pMouseX = pMouseX?.toFloat()?.div((scale * extraScale)),
|
||||
pMouseY = pMouseY?.toFloat()?.div(scale * extraScale)?.plus((1 - extraScale) * fontHeight * scale)
|
||||
)
|
||||
matrices.pop()
|
||||
// Draw tooltip that was created with onHover and is attached to the MutableText
|
||||
if (isHovered) {
|
||||
context.drawHoverEvent(MinecraftClient.getInstance().textRenderer, text.style, pMouseX!!, pMouseY!!)
|
||||
}
|
||||
}
|
||||
|
||||
fun drawScaledText(
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.boat
|
||||
|
||||
import com.cobblemon.mod.common.entity.boat.CobblemonBoatEntity
|
||||
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.client.render.OverlayTexture
|
||||
import net.minecraft.client.render.RenderLayer
|
||||
import net.minecraft.client.render.VertexConsumerProvider
|
||||
import net.minecraft.client.render.entity.EntityRenderer
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory
|
||||
import net.minecraft.client.render.entity.model.BoatEntityModel
|
||||
import net.minecraft.client.render.entity.model.ChestBoatEntityModel
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer
|
||||
import net.minecraft.client.util.math.MatrixStack
|
||||
import net.minecraft.util.Identifier
|
||||
import net.minecraft.util.math.MathHelper
|
||||
import net.minecraft.util.math.RotationAxis
|
||||
import org.joml.Quaternionf
|
||||
|
||||
class CobblemonBoatRenderer(ctx: EntityRendererFactory.Context, private val hasChest: Boolean) : EntityRenderer<CobblemonBoatEntity>(ctx) {
|
||||
|
||||
private val boatModels = hashMapOf<CobblemonBoatType, Pair<Identifier, BoatEntityModel>>()
|
||||
|
||||
init {
|
||||
this.shadowRadius = 0.8F
|
||||
CobblemonBoatType.values().forEach { type ->
|
||||
this.boatModels[type] = generateTextureIdentifier(type, this.hasChest) to generateBoatModel(ctx, type, this.hasChest)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTexture(entity: CobblemonBoatEntity): Identifier = this.boatModels[entity.boatType]!!.first
|
||||
|
||||
override fun render(entity: CobblemonBoatEntity, yaw: Float, tickDelta: Float, matrices: MatrixStack, vertexConsumers: VertexConsumerProvider, light: Int) {
|
||||
matrices.push()
|
||||
matrices.translate(0F, 0.375F, 0F)
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180F - yaw))
|
||||
val h = entity.damageWobbleTicks - tickDelta
|
||||
val j = (entity.damageWobbleStrength - tickDelta).coerceAtLeast(0F)
|
||||
if (h > 0F) {
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(MathHelper.sin(h) * h * j / 10F * entity.damageWobbleSide))
|
||||
}
|
||||
val k = entity.interpolateBubbleWobble(tickDelta)
|
||||
if (!MathHelper.approximatelyEquals(k, 0F)) {
|
||||
matrices.multiply(Quaternionf().setAngleAxis(entity.interpolateBubbleWobble(tickDelta) * 0.017453292F, 1F, 0F, 1F))
|
||||
}
|
||||
val (identifier, entityModel) = this.boatModels[entity.boatType]!!
|
||||
matrices.scale(-1F, -1F, 1F)
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(90F))
|
||||
entityModel.setAngles(entity, tickDelta, 0F, -0.1F, 0F, 0F)
|
||||
val vertexConsumer = vertexConsumers.getBuffer(entityModel.getLayer(identifier))
|
||||
entityModel.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1F, 1F, 1F, 1F)
|
||||
if (!entity.isSubmergedInWater) {
|
||||
val vertexConsumer2 = vertexConsumers.getBuffer(RenderLayer.getWaterMask())
|
||||
entityModel.waterPatch.render(matrices, vertexConsumer2, light, OverlayTexture.DEFAULT_UV)
|
||||
}
|
||||
matrices.pop()
|
||||
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private fun generateTextureIdentifier(type: CobblemonBoatType, hasChest: Boolean): Identifier {
|
||||
val boatSubPath = if (hasChest) "chest_boat" else "boat"
|
||||
val path = "textures/entity/$boatSubPath/${type.name.lowercase()}.png"
|
||||
return cobblemonResource(path)
|
||||
}
|
||||
|
||||
private fun generateBoatModel(ctx: EntityRendererFactory.Context, type: CobblemonBoatType, hasChest: Boolean): BoatEntityModel {
|
||||
val modelLayer = this.createBoatModelLayer(type, hasChest)
|
||||
val modelPart = ctx.getPart(modelLayer)
|
||||
return if (hasChest) ChestBoatEntityModel(modelPart) else BoatEntityModel(modelPart)
|
||||
}
|
||||
|
||||
internal fun createBoatModelLayer(type: CobblemonBoatType, hasChest: Boolean): EntityModelLayer {
|
||||
val boatSubPath = if (hasChest) "chest_boat" else "boat"
|
||||
val path = "$boatSubPath/${type.name.lowercase()}"
|
||||
return EntityModelLayer(cobblemonResource(path), "main")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -19,7 +19,7 @@ import net.minecraft.client.model.ModelPart
|
||||
|
||||
class PokeBallModel(root: ModelPart) : PoseableEntityModel<EmptyPokeBallEntity>(), PokeBallFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("poke_ball")
|
||||
override val base = getPart("base")
|
||||
override val base = getPart("bottom")
|
||||
override val lid = getPart("lid")
|
||||
override val isForLivingEntityRenderer = false
|
||||
|
||||
|
||||
+37
-25
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.WingFlapIdleAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.asTransformed
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BiWingedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart
|
||||
@@ -23,44 +24,50 @@ import com.cobblemon.mod.common.util.math.geometry.toRadians
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class GolbatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame {
|
||||
class GolbatModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override val rootPart = root.registerChildWithAllChildren("golbat")
|
||||
override val leftWing = getPart("leftwing")
|
||||
override val rightWing = getPart("rightwing")
|
||||
|
||||
override val portraitScale = 1.55F
|
||||
override val portraitTranslation = Vec3d(0.0, -0.55, 0.0)
|
||||
override val portraitTranslation = Vec3d(-0.1, -0.1, 0.0)
|
||||
|
||||
override val profileScale = 0.9F
|
||||
override val profileTranslation = Vec3d(0.0, 0.4, 0.0)
|
||||
override val profileScale = 0.7F
|
||||
override val profileTranslation = Vec3d(0.0, 0.7, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var hover: PokemonPose
|
||||
lateinit var fly: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
// override val cryAnimation = CryProvider { _, _ -> bedrockStateful("golbat", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES - PoseType.HOVER,
|
||||
transformTicks = 10,
|
||||
idleAnimations = arrayOf(
|
||||
//bedrock("golbat", "ground_idle")
|
||||
)
|
||||
)
|
||||
val blink = quirk("blink") { bedrockStateful("golbat", "blink").setPreventsIdle(false) }
|
||||
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
idleAnimations = arrayOf(bedrock("golbat", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES - PoseType.HOVER,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { !it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("golbat", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = MOVING_POSES - PoseType.FLY,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
//bedrock("golbat", "ground_walk")
|
||||
bedrock("golbat", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
@@ -68,12 +75,9 @@ class GolbatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame {
|
||||
poseName = "hover",
|
||||
poseType = PoseType.HOVER,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
WingFlapIdleAnimation(this,
|
||||
flapFunction = sineFunction(verticalShift = -10F.toRadians(), period = 0.9F, amplitude = 0.6F),
|
||||
timeVariable = { state, _, _ -> state?.animationSeconds ?: 0F },
|
||||
axis = TransformedModelPart.Y_AXIS
|
||||
)
|
||||
bedrock("golbat", "air_idle")
|
||||
)
|
||||
)
|
||||
|
||||
@@ -81,12 +85,20 @@ class GolbatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame {
|
||||
poseName = "fly",
|
||||
poseType = PoseType.FLY,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
WingFlapIdleAnimation(this,
|
||||
flapFunction = sineFunction(verticalShift = -14F.toRadians(), period = 0.9F, amplitude = 0.9F),
|
||||
timeVariable = { state, _, _ -> state?.animationSeconds ?: 0F },
|
||||
axis = TransformedModelPart.Y_AXIS
|
||||
)
|
||||
bedrock("golbat", "air_fly")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("golbat", "battle_idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
-1
@@ -37,7 +37,6 @@ class KadabraModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Biped
|
||||
override val profileScale = 0.75F
|
||||
override val profileTranslation = Vec3d(0.0, 0.6, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
+88
-45
@@ -10,11 +10,14 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.EarJoint
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.RangeOfMotion
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.WingFlapIdleAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.asTransformed
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BiWingedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.EaredFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart.Companion.X_AXIS
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart.Companion.Y_AXIS
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart.Companion.Z_AXIS
|
||||
@@ -27,81 +30,121 @@ import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.MathConstants.PI
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class ZubatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame, EaredFrame {
|
||||
class ZubatModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override val rootPart = root.registerChildWithAllChildren("zubat")
|
||||
|
||||
override val leftWing = getPart("leftwing")
|
||||
override val rightWing = getPart("rightwing")
|
||||
val wings_folded = getPart("wings_folded")
|
||||
val wings_open = getPart("wings_open")
|
||||
|
||||
private val leftEar = getPart("leftear")
|
||||
private val rightEar = getPart("rightear")
|
||||
override val leftEarJoint = EarJoint(leftEar, Z_AXIS, RangeOfMotion(70F.toRadians(), 40F.toRadians()))
|
||||
override val rightEarJoint = EarJoint(rightEar, Z_AXIS, RangeOfMotion((-70F).toRadians(), (-40F).toRadians()))
|
||||
override val portraitScale = 1.7F
|
||||
override val portraitTranslation = Vec3d(0.0, 0.0, 0.0)
|
||||
|
||||
override val portraitScale = 2.3F
|
||||
override val portraitTranslation = Vec3d(0.0, -0.5, 0.0)
|
||||
override val profileScale = 1.0F
|
||||
override val profileTranslation = Vec3d(0.0, 0.36, 0.0)
|
||||
override val profileScale = 0.7F
|
||||
override val profileTranslation = Vec3d(0.0, 0.7, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var hover: PokemonPose
|
||||
lateinit var fly: PokemonPose
|
||||
lateinit var shoulderLeft: PokemonPose
|
||||
lateinit var shoulderRight: PokemonPose
|
||||
|
||||
val shoulderOffset = 0
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("zubat", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val twitch = quirk("twitch") { bedrockStateful("zubat", "eartwitch").setPreventsIdle(false) }
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
transformedParts = arrayOf(
|
||||
wings_folded.asTransformed().withVisibility(visibility = false),
|
||||
wings_open.asTransformed().withVisibility(visibility = true),
|
||||
),
|
||||
quirks = arrayOf(twitch),
|
||||
idleAnimations = arrayOf(bedrock("zubat", "sleep"))
|
||||
)
|
||||
|
||||
registerPose(
|
||||
poseName = "hover",
|
||||
poseTypes = ALL_POSES - SHOULDER_POSES - PoseType.FLY - PoseType.SLEEP,
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES - PoseType.HOVER,
|
||||
transformedParts = arrayOf(
|
||||
wings_folded.asTransformed().withVisibility(visibility = false),
|
||||
wings_open.asTransformed().withVisibility(visibility = true),
|
||||
),
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(twitch),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("zubat", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
registerPose(
|
||||
poseName = "fly",
|
||||
poseType = PoseType.FLY,
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES - PoseType.FLY,
|
||||
transformedParts = arrayOf(
|
||||
wings_folded.asTransformed().withVisibility(visibility = false),
|
||||
wings_open.asTransformed().withVisibility(visibility = true),
|
||||
),
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(twitch),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("zubat", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
registerPose(
|
||||
poseType = PoseType.SHOULDER_LEFT,
|
||||
idleAnimations = arrayOf(
|
||||
leftWing.rotation(
|
||||
function = sineFunction(
|
||||
amplitude = PI / 3,
|
||||
period = 1F
|
||||
),
|
||||
axis = Z_AXIS,
|
||||
timeVariable = { _, _, ageInTicks -> ageInTicks / 20 },
|
||||
)
|
||||
),
|
||||
hover = registerPose(
|
||||
poseName = "hover",
|
||||
poseType = PoseType.HOVER,
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addRotation(X_AXIS, PI / 9).addPosition(Y_AXIS, 4F).addPosition(Z_AXIS, 3F),
|
||||
leftWing.asTransformed().addRotation(X_AXIS, PI / 3),
|
||||
rightWing.asTransformed().addRotation(X_AXIS, PI / 3).addRotation(Z_AXIS, -PI / 2)
|
||||
wings_folded.asTransformed().withVisibility(visibility = false),
|
||||
wings_open.asTransformed().withVisibility(visibility = true),
|
||||
),
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(twitch),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("zubat", "air_idle")
|
||||
)
|
||||
)
|
||||
registerPose(
|
||||
poseType = PoseType.SHOULDER_RIGHT,
|
||||
|
||||
fly = registerPose(
|
||||
poseName = "fly",
|
||||
poseType = PoseType.FLY,
|
||||
transformedParts = arrayOf(
|
||||
wings_folded.asTransformed().withVisibility(visibility = false),
|
||||
wings_open.asTransformed().withVisibility(visibility = true),
|
||||
),
|
||||
quirks = arrayOf(twitch),
|
||||
transformTicks = 10,
|
||||
idleAnimations = arrayOf(
|
||||
rightWing.rotation(
|
||||
function = sineFunction(
|
||||
amplitude = PI / 3,
|
||||
period = 1F
|
||||
),
|
||||
axis = Z_AXIS,
|
||||
timeVariable = { _, _, ageInTicks -> ageInTicks / 20 },
|
||||
)
|
||||
bedrock("zubat", "air_fly")
|
||||
)
|
||||
)
|
||||
|
||||
shoulderLeft = registerPose(
|
||||
poseType = PoseType.SHOULDER_LEFT,
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("zubat", "shoulder_left")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addRotation(X_AXIS, PI / 9).addPosition(Y_AXIS, 4F).addPosition(Z_AXIS, 3F),
|
||||
leftWing.asTransformed().addRotation(X_AXIS, PI / 3).addRotation(Z_AXIS, PI / 2),
|
||||
rightWing.asTransformed().addRotation(X_AXIS, PI / 3)
|
||||
rootPart.asTransformed().addPosition(TransformedModelPart.X_AXIS, shoulderOffset)
|
||||
)
|
||||
)
|
||||
|
||||
shoulderRight = registerPose(
|
||||
poseType = PoseType.SHOULDER_RIGHT,
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("zubat", "shoulder_right")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addPosition(TransformedModelPart.X_AXIS, -shoulderOffset)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("zubat", "faint") else null
|
||||
}
|
||||
+36
-21
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen2
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.WingFlapIdleAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BiWingedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart
|
||||
@@ -19,26 +20,37 @@ import com.cobblemon.mod.common.util.math.geometry.toRadians
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class CrobatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame {
|
||||
class CrobatModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override val rootPart = root.registerChildWithAllChildren("crobat")
|
||||
override val leftWing = getPart("leftwings")
|
||||
override val rightWing = getPart("rightwings")
|
||||
|
||||
override val portraitScale = 1.8F
|
||||
override val portraitTranslation = Vec3d(-0.11, -0.77, 0.0)
|
||||
override val portraitScale = 1.2F
|
||||
override val portraitTranslation = Vec3d(-0.1, 1.8, 0.0)
|
||||
|
||||
override val profileScale = 0.9F
|
||||
override val profileTranslation = Vec3d(0.0, 0.35, 0.0)
|
||||
override val profileScale = 0.5F
|
||||
override val profileTranslation = Vec3d(0.0, 1.2, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var hover: PokemonPose
|
||||
lateinit var fly: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("crobat", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("crobat", "blink").setPreventsIdle(false) }
|
||||
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
idleAnimations = arrayOf(bedrock("crobat", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseType = PoseType.STAND,
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES - PoseType.HOVER,
|
||||
condition = { !it.isBattling },
|
||||
transformTicks = 10,
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("crobat", "ground_idle")
|
||||
)
|
||||
@@ -57,13 +69,9 @@ class CrobatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame {
|
||||
poseName = "hover",
|
||||
poseType = PoseType.HOVER,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("crobat", "ground_idle"),
|
||||
WingFlapIdleAnimation(this,
|
||||
flapFunction = sineFunction(verticalShift = -10F.toRadians(), period = 0.9F, amplitude = 0.6F),
|
||||
timeVariable = { state, _, _ -> state?.animationSeconds ?: 0F },
|
||||
axis = TransformedModelPart.Y_AXIS
|
||||
)
|
||||
bedrock("crobat", "air_idle")
|
||||
)
|
||||
)
|
||||
|
||||
@@ -71,13 +79,20 @@ class CrobatModel(root: ModelPart) : PokemonPoseableModel(), BiWingedFrame {
|
||||
poseName = "fly",
|
||||
poseType = PoseType.FLY,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("crobat", "ground_walk"),
|
||||
WingFlapIdleAnimation(this,
|
||||
flapFunction = sineFunction(verticalShift = -14F.toRadians(), period = 0.9F, amplitude = 0.9F),
|
||||
timeVariable = { state, _, _ -> state?.animationSeconds ?: 0F },
|
||||
axis = TransformedModelPart.Y_AXIS
|
||||
)
|
||||
bedrock("crobat", "air_fly")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("crobat", "battle_idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
+38
-17
@@ -8,42 +8,53 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen2
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BimanualSwingAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.asTransformed
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class HitmontopModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, BipedFrame, BimanualFrame {
|
||||
class HitmontopModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("hitmontop")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val leftArm = getPart("arm_left")
|
||||
override val rightArm = getPart("arm_right")
|
||||
override val leftLeg = getPart("leg_left")
|
||||
override val rightLeg = getPart("leg_right")
|
||||
|
||||
override val portraitScale = 2.6F
|
||||
override val portraitTranslation = Vec3d(-0.26, -0.5, 0.0)
|
||||
|
||||
override val profileScale = 0.91F
|
||||
override val profileTranslation = Vec3d(0.0, 0.4, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
// override val cryAnimation = CryProvider { _, _ -> bedrockStateful("hitmontop", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("hitmontop", "blink").setPreventsIdle(false)}
|
||||
val blink = quirk("blink") { bedrockStateful("hitmontop", "blink").setPreventsIdle(false) }
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
idleAnimations = arrayOf(bedrock("hitmontop", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
transformTicks = 10,
|
||||
condition = { !it.isBattling },
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
@@ -53,19 +64,29 @@ class HitmontopModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = MOVING_POSES,
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("hitmontop", "ground_idle"),
|
||||
BipedWalkAnimation(this, periodMultiplier = 0.6F, amplitudeMultiplier = 0.9F),
|
||||
BimanualSwingAnimation(this, swingPeriodMultiplier = 0.6F, amplitudeMultiplier = 0.9F)
|
||||
bedrock("hitmontop", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("hitmontop", "battle_idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("hitmontop", "faint") else null
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = bedrockStateful("hitmontop", "faint")
|
||||
}
|
||||
+70
-17
@@ -8,42 +8,59 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen2
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BimanualSwingAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.asTransformed
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class TyrogueModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, BipedFrame, BimanualFrame {
|
||||
class TyrogueModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("tyrogue")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val leftArm = getPart("arm_left")
|
||||
override val rightArm = getPart("arm_right")
|
||||
override val leftLeg = getPart("leg_left")
|
||||
override val rightLeg = getPart("leg_right")
|
||||
|
||||
override val portraitScale = 2.56F
|
||||
override val portraitTranslation = Vec3d(-0.24, 0.1, 0.0)
|
||||
|
||||
override val profileScale = 0.73F
|
||||
override val profileTranslation = Vec3d(-0.03, 0.7, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var shoulderLeft: PokemonPose
|
||||
lateinit var shoulderRight: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
val shoulderOffset = 3
|
||||
|
||||
// override val cryAnimation = CryProvider { _, _ -> bedrockStateful("tyrogue", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("tyrogue", "blink").setPreventsIdle(false)}
|
||||
val blink = quirk("blink") { bedrockStateful("tyrogue", "blink").setPreventsIdle(false) }
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
idleAnimations = arrayOf(bedrock("tyrogue", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
transformTicks = 10,
|
||||
condition = { !it.isBattling },
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
@@ -53,19 +70,55 @@ class TyrogueModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Biped
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = MOVING_POSES,
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("tyrogue", "ground_idle"),
|
||||
BipedWalkAnimation(this, periodMultiplier = 0.6F, amplitudeMultiplier = 0.9F),
|
||||
BimanualSwingAnimation(this, swingPeriodMultiplier = 0.6F, amplitudeMultiplier = 0.9F)
|
||||
bedrock("tyrogue", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("tyrogue", "battle_idle")
|
||||
)
|
||||
)
|
||||
|
||||
shoulderLeft = registerPose(
|
||||
poseType = PoseType.SHOULDER_LEFT,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { !it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("tyrogue", "shoulder_left")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addPosition(TransformedModelPart.X_AXIS, shoulderOffset)
|
||||
)
|
||||
)
|
||||
|
||||
shoulderRight = registerPose(
|
||||
poseType = PoseType.SHOULDER_RIGHT,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { !it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("tyrogue", "shoulder_right")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addPosition(TransformedModelPart.X_AXIS, -shoulderOffset)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("tyrogue", "faint") else null
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk, battleidle, sleep)) bedrockStateful("tyrogue", "faint") else null
|
||||
}
|
||||
+3
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedW
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
@@ -35,6 +36,8 @@ class BeldumModel (root: ModelPart) : PokemonPoseableModel() {
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("beldum", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("beldum", "blink").setPreventsIdle(false)}
|
||||
val quirk = quirk("quirk") { bedrockStateful("beldum", "quirk_spin").setPreventsIdle(false)}
|
||||
|
||||
+3
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen3
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
@@ -30,6 +31,8 @@ class MetagrossModel (root: ModelPart) : PokemonPoseableModel() {
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("metagross", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("metagross", "blink").setPreventsIdle(false)}
|
||||
|
||||
|
||||
+3
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen3
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
@@ -30,6 +31,8 @@ class MetangModel (root: ModelPart) : PokemonPoseableModel() {
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("metang", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("metang", "blink").setPreventsIdle(false)}
|
||||
|
||||
|
||||
+40
-17
@@ -8,64 +8,87 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen3
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.QuadrupedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class MightyenaModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, QuadrupedFrame {
|
||||
class MightyenaModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("mightyena")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val hindLeftLeg = getPart("leg_left")
|
||||
override val hindRightLeg = getPart("leg_right")
|
||||
override val foreLeftLeg = getPart("arm_left")
|
||||
override val foreRightLeg = getPart("arm_right")
|
||||
|
||||
override val portraitScale = 2.2F
|
||||
override val portraitTranslation = Vec3d(-0.8, 0.6, 0.0)
|
||||
|
||||
override val profileScale = 0.6F
|
||||
override val profileTranslation = Vec3d(0.0, 0.8, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("mightyena", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("mightyena", "blink").setPreventsIdle(false) }
|
||||
val laugh_out_battle = quirk("laugh_out_battle", secondsBetweenOccurrences = 120F to 240F) { bedrockStateful("mightyena", "quirk").setPreventsIdle(false) }
|
||||
val laugh_in_battle = quirk("laugh_in_battle", secondsBetweenOccurrences = 30F to 60F) { bedrockStateful("mightyena", "quirk").setPreventsIdle(false) }
|
||||
val sleep_quirk = quirk("sleep_quirk", secondsBetweenOccurrences = 30F to 60F) { bedrockStateful("mightyena", "sleep_quirk").setPreventsIdle(false) }
|
||||
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
quirks = arrayOf(sleep_quirk),
|
||||
idleAnimations = arrayOf(bedrock("mightyena", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = UI_POSES + STATIONARY_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
transformTicks = 10,
|
||||
condition = { !it.isBattling },
|
||||
quirks = arrayOf(blink,laugh_out_battle),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("mightyena","ground_idle")
|
||||
bedrock("mightyena", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = MOVING_POSES,
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
QuadrupedWalkAnimation(this, periodMultiplier = 0.8F, amplitudeMultiplier = 0.8F),
|
||||
bedrock("mightyena","ground_idle")
|
||||
bedrock("mightyena", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink,laugh_in_battle),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("mightyena", "battle_idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("mightyena", "faint") else null
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = bedrockStateful("mightyena", "faint")
|
||||
}
|
||||
+1
-1
@@ -49,7 +49,7 @@ class ShroomishModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
condition = { !it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("shroomish", "ground_idle")
|
||||
|
||||
-2
@@ -68,7 +68,6 @@ class VolbeatModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bipe
|
||||
poseTypes = setOf(PoseType.HOVER, PoseType.FLOAT),
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isTouchingWater },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("volbeat", "air_idle")
|
||||
@@ -80,7 +79,6 @@ class VolbeatModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bipe
|
||||
poseTypes = setOf(PoseType.FLY, PoseType.SWIM),
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isTouchingWater },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("volbeat", "air_fly")
|
||||
|
||||
+36
@@ -8,12 +8,16 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen4
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.asTransformed
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.TransformedModelPart
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
@@ -34,6 +38,10 @@ class TurtwigModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Quad
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var shoulderLeft: PokemonPose
|
||||
lateinit var shoulderRight: PokemonPose
|
||||
|
||||
val shoulderOffset = 3
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("turtwig", "cry").setPreventsIdle(false) }
|
||||
|
||||
@@ -65,5 +73,33 @@ class TurtwigModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Quad
|
||||
bedrock("turtwig", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
shoulderLeft = registerPose(
|
||||
poseType = PoseType.SHOULDER_LEFT,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("turtwig", "shoulder_left")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addPosition(TransformedModelPart.X_AXIS, shoulderOffset)
|
||||
)
|
||||
)
|
||||
|
||||
shoulderRight = registerPose(
|
||||
poseType = PoseType.SHOULDER_RIGHT,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("turtwig", "shoulder_right")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.asTransformed().addPosition(TransformedModelPart.X_AXIS, -shoulderOffset)
|
||||
)
|
||||
)
|
||||
}
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = bedrockStateful("turtwig", "faint")
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class ChandelureModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("chandelure")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val portraitScale = 2.0F
|
||||
override val portraitTranslation = Vec3d(-0.3, -1.2, 0.0)
|
||||
|
||||
override val profileScale = 0.8F
|
||||
override val profileTranslation = Vec3d(0.0, 0.5, 0.0)
|
||||
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
|
||||
override fun registerPoses() {
|
||||
// val blink = quirk("blink") { bedrockStateful("chandelure", "blink").setPreventsIdle(false) }
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
// quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("chandelure", "idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
// quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("chandelure", "idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("chandelure", "faint") else null
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class LampentModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("lampent")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val portraitScale = 2.0F
|
||||
override val portraitTranslation = Vec3d(-0.3, -1.2, 0.0)
|
||||
|
||||
override val profileScale = 0.8F
|
||||
override val profileTranslation = Vec3d(0.0, 0.5, 0.0)
|
||||
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("lampent", "blink").setPreventsIdle(false) }
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("lampent", "idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("lampent", "idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("lampent", "faint") else null
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import net.minecraft.client.model.ModelPart
|
||||
import net.minecraft.util.math.Vec3d
|
||||
|
||||
class LitwickModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("litwick")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val portraitScale = 2.0F
|
||||
override val portraitTranslation = Vec3d(-0.3, -1.2, 0.0)
|
||||
|
||||
override val profileScale = 0.8F
|
||||
override val profileTranslation = Vec3d(0.0, 0.5, 0.0)
|
||||
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("litwick", "blink").setPreventsIdle(false) }
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("litwick", "idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("litwick", "idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("litwick", "faint") else null
|
||||
}
|
||||
+3
-2
@@ -41,9 +41,10 @@ class TrevenantModel (root: ModelPart) : PokemonPoseableModel() {
|
||||
poseType = PoseType.SLEEP,
|
||||
idleAnimations = arrayOf(bedrock("trevenant", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "stand",
|
||||
poseTypes = PoseType.STATIONARY_POSES - PoseType.HOVER - PoseType.FLOAT + PoseType.UI_POSES,
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
condition = { !it.isBattling },
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
@@ -53,7 +54,7 @@ class TrevenantModel (root: ModelPart) : PokemonPoseableModel() {
|
||||
)
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES - PoseType.FLY - PoseType.SWIM,
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
transformTicks = 5,
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
|
||||
-1
@@ -25,7 +25,6 @@ class KomalaModel (root: ModelPart) : PokemonPoseableModel() {
|
||||
override val profileScale = 0.8F
|
||||
override val profileTranslation = Vec3d(0.0, 0.5, 0.0)
|
||||
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var standing: PokemonPose
|
||||
|
||||
// override val cryAnimation = CryProvider { _, _ -> bedrockStateful("komala", "cry").setPreventsIdle(false) }
|
||||
|
||||
+1
-1
@@ -62,5 +62,5 @@ class EiscueModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk, sleep)) bedrockStateful("eiscue_ice", "faint") else null
|
||||
) = bedrockStateful("eiscue_ice", "faint")
|
||||
}
|
||||
+3
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedW
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
@@ -37,6 +38,8 @@ class QuaxwellModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("quaxwell", "cry").setPreventsIdle(false) }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("quaxwell", "blink").setPreventsIdle(false) }
|
||||
sleep = registerPose(
|
||||
|
||||
-1
@@ -47,7 +47,6 @@ class SquawkabillyModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame,
|
||||
lateinit var flying: PokemonPose
|
||||
lateinit var shoulderLeft: PokemonPose
|
||||
lateinit var shoulderRight: PokemonPose
|
||||
lateinit var sleep: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("squawkabilly", "cry").setPreventsIdle(false) }
|
||||
|
||||
|
||||
+11
-12
@@ -31,7 +31,7 @@ class TandemausModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var sleep: PokemonPose
|
||||
// lateinit var sleep: PokemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("tandemaus", "cry").setPreventsIdle(false) }
|
||||
|
||||
@@ -69,19 +69,18 @@ class TandemausModel (root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
)
|
||||
)
|
||||
|
||||
sleep = registerPose(
|
||||
poseName = "sleep",
|
||||
poseType = PoseType.SLEEP,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink1, blink2),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("tandemaus", "ground_idle")
|
||||
//bedrock("tandemaus", "sleep")
|
||||
)
|
||||
)
|
||||
// sleep = registerPose(
|
||||
// poseName = "sleep",
|
||||
// poseType = PoseType.SLEEP,
|
||||
// transformTicks = 10,
|
||||
// quirks = arrayOf(blink1, blink2),
|
||||
// idleAnimations = arrayOf(
|
||||
// bedrock("tandemaus", "sleep")
|
||||
// )
|
||||
// )
|
||||
}
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isNotPosedIn(sleep)) bedrockStateful("tandemaus", "faint") else null
|
||||
) = bedrockStateful("tandemaus", "faint")
|
||||
}
|
||||
+3
@@ -586,6 +586,9 @@ object PokemonModelRepository : VaryingModelRepository<PokemonEntity, PokemonPos
|
||||
inbuilt("clodsire", ::ClodsireModel)
|
||||
inbuilt("teddiursa", ::TeddiursaModel)
|
||||
inbuilt("ursaring", ::UrsaringModel)
|
||||
inbuilt("litwick", ::LitwickModel)
|
||||
inbuilt("lampent", ::LampentModel)
|
||||
inbuilt("chandelure", ::ChandelureModel)
|
||||
}
|
||||
|
||||
override fun loadJsonPoser(json: String): (Bone) -> PokemonPoseableModel {
|
||||
|
||||
+10
@@ -148,6 +148,16 @@ class PokemonRenderer(
|
||||
pMatrixStack.scale(scale, scale, scale)
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a beam between the Cobblemon and the target.
|
||||
*
|
||||
* @param matrixStack The matrix stack to render with.
|
||||
* @param partialTicks The partial ticks.
|
||||
* @param entity The Cobblemon.
|
||||
* @param beamTarget The target.
|
||||
* @param colour The colour of the beam.
|
||||
* @param buffer The vertex consumer provider.
|
||||
*/
|
||||
fun renderBeam(matrixStack: MatrixStack, partialTicks: Float, entity: PokemonEntity, beamTarget: Entity, colour: Vector4f, buffer: VertexConsumerProvider) {
|
||||
val clientDelegate = entity.delegate as PokemonClientDelegate
|
||||
val pokemonPosition = entity.pos.add(0.0, entity.height / 2.0 * clientDelegate.entityScaleModifier.toDouble(), 0.0)
|
||||
|
||||
@@ -131,6 +131,9 @@ class CobblemonConfig {
|
||||
@NodeCategory(category = Category.Battles)
|
||||
var luckyEggMultiplier = 1.5
|
||||
|
||||
@NodeCategory(category = Category.Battles)
|
||||
var allowSpectating = true
|
||||
|
||||
@NodeCategory(category = Category.Pokemon)
|
||||
var experienceMultiplier = 2F
|
||||
|
||||
@@ -205,10 +208,6 @@ class CobblemonConfig {
|
||||
@NodeCategory(Category.Spawning)
|
||||
var teraTypeRate = 20F
|
||||
|
||||
@NodeCategory(Category.Pokemon)
|
||||
@LastChangedVersion("1.4.0")
|
||||
var consumeHeldItems = true
|
||||
|
||||
@NodeCategory(Category.World)
|
||||
var defaultPasturedPokemonLimit = 16
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.entity.boat
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonEntities
|
||||
import com.cobblemon.mod.common.mixin.accessor.BoatEntityAccessor
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.WoodType
|
||||
import net.minecraft.entity.EntityType
|
||||
import net.minecraft.entity.data.DataTracker
|
||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry
|
||||
import net.minecraft.entity.vehicle.BoatEntity
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.nbt.NbtCompound
|
||||
import net.minecraft.nbt.NbtElement
|
||||
import net.minecraft.nbt.NbtString
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener
|
||||
import net.minecraft.network.packet.Packet
|
||||
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket
|
||||
import net.minecraft.registry.tag.FluidTags
|
||||
import net.minecraft.text.Text
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.world.GameRules
|
||||
import net.minecraft.world.World
|
||||
|
||||
@Suppress("unused")
|
||||
open class CobblemonBoatEntity(entityType: EntityType<out BoatEntity>, world: World) : BoatEntity(entityType, world) {
|
||||
|
||||
constructor(world: World) : this(CobblemonEntities.BOAT, world)
|
||||
|
||||
// This exists cause super passes in vanilla boat entity type
|
||||
constructor(world: World, x: Double, y: Double, z: Double) : this(CobblemonEntities.BOAT, world) {
|
||||
this.setPosition(x, y, z)
|
||||
this.prevX = x
|
||||
this.prevY = y
|
||||
this.prevZ = z
|
||||
}
|
||||
|
||||
/**
|
||||
* The [CobblemonBoatType] of this boat.
|
||||
*/
|
||||
var boatType: CobblemonBoatType
|
||||
get() = CobblemonBoatType.ofOrdinal(this.dataTracker.get(TYPE_TRACKED_DATA))
|
||||
set(value) {
|
||||
this.dataTracker.set(TYPE_TRACKED_DATA, value.ordinal)
|
||||
}
|
||||
|
||||
/**
|
||||
* The [WoodType] that represents this boat.
|
||||
*/
|
||||
val woodType: WoodType get() = this.boatType.woodType
|
||||
|
||||
/**
|
||||
* The [Block] that represents the base material for this boat.
|
||||
*/
|
||||
val baseBlock: Block get() = this.boatType.baseBlock
|
||||
|
||||
override fun asItem(): Item = this.boatType.boatItem
|
||||
|
||||
override fun createSpawnPacket(): Packet<ClientPlayPacketListener> = EntitySpawnS2CPacket(this)
|
||||
|
||||
override fun initDataTracker() {
|
||||
super.initDataTracker()
|
||||
this.dataTracker.startTracking(TYPE_TRACKED_DATA, CobblemonBoatType.APRICORN.ordinal)
|
||||
}
|
||||
|
||||
override fun getDefaultName(): Text = EntityType.BOAT.name
|
||||
|
||||
override fun readCustomDataFromNbt(nbt: NbtCompound) {
|
||||
if (nbt.contains(TYPE_KEY, NbtElement.STRING_TYPE.toInt())) {
|
||||
this.boatType = CobblemonBoatType.valueOf(nbt.getString(TYPE_KEY))
|
||||
}
|
||||
}
|
||||
|
||||
override fun writeCustomDataToNbt(nbt: NbtCompound) {
|
||||
nbt.put(TYPE_KEY, NbtString.of(this.boatType.name))
|
||||
}
|
||||
|
||||
override fun setVariant(type: Type) {
|
||||
throw UnsupportedOperationException("The vanilla boat type is not present in the Cobblemon implementation use the type property")
|
||||
}
|
||||
|
||||
override fun getVariant(): Type {
|
||||
throw UnsupportedOperationException("The vanilla boat type is not present in the Cobblemon implementation use the type property")
|
||||
}
|
||||
|
||||
override fun getMountedHeightOffset(): Double = this.boatType.mountedOffset
|
||||
|
||||
override fun fall(heightDifference: Double, onGround: Boolean, state: BlockState, landedPosition: BlockPos) {
|
||||
val accessor = this.accessor()
|
||||
accessor.setFallVelocity(this.velocity.y)
|
||||
if (!this.hasVehicle()) {
|
||||
return
|
||||
}
|
||||
if (!this.world.getFluidState(this.blockPos.down()).isIn(FluidTags.WATER) && heightDifference < 0.0) {
|
||||
this.fallDistance -= heightDifference.toFloat()
|
||||
}
|
||||
if (!onGround) {
|
||||
return
|
||||
}
|
||||
if (this.fallDistance < 3F || accessor.location != Location.ON_LAND) {
|
||||
this.onLanding()
|
||||
return
|
||||
}
|
||||
this.handleFallDamage(this.fallDistance, 1F, this.damageSources.fall())
|
||||
if (this.world.isClient || this.isRemoved) {
|
||||
return
|
||||
}
|
||||
this.kill()
|
||||
if (this.world.gameRules.getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
repeat(3) {
|
||||
this.dropItem(this.boatType.baseBlock)
|
||||
}
|
||||
repeat(2) {
|
||||
this.dropItem(Items.STICK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected fun accessor(): BoatEntityAccessor = this as BoatEntityAccessor
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TYPE_KEY = "type"
|
||||
private val TYPE_TRACKED_DATA = DataTracker.registerData(CobblemonBoatEntity::class.java, TrackedDataHandlerRegistry.INTEGER)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user