Skip to content

Commit

Permalink
1.17 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Draylar committed Jun 12, 2021
1 parent 9443d3f commit 70f1340
Show file tree
Hide file tree
Showing 35 changed files with 215 additions and 224 deletions.
22 changes: 9 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '0.5.9'
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = project.mod_version + "-" + project.minecraft_version
Expand All @@ -30,22 +30,23 @@ repositories {
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"

modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Player Ability Lib: https://github.com/Ladysnake/PlayerAbilityLib
include "io.github.ladysnake:PlayerAbilityLib:${project.pal_version}"
modImplementation ("io.github.ladysnake:PlayerAbilityLib:${project.pal_version}") {
exclude group: "net.fabricmc.fabric-api"
}

// Cardinal Components: https://github.com/OnyxStudios/Cardinal-Components-API
modImplementation "io.github.onyxstudios:Cardinal-Components-API:${project.cardinal_version}"
include "io.github.onyxstudios:Cardinal-Components-API:${project.cardinal_version}"
include "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:${project.cardinal_version}"
include "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${project.cardinal_version}"

// prevent log spam
modCompile 'com.github.Draylar:angerable-patch:1.0.0'
modImplementation 'com.github.Draylar:angerable-patch:1.0.0'
include 'com.github.Draylar:angerable-patch:1.0.0'

// config
Expand All @@ -56,14 +57,9 @@ dependencies {
processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching('fabric.mod.json') {
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
Expand Down
15 changes: 7 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.4
loader_version=0.11.1
minecraft_version=1.17
yarn_mappings=1.17+build.9
loader_version=.11.3

# Mod Properties
mod_version=1.13.2
mod_version=1.14.0-beta
maven_group=draylar
archives_base_name=identity

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.34.1+1.16
auto_config_version=3.2.2
cardinal_version=2.8.2
pal_version=1.2.1
fabric_version=0.35.0+1.17
cardinal_version=3.0.0-nightly.1.17-pre2
pal_version=1.3.0-nightly.1.17-rc1
4 changes: 2 additions & 2 deletions 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-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion src/main/java/draylar/identity/IdentityClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.LivingEntity;
import org.lwjgl.glfw.GLFW;
Expand Down
40 changes: 4 additions & 36 deletions src/main/java/draylar/identity/ability/AbilityOverlayRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,49 +116,17 @@ else if (ticksSinceUpdate > fadingProgress) {
// TODO: cache ability stack?
// MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(new ItemStack(identityAbility.getIcon()), (int) (width * .95f), (int) (height * .92f));
ItemStack stack = new ItemStack(identityAbility.getIcon());
BakedModel heldItemModel = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(stack, client.world, player);
renderGuiItemModel(matrices, stack, (int) (width * .95f), (int) (height * .92f), heldItemModel);
// BakedModel heldItemModel = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(stack, client.world, player);
// renderGuiItemModel(matrices, stack, (int) (width * .95f), (int) (height * .92f), heldItemModel);
MinecraftClient.getInstance().getItemRenderer()
.renderGuiItemIcon(stack, (int) (width * .95f), (int) (height * .92f));

RenderSystem.disableScissor();
matrices.pop();
}
});
}

protected static void renderGuiItemModel(MatrixStack matrices, ItemStack stack, int x, int y, BakedModel model) {
RenderSystem.pushMatrix();

MinecraftClient.getInstance().getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
MinecraftClient.getInstance().getTextureManager().getTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).setFilter(false, false);

RenderSystem.enableRescaleNormal();
RenderSystem.enableAlphaTest();
RenderSystem.defaultAlphaFunc();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.translatef((float) x, (float) y, 100.0F);
RenderSystem.translatef(8.0F, 8.0F, 0.0F);
RenderSystem.scalef(1.0F, -1.0F, 1.0F);
RenderSystem.scalef(16.0F, 16.0F, 16.0F);
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
boolean bl = !model.isSideLit();
if (bl) {
DiffuseLighting.disableGuiDepthLighting();
}

MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Mode.GUI, false, matrices, immediate, 15728880, OverlayTexture.DEFAULT_UV, model);
immediate.draw();
RenderSystem.enableDepthTest();
if (bl) {
DiffuseLighting.enableGuiDepthLighting();
}

RenderSystem.disableAlphaTest();
RenderSystem.disableRescaleNormal();
RenderSystem.popMatrix();
}

private AbilityOverlayRenderer() {
// NO-OP
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void onUse(PlayerEntity player, EndermiteEntity identity, World world) {
for(int i = 0; i < 16; ++i) {
// Pick a random location nearby to teleport to.
double g = player.getX() + (player.getRandom().nextDouble() - 0.5D) * 16.0D;
double h = MathHelper.clamp(player.getY() + (double)(player.getRandom().nextInt(16) - 8), 0.0D, world.getDimensionHeight() - 1);
double h = MathHelper.clamp(player.getY() + (double)(player.getRandom().nextInt(16) - 8), 0.0D, world.getHeight() - 1);
double j = player.getZ() + (player.getRandom().nextDouble() - 0.5D) * 16.0D;

// Cancel vehicle/riding mechanics.
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/draylar/identity/ability/impl/GhastAbility.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public void onUse(PlayerEntity player, GhastEntity identity, World world) {
player,
player.getRotationVector().x,
player.getRotationVector().y,
player.getRotationVector().z
player.getRotationVector().z,
2
);

fireball.refreshPositionAndAngles(fireball.getX(), fireball.getY() + 1.75, fireball.getZ(), fireball.yaw, fireball.pitch);
fireball.refreshPositionAndAngles(fireball.getX(), fireball.getY() + 1.75, fireball.getZ(), fireball.getYaw(), fireball.getPitch());
fireball.updatePosition(fireball.getX(), fireball.getY(), fireball.getZ());
world.spawnEntity(fireball);
world.playSoundFromEntity(null, player, SoundEvents.ENTITY_GHAST_SHOOT, SoundCategory.HOSTILE, 10.0F, (world.random.nextFloat() - world.random.nextFloat()) * 0.2F + 1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void onUse(PlayerEntity player, SnowGolemEntity identity, World world) {
for(int i = 0; i < 10; i++) {
SnowballEntity snowballEntity = new SnowballEntity(world, player);
snowballEntity.setItem(new ItemStack(Items.SNOWBALL));
snowballEntity.setProperties(player, player.pitch + world.random.nextInt(10) - 5, player.yaw + world.random.nextInt(10) - 5, 0.0F, 1.5F, 1.0F);
snowballEntity.setProperties(player, player.getPitch() + world.random.nextInt(10) - 5, player.getYaw() + world.random.nextInt(10) - 5, 0.0F, 1.5F, 1.0F);
world.spawnEntity(snowballEntity);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class WitchAbility extends IdentityAbility<WitchEntity> {
public void onUse(PlayerEntity player, WitchEntity identity, World world) {
PotionEntity potionEntity = new PotionEntity(world, player);
potionEntity.setItem(PotionUtil.setPotion(new ItemStack(Items.SPLASH_POTION), VALID_POTIONS.get(world.random.nextInt(VALID_POTIONS.size()))));
potionEntity.pitch -= -20.0F;
potionEntity.setPitch(-20.0F);
Vec3d rotation = player.getRotationVector();
potionEntity.setVelocity(rotation.getX(), rotation.getY(), rotation.getZ(), 0.75F, 8.0F);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void onUse(PlayerEntity player, WitherEntity identity, World world) {
Vec3d lookDirection = player.getRotationVector();
WitherSkullEntity skull = new WitherSkullEntity(world, player, lookDirection.x, lookDirection.y, lookDirection.z);
skull.setPos(player.getX(), player.getY() + 2, player.getZ());
skull.setProperties(player, player.pitch, player.yaw, 0.0F, 1.5F, 1.0F);
skull.setProperties(player, player.getPitch(), player.getYaw(), 0.0F, 1.5F, 1.0F);
world.spawnEntity(skull);
}
}
Expand Down
28 changes: 12 additions & 16 deletions src/main/java/draylar/identity/api/model/EntityArms.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.EvokerEntityRenderer;
import net.minecraft.client.render.entity.model.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.PillagerEntity;
import net.minecraft.util.Pair;
import net.minecraft.util.math.Vec3f;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -72,26 +68,26 @@ public static <T extends LivingEntity> EntityArmProvider<T> get(Class<EntityMode
public static void init() {
// specific
register(LlamaEntityModel.class, (llama, model) -> model.rightFrontLeg, (stack, model) -> {});
register(PandaEntityModel.class, (llama, model) -> model.frontRightLeg, (stack, model) -> stack.translate(0, -0.5, 0));
register(PandaEntityModel.class, (llama, model) -> model.rightFrontLeg, (stack, model) -> stack.translate(0, -0.5, 0));
register(BlazeEntityModel.class, (llama, model) -> model.rods[10], (stack, model) -> {
stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(45));
stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-15));
stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-25));
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(45));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-15));
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-25));
stack.translate(0, 0, -.25);
});
register(OcelotEntityModel.class, (ocelot, model) -> model.rightFrontLeg, (stack, model) -> {});
register(SpiderEntityModel.class, (spider, model) -> model.rightFrontLeg, (stack, model) -> {
stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-15));
stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(15));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-15));
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(15));
stack.translate(0, 0, 0);
});
register(IronGolemEntityModel.class, (golem, model) -> model.getRightArm(), (stack, model) -> {
stack.translate(0, 0, -.5);
});
register(PigEntityModel.class, (pig, model) -> model.frontRightLeg, (stack, model) -> {
register(PigEntityModel.class, (pig, model) -> model.rightFrontLeg, (stack, model) -> {
stack.translate(0, 0, .6);
});
register(PolarBearEntityModel.class, (bear, model) -> model.frontRightLeg, (stack, model) -> {
register(PolarBearEntityModel.class, (bear, model) -> model.rightFrontLeg, (stack, model) -> {
stack.translate(0, 0, .3);
});
register(RavagerEntityModel.class, (bear, model) -> model.rightFrontLeg, (stack, model) -> { });
Expand All @@ -100,11 +96,11 @@ public static void init() {
});

// generic
register(QuadrupedEntityModel.class, (quad, model) -> model.frontRightLeg, (stack, model) -> {});
register(QuadrupedEntityModel.class, (quad, model) -> model.rightFrontLeg, (stack, model) -> {});

// types
register(EntityType.PILLAGER, (pillager, model) -> ((IllagerEntityModel) model).rightAttackingArm, (stack, model) -> {
stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-10));
register(EntityType.PILLAGER, (pillager, model) -> ((IllagerEntityModel) model).rightArm, (stack, model) -> {
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-10));
stack.translate(0, .5, -.3);
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/draylar/identity/api/model/EntityUpdaters.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static void init() {
// setting yaw without +180 making tail faces front, for some reason
if (dragon.latestSegment < 0) {
for (int l = 0; l < dragon.segmentCircularBuffer.length; ++l) {
dragon.segmentCircularBuffer[l][0] = (double) player.yaw + 180;
dragon.segmentCircularBuffer[l][0] = (double) player.getYaw() + 180;
dragon.segmentCircularBuffer[l][1] = player.getY();
}
}
Expand All @@ -104,7 +104,7 @@ public static void init() {
(dragon).latestSegment = 0;
}

dragon.segmentCircularBuffer[dragon.latestSegment][0] = (double) player.yaw + 180;
dragon.segmentCircularBuffer[dragon.latestSegment][0] = (double) player.getYaw() + 180;
dragon.segmentCircularBuffer[dragon.latestSegment][1] = player.getY();
});

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/draylar/identity/cca/AbilityComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import dev.onyxstudios.cca.api.v3.component.tick.ServerTickingComponent;
import draylar.identity.registry.Components;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;

public class AbilityComponent implements AutoSyncedComponent, ServerTickingComponent {

Expand All @@ -18,12 +18,12 @@ public AbilityComponent(PlayerEntity player) {
}

@Override
public void readFromNbt(CompoundTag tag) {
public void readFromNbt(NbtCompound tag) {
this.cooldown = tag.getInt(ABILITY_COOLDOWN_KEY);
}

@Override
public void writeToNbt(CompoundTag tag) {
public void writeToNbt(NbtCompound tag) {
tag.putInt(ABILITY_COOLDOWN_KEY, cooldown);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import net.fabricmc.fabric.api.util.NbtType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtString;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

Expand Down Expand Up @@ -53,16 +53,16 @@ public void unfavorite(Identifier id) {
}

@Override
public void readFromNbt(CompoundTag tag) {
public void readFromNbt(NbtCompound tag) {
favorites.clear();
ListTag idList = tag.getList("FavoriteIdentities", NbtType.STRING);
NbtList idList = tag.getList("FavoriteIdentities", NbtType.STRING);
idList.forEach(idTag -> favorites.add(new Identifier(idTag.asString())));
}

@Override
public void writeToNbt(CompoundTag tag) {
ListTag idList = new ListTag();
favorites.forEach(entityId -> idList.add(StringTag.of(entityId.toString())));
public void writeToNbt(NbtCompound tag) {
NbtList idList = new NbtList();
favorites.forEach(entityId -> idList.add(NbtString.of(entityId.toString())));
tag.put("FavoriteIdentities", idList);
}
}
6 changes: 3 additions & 3 deletions src/main/java/draylar/identity/cca/HostilityComponent.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package draylar.identity.cca;

import dev.onyxstudios.cca.api.v3.component.tick.ServerTickingComponent;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtCompound;

public class HostilityComponent implements ServerTickingComponent {

Expand All @@ -12,12 +12,12 @@ public HostilityComponent() {
}

@Override
public void readFromNbt(CompoundTag tag) {
public void readFromNbt(NbtCompound tag) {
this.remainingTime = tag.getInt("RemainingTime");
}

@Override
public void writeToNbt(CompoundTag tag) {
public void writeToNbt(NbtCompound tag) {
tag.putInt("RemainingTime", remainingTime);
}

Expand Down
Loading

0 comments on commit 70f1340

Please sign in to comment.