Skip to content

Commit

Permalink
Updated to 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasQTruong committed Oct 17, 2023
1 parent e6ca752 commit 1d545fe
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 43 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ My attempt to create a scuffed Cobblemon "breeding" for my friends and I to use.
- [Modrinth](https://modrinth.com/mod/veryscuffedcobblemonbreeding)
- [CursedForge](https://curseforge.com/minecraft/mc-mods/veryscuffedcobblemonbreeding/)

## Dependencies
- [Architectury](https://www.curseforge.com/minecraft/mc-mods/architectury-api)

## How to use:
1. Open up the breeding GUI.
- Command: /pokebreed
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ dependencies {
implementation(libs.reflect)

modImplementation(libs.fabricLoader)
modApi ("curse.maven:cobblemon-687131:4468330")
modApi ("curse.maven:cobblemon-687131:4797468")
modApi(libs.architectury)

//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'


compileOnly("net.luckperms:api:${rootProject.property("luckperms_version")}")
compileOnly("net.luckperms:api:5.4")
}

tasks.withType<Test> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public Pokemon getPokemonBred() {
}

// Got the Pokemon, time to set its proper default.
baby.setEvs(new EVs());
setEVs(baby, 0);
baby.setExperienceAndUpdateLevel(0);
baby.removeHeldItem();
baby.initializeMoveset(true);
Expand All @@ -410,7 +410,7 @@ public Pokemon getPokemonBred() {

baby.setGender(getRandomGender(baby));
baby.setAbility(getRandomAbility(baby));
baby.setIvs(getIVs());
inheritIVs(baby);
baby.setNature(getRandomNature());

return baby;
Expand Down Expand Up @@ -513,12 +513,25 @@ public Ability getRandomAbility(Pokemon getFor) {


/**
* Gets IVs for the baby.
* IVs will be randomly inherited from parents or randomized.
* Sets the pokemon's EVs into a value.
*
* @return IVs - the baby's new IVs.
* @param value - the value to change every EV to.
*/
public IVs getIVs() {
public void setEVs(Pokemon pokemon, int value) {
pokemon.setEV(Stats.SPEED, value);
pokemon.setEV(Stats.SPECIAL_DEFENCE, value);
pokemon.setEV(Stats.DEFENCE, value);
pokemon.setEV(Stats.ATTACK, value);
pokemon.setEV(Stats.SPECIAL_ATTACK, value);
pokemon.setEV(Stats.HP, value);
}


/**
* Inherits IVs for the baby.
* IVs will be randomly inherited from parents or randomized.
*/
public void inheritIVs(Pokemon baby) {
List<Stats> toSet = new ArrayList<>();
toSet.add(Stats.SPEED);
toSet.add(Stats.SPECIAL_DEFENCE);
Expand All @@ -527,8 +540,6 @@ public IVs getIVs() {
toSet.add(Stats.SPECIAL_ATTACK);
toSet.add(Stats.HP);

IVs newIVs = new IVs();

// Get parents' items' NBT.
NbtCompound fullNbt1 = breederPokemon1.heldItem().getNbt();
NbtCompound fullNbt2 = breederPokemon2.heldItem().getNbt();
Expand Down Expand Up @@ -574,13 +585,13 @@ public IVs getIVs() {
// Get IV from parent1 if holding power item.
if (powerItemsCount > 0 && intRNG == 0) {
Stats stat = powerItemsMap.get(parent1Item);
newIVs.set(stat, breederPokemon1.getIvs().getOrDefault(stat));
baby.setIV(stat, breederPokemon1.getIvs().getOrDefault(stat));
--amountOfIVsToGet;
toSet.remove(powerItemsMap.get(parent1Item));
} else if (powerItemsCount > 0) {
// Get IV from parent2 if holding power item.
Stats stat = powerItemsMap.get(parent2Item);
newIVs.set(stat, breederPokemon2.getIvs().getOrDefault(stat));
baby.setIV(stat, breederPokemon2.getIvs().getOrDefault(stat));
--amountOfIVsToGet;
toSet.remove(powerItemsMap.get(parent2Item));
}
Expand All @@ -593,20 +604,18 @@ public IVs getIVs() {

// Parent 1's stat gets inherited.
if (randomParent == 0) {
newIVs.set(stat, breederPokemon1.getIvs().getOrDefault(stat));
baby.setIV(stat, breederPokemon1.getIvs().getOrDefault(stat));
} else {
// Parent 2's stat gets inherited.
newIVs.set(stat, breederPokemon2.getIvs().getOrDefault(stat));
baby.setIV(stat, breederPokemon2.getIvs().getOrDefault(stat));
}
toSet.remove(statIndex);
}

// Get the rest of the stats (0-31).
for (Stats stat : toSet) {
newIVs.set(stat, RNG.nextInt(32));
baby.setIV(stat, RNG.nextInt(32));
}

return newIVs;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public void onSlotClick(int slotIndex, int button, SlotActionType actionType,
* @return ItemStack - the item at the.
*/
@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
public ItemStack quickMove(PlayerEntity player, int index) {
return null;
}

Expand Down Expand Up @@ -355,7 +355,7 @@ protected void dropInventory(PlayerEntity player, Inventory inventory) {
* @param player - the player that was trying to breed Cobblemons.
*/
@Override
public void close(PlayerEntity player) {
public void onClosed(PlayerEntity player) {
// GUI closed AND it wasn't to change page (player closed).
if (!breedSession.cancelled && !breedSession.changePage) {
// Cancel session.
Expand Down
3 changes: 2 additions & 1 deletion fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ dependencies {
isTransitive = false
}

modImplementation ("curse.maven:cobblemon-687131:4468330") {
modImplementation ("curse.maven:cobblemon-687131:4797468") {
isTransitive = false;
}

modApi(libs.fabricLoader)
modApi(libs.fabricApi)
modApi(libs.fabricKotlin)
modApi(libs.architecturyFabric)
Expand Down
8 changes: 4 additions & 4 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
},
"mixins": [],
"depends": {
"fabricloader": ">=0.13.3",
"fabric": ">=0.75.1",
"architectury": ">=6.5.69",
"minecraft": ">=1.19.2",
"fabricloader": ">=0.14.21",
"fabric": ">=0.89.0",
"fabric-api": "*",
"minecraft": ">=1.20.0",
"java": ">=17"
}
}
2 changes: 1 addition & 1 deletion forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
}
testImplementation(project(":common", configuration = "namedElements"))

modImplementation ("curse.maven:cobblemon-687131:4443261") {
modImplementation ("curse.maven:cobblemon-687131:4797451") {
exclude(group = "net.minecraftforge")
}

Expand Down
4 changes: 2 additions & 2 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ description='''
[[dependencies.veryscuffedcobblemonbreeding]]
modId="minecraft"
mandatory=true
versionRange="[1.19.2]"
versionRange="[1.20.1,)"

[[dependencies.veryscuffedcobblemonbreeding]]
modId="forge" #mandatory
mandatory=true #mandatory
versionRange="[40,)" #mandatory
versionRange="[45,)" #mandatory

[[dependencies.veryscuffedcobblemonbreeding]]
modId="architectury"
Expand Down
11 changes: 7 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ org.gradle.daemon=false
org.gradle.parallel=true

# API
mc_version = 1.19.2
yarn_version = 1.19.2+build.4:v2
mc_version = 1.20.1
yarn_version = 1.20.1+build.9:v2
luckperms_version=5.4


mod_id=veryscuffedcobblemonbreeding
mod_version=1.0.5
snapshot=false
mod_version=1.0.6
snapshot=false


fabric.loom.multiProjectOptimisation=true
32 changes: 21 additions & 11 deletions gradle/libs.versions.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
versions:

# jetbains
kotlin: 1.7.10
coroutines: 1.6.1
kotlin: 1.8.20
coroutines: 1.6.4
annotations: 23.0.0
serialization: 1.3.2
serialization: 1.5.0

# other
shadow: 7.1.2

# fabric/remap
loom: 0.12.0-SNAPSHOT
fabric-loader: 0.14.9
fabric-api: 0.75.1+1.19.2
fabric-kotlin: 1.8.2+kotlin.1.7.10
loom: 1.1-SNAPSHOT
fabric-loader: 0.14.21
fabric-api: 0.89.0+1.20.1
fabric-kotlin: 1.9.3+kotlin.1.8.20
architectury-plugin: 3.4-SNAPSHOT
flywheelFabric: 0.6.9-1
flywheelForge: 0.6.10-7

# forge
forge: 1.19.2-43.2.4
kotlinForForge: 3.8.0
forge: 1.20.1-47.0.50
kotlinForForge: 4.3.0

# common
architectury: 6.5.69

# test
junit: 5.9.0
mockito: 3.3.3
mockk: 1.12.1
mockito: 5.6.0
mockk: 1.13.8

#
fabric-permissions-api: 0.2-SNAPSHOT
Expand Down Expand Up @@ -100,6 +102,10 @@ dependencies:
group: me.lucko
name: fabric-permissions-api
version: { ref: fabric-permissions-api }
flywheelFabric:
group: com.jozufozu.flywheel
name: flywheel-fabric-1.20.1
version: { ref: flywheelFabric }

# forge
forge:
Expand All @@ -114,6 +120,10 @@ dependencies:
group: thedarkcolour
name: kotlinforforge
version: { ref: kotlinForForge }
flywheelForge:
group: com.jozufozu.flywheel
name: flywheel-forge-1.20.1
version: { ref: flywheelForge }

# test
junitEngine:
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 1d545fe

Please sign in to comment.