Skip to content

Commit

Permalink
Port to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaargolo committed Jun 13, 2023
1 parent b437f71 commit 34d5199
Show file tree
Hide file tree
Showing 108 changed files with 598 additions and 644 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
<p align="center">
<a href="https://github.com/lucaargolo/kibe/actions"><img src="https://github.com/lucaargolo/kibe/workflows/Build/badge.svg"/></a>
<a href="https://opensource.org/licenses/MPL-2.0"><img src="https://img.shields.io/badge/License-MPL%202.0-blue"></a>
<a href="https://www.curseforge.com/minecraft/mc-mods/kibe"><img src="http://cf.way2muchnoise.eu/versions/kibe_latest.svg"></a>
<a href="https://www.curseforge.com/minecraft/mc-mods/kibe"><img src="http://cf.way2muchnoise.eu/versions/388832_latest.svg"></a>
</p>
<p align="center">
<a href="https://www.curseforge.com/minecraft/mc-mods/kibe"><img src="http://cf.way2muchnoise.eu/full_kibe_downloads.svg"></a>
<a href="https://modrinth.com/mod/kibe"><img src="https://img.shields.io/badge/dynamic/json?color=1bd96a&label=modrinth&query=downloads&suffix=%20downloads&url=https%3A%2F%2Fapi.modrinth.com%2Fapi%2Fv1%2Fmod%2Fkibe&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDEuNzMgMTQxLjczIiBhcmlhLWhpZGRlbj0idHJ1ZSIgY2xhc3M9InRleHQtbG9nbyI+DQo8Zz4NCjxwYXRoIGQ9Ik0xNTkuMDcsODkuMjlBNzAuOTQsNzAuOTQsMCwxLDAsMjAsNjMuNTJIMzJBNTguNzgsNTguNzgsMCwwLDEsMTQ1LjIzLDQ5LjkzbC0xMS42NiwzLjEyYTQ2LjU0LDQ2LjU0LDAsMCwwLTI5LTI2LjUybC0yLjE1LDEyLjEzYTM0LjMxLDM0LjMxLDAsMCwxLDIuNzcsNjMuMjZsMy4xO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ge.com/minecraft/mc-mods/kibe"><img src="http://cf.way2muchnoise.eu/full_388832_downloads.svg"></a>
<a href="https://modrinth.com/mod/kibe"><img src="https://img.shields.io/badge/dynamic/json?color=00AF5C&logo=modrinth&label=modrinth&query=downloads&suffix=%20downloads&url=https://api.modrinth.com/v2/project/kibe"></a>
</p>


## Features
For a complete list of features please check the mods [official page](https://www.curseforge.com/minecraft/mc-mods/kibe)

Expand Down
43 changes: 19 additions & 24 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseRelation
import com.matthewprenger.cursegradle.Options
import com.modrinth.minotaur.TaskModrinthUpload
import com.modrinth.minotaur.request.VersionType

buildscript {
dependencies {
Expand Down Expand Up @@ -43,8 +41,8 @@ group = project["maven_group"]

val environment: Map<String, String> = System.getenv()
val releaseName = "${name.split("-").joinToString(" ") { it.capitalize() }} ${(version as String).split("+")[0]}"
val releaseType = (version as String).split("+")[0].split("-").let { if(it.isNotEmpty()) if(it[1] == "BETA" || it[1] == "ALPHA") it[1] else "ALPHA" else "RELEASE" }
val releaseFile = "${buildDir}/libs/${base.archivesBaseName}-${version}.jar"
val releaseType = (version as String).split("+")[0].split("-").let { if(it.size > 1) if(it[1] == "BETA" || it[1] == "ALPHA") it[1] else "ALPHA" else "RELEASE" }
val releaseFile = "${buildDir}/libs/${base.archivesName.get()}-${version}.jar"
val cfGameVersion = (version as String).split("+")[1].let{ if(!project["minecraft_version"].contains("-") && project["minecraft_version"].startsWith(it)) project["minecraft_version"] else "$it-Snapshot"}

fun getChangeLog(): String {
Expand Down Expand Up @@ -100,11 +98,7 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:${project["fabric_version"]}")
modImplementation("net.fabricmc:fabric-language-kotlin:${project["fabric_kotlin_version"]}")

modCompileOnly ("com.github.emilyalexandra:trinkets:${project["trinkets_version"]}") {
exclude(group = "net.fabricmc.fabric-api")
exclude(group = "dev.onyxstudios.cardinal-components-api")
exclude(group = "com.terraformersmc")
}
modImplementation("dev.emi:trinkets:${project["trinkets_version"]}")

modImplementation("io.github.ladysnake:PlayerAbilityLib:${project["pal_version"]}")
include("io.github.ladysnake:PlayerAbilityLib:${project["pal_version"]}")
Expand Down Expand Up @@ -197,24 +191,25 @@ curseforge {
}

//Modrinth publishing
task<TaskModrinthUpload>("modrinth") {
dependsOn(tasks.remapJar)
group = "upload"
modrinth {
environment["MODRINTH_TOKEN"]?.let { token.set(it) }

onlyIf {
environment.containsKey("MODRINTH_TOKEN")
}
token = environment["MODRINTH_TOKEN"]
projectId.set(project["modrinth_id"])
changelog.set(getChangeLog())

projectId = project["modrinth_id"]
changelog = getChangeLog()
versionNumber.set(version as String)
versionName.set(releaseName)
versionType.set(releaseType.toLowerCase())

versionNumber = version as String
versionName = releaseName
versionType = VersionType.valueOf(releaseType)
uploadFile.set(tasks.remapJar.get())

uploadFile = file(releaseFile)
gameVersions.add(project["minecraft_version"])
loaders.add("fabric")

addGameVersion(project["minecraft_version"])
addLoader("fabric")
dependencies {
required.project("fabric-api")
}
}
tasks.modrinth.configure {
group = "upload"
}
30 changes: 15 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
org.gradle.jvmargs=-Xmx4G

# Gradle Plugins
kotlin_version=1.7.0
loom_version=0.12-SNAPSHOT
grgit_version=4.1.1
kotlin_version=1.8.22
loom_version=1.1-SNAPSHOT
grgit_version=5.0.0
cursegradle_version=1.4.0
modrinth_version=1.2.1
github_api_version=1.114
modrinth_version=2.7.3
github_api_version=1.314

# Mod Properties
mod_version=1.9.11-BETA+1.19
mod_version=1.9.11-BETA+1.20
maven_group=io.github.lucaargolo

# Fabric Properties
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.12
loader_version=0.14.9
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.1
loader_version=0.14.21

#Fabric api
fabric_version=0.61.0+1.19.2
fabric_kotlin_version=1.8.0+kotlin.1.7.0
fabric_version=0.83.1+1.20.1
fabric_kotlin_version=1.9.5+kotlin.1.8.22

# Libraries
pal_version=1.6.0
trinkets_version=3.4.0
pal_version=1.8.0
trinkets_version=3.7.0
dashloader_version=2.0
modmenu_version=4.0.6
rei_version=9.1.550
modmenu_version=7.0.1
rei_version=12.0.613

# Publishing
curseforge_id=388832
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ClientPlayNetworkHandlerMixin {
@Inject(at = @At("TAIL"), method = "onEntitySpawn")
public void onEntitySpawn(EntitySpawnS2CPacket packet, CallbackInfo ci) {
double x = packet.getX(), y = packet.getY(), z = packet.getZ();
EntityType<?> entityType = packet.getEntityTypeId();
EntityType<?> entityType = packet.getEntityType();
Entity entity = null;

if(entityType == EntityCompendiumKt.getTHROWN_TORCH()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.CraftingResultInventory;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.screen.CraftingScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,7 +13,7 @@
public interface CraftingTableContainerMixin {

@Accessor
CraftingInventory getInput();
RecipeInputInventory getInput();
@Accessor
CraftingResultInventory getResult();
@Accessor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.RotationAxis;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -46,11 +46,11 @@ private void updateHeldItems(CallbackInfo info) {
}
}

@Inject(at = @At("HEAD"), method = "renderFirstPersonItem", cancellable = true)
@Inject(at = @At("HEAD"), method = "renderFirstPersonItem")
private void renderFirstPersonItemPre(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo info) {
if(player.getStackInHand(hand).getItem() instanceof Glider && Glider.Companion.isEnabled(player.getStackInHand(hand))) {
matrices.push();
matrices.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(360 - player.getPitch(tickDelta)));
matrices.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(360 - player.getPitch(tickDelta)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ private void isSleepingInBed(CallbackInfoReturnable<Boolean> info) {
}
}

@Inject(at = @At("HEAD"), method = "jump", cancellable = true)
@Inject(at = @At("HEAD"), method = "jump")
private void jump(CallbackInfo info) {
BlockPos pos = this.getBlockPos();
Block block = this.world.getBlockState(pos.down()).getBlock();
if (block instanceof Elevator && world.getBlockState(pos).getCollisionShape(world, pos).isEmpty()) {
while(pos.getY() < world.getTopY()) {
if(world.getBlockState(pos.up()).getBlock().equals(block) && Elevator.Companion.isElevatorValid(world, pos.up())) {
world.playSound(null, pos, SoundEvents.BLOCK_PISTON_EXTEND, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
Block block = this.getWorld().getBlockState(pos.down()).getBlock();
if (block instanceof Elevator && getWorld().getBlockState(pos).getCollisionShape(getWorld(), pos).isEmpty()) {
while(pos.getY() < getWorld().getTopY()) {
if(getWorld().getBlockState(pos.up()).getBlock().equals(block) && Elevator.Companion.isElevatorValid(getWorld(), pos.up())) {
getWorld().playSound(null, pos, SoundEvents.BLOCK_PISTON_EXTEND, SoundCategory.BLOCKS, 0.5F, getWorld().random.nextFloat() * 0.25F + 0.6F);
this.teleport(this.getPos().x, pos.up().getY()+1.15, this.getPos().z);
break;
}else{
Expand All @@ -74,18 +74,18 @@ private void jump(CallbackInfo info) {
Licensed under the MIT license available at: https://tldrlegal.com/license/mit-license
*/
@SuppressWarnings("ConstantConditions")
@Inject(at = @At("HEAD"), method = "handleFallDamage", cancellable = true)
@Inject(at = @At("HEAD"), method = "handleFallDamage")
private void handleFallDamage(float fallDistance, float damageMultiplier, DamageSource source, CallbackInfoReturnable<Boolean> info) {
if((Object) this instanceof PlayerEntity) {
PlayerEntity player = ((PlayerEntity) ((Object) this));
if (player.getEquippedStack(EquipmentSlot.FEET).getItem() == ItemCompendiumKt.getSLIME_BOOTS()) {
if(!isSneaking() && fallDistance > 2) {
this.fallDistance = 0;

if(world.isClient) {
if(getWorld().isClient) {
setVelocity(getVelocity().x, getVelocity().y*-0.9, getVelocity().z);
velocityDirty = true;
onGround = false;
setOnGround(false);
double f = 0.91d + 0.04d;
setVelocity(getVelocity().x/f, getVelocity().y, getVelocity().z/f);
}else{
Expand All @@ -95,7 +95,7 @@ private void handleFallDamage(float fallDistance, float damageMultiplier, Damage
this.playSound(SoundEvents.ENTITY_SLIME_SQUISH, 1f, 1f);
SlimeBounceHandler.Companion.addBounceHandler(player, getVelocity().y);

}else if(!world.isClient && isSneaking()) {
}else if(!getWorld().isClient && isSneaking()) {
if(fallDistance > 5) this.fallDistance = 5;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ private void tick(CallbackInfo info) {
Licensed under the MIT license available at: https://tldrlegal.com/license/mit-license
*/
Iterator<Entity> keyIt;
if(world.isClient) keyIt = SlimeBounceHandler.Companion.getClientBouncingEntities().keySet().iterator();
if(getWorld().isClient) keyIt = SlimeBounceHandler.Companion.getClientBouncingEntities().keySet().iterator();
else keyIt = SlimeBounceHandler.Companion.getServerBouncingEntities().keySet().iterator();
while(keyIt.hasNext()) {
Entity entity = keyIt.next();
SlimeBounceHandler bounce;
if(world.isClient) bounce = SlimeBounceHandler.Companion.getClientBouncingEntities().get(entity);
if(getWorld().isClient) bounce = SlimeBounceHandler.Companion.getClientBouncingEntities().get(entity);
else bounce = SlimeBounceHandler.Companion.getServerBouncingEntities().get(entity);
if(player.equals(entity) && !player.isFallFlying()) {
if(player.age == bounce.getBounceTick()) {
Expand Down Expand Up @@ -174,7 +174,7 @@ private void tick(CallbackInfo info) {
}
}
//Ring logic
if(!world.isClient && this instanceof PlayerAbilityView) {
if(!getWorld().isClient && this instanceof PlayerAbilityView) {
for(PlayerAbility pa : RingAbilitiesKt.getPotionToAbilityMap().keySet()) {
if(pa.isEnabledFor(player)) {
StatusEffect se = RingAbilitiesKt.getPotionToAbilityMap().get(pa);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.RotationAxis;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -27,11 +27,11 @@ private void renderPre(AbstractClientPlayerEntity abstractClientPlayerEntity, fl
float interpolatedYaw = abstractClientPlayerEntity.prevHeadYaw + (abstractClientPlayerEntity.headYaw - abstractClientPlayerEntity.prevHeadYaw) * partialTicks;

matrixStack.push();
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-interpolatedYaw));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-interpolatedYaw));
matrixStack.translate(0f, abstractClientPlayerEntity.getHeight() / 2f, 0f);
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90f));
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90f));
matrixStack.translate(0f, -abstractClientPlayerEntity.getHeight() / 2f, 0f);
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(interpolatedYaw));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(interpolatedYaw));

GliderHelper.INSTANCE.setPlayerRenderPoppingNeeds(abstractClientPlayerEntity, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import io.github.lucaargolo.kibe.items.ItemCompendiumKt;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.ShapedRecipe;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -13,12 +15,12 @@
@Mixin(ShapedRecipe.class)
public abstract class ShapedRecipeMixin {

@Shadow public abstract ItemStack getOutput();
@Shadow @Final ItemStack output;

@Inject(at = @At("HEAD"), method = "matchesPattern", cancellable = true)
private void matchesSmall(CraftingInventory inv, int offsetX, int offsetY, boolean bl, CallbackInfoReturnable<Boolean> info) {
if(getOutput().getItem() == ItemCompendiumKt.getGLIDER_LEFT_WING() || getOutput().getItem() == ItemCompendiumKt.getGLIDER_RIGHT_WING()) {
if(bl) info.setReturnValue(false);
private void matchesSmall(RecipeInputInventory inv, int offsetX, int offsetY, boolean flipped, CallbackInfoReturnable<Boolean> cir) {
if(output.getItem() == ItemCompendiumKt.getGLIDER_LEFT_WING() || output.getItem() == ItemCompendiumKt.getGLIDER_RIGHT_WING()) {
if(flipped) cir.setReturnValue(false);
}
}

Expand Down
Loading

0 comments on commit 34d5199

Please sign in to comment.