Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java-library'
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
}

java {
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/draylar/identity/Identity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -98,7 +98,7 @@ public static boolean isAquatic(LivingEntity entity) {
}

public static int getCooldown(EntityType<?> type) {
String id = Registry.ENTITY_TYPE.getId(type).toString();
String id = Registries.ENTITY_TYPE.getId(type).toString();
return IdentityConfig.getInstance().getAbilityCooldownMap().getOrDefault(id, 20);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ else if(ticksSinceUpdate > fadingProgress) {
// 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));
.renderGuiItemIcon(matrices, stack, (int) (width * .95f), (int) (height * .92f));

RenderSystem.disableScissor();
matrices.pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.world.World;
import net.minecraft.world.World.ExplosionSourceType;
import net.minecraft.world.explosion.Explosion;

public class CreeperAbility extends IdentityAbility<CreeperEntity> {

@Override
public void onUse(PlayerEntity player, CreeperEntity identity, World world) {
world.createExplosion(player, player.getX(), player.getY(), player.getZ(), 3.0f, Explosion.DestructionType.NONE);
world.createExplosion(player, player.getX(), player.getY(), player.getZ(), 3.0f, ExplosionSourceType.NONE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public void onUse(PlayerEntity player, EvokerEntity identity, World world) {

// If the block underneath is solid, we are good to go.
EvokerFangsEntity fangs = new EvokerFangsEntity(world, origin.getX(), origin.getY(), origin.getZ(), player.getYaw(), blockOut * 2, player);
BlockPos underneathPosition = new BlockPos(origin).down();
BlockPos underneathPosition = BlockPos.ofFloored(origin).down();
BlockState underneath = world.getBlockState(underneathPosition);
if(underneath.isSideSolidFullSquare(world, underneathPosition, Direction.UP) && world.isAir(underneathPosition.up())) {
world.spawnEntity(fangs);
continue;
}

// Check underneath (2x down) again...
BlockPos underneath2Position = new BlockPos(origin).down(2);
BlockPos underneath2Position = BlockPos.ofFloored(origin).down(2);
BlockState underneath2 = world.getBlockState(underneath2Position);
if(underneath2.isSideSolidFullSquare(world, underneath2Position, Direction.UP) && world.isAir(underneath2Position.up())) {
fangs.setPos(fangs.getX(), fangs.getY() - 1, fangs.getZ());
Expand All @@ -48,7 +48,7 @@ public void onUse(PlayerEntity player, EvokerEntity identity, World world) {
}

// Check above (1x up)
BlockPos upPosition = new BlockPos(origin).up();
BlockPos upPosition = BlockPos.ofFloored(origin).up();
BlockState up = world.getBlockState(underneath2Position);
if(up.isSideSolidFullSquare(world, upPosition, Direction.UP) && world.isAir(upPosition)) {
fangs.setPos(fangs.getX(), fangs.getY() + 1, fangs.getZ());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.stat.Stats;
import net.minecraft.text.Text;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;

public class IdentityGranting {

Expand All @@ -18,7 +18,7 @@ public static void grantByAttack(PlayerEntity player, IdentityType<?> granted) {

// If the player has to kill a certain number of mobs before unlocking an Identity, check their statistic for the specific type.
if(IdentityConfig.getInstance().requiresKillsForIdentity()) {
String id = Registry.ENTITY_TYPE.getId(granted.getEntityType()).toString();
String id = Registries.ENTITY_TYPE.getId(granted.getEntityType()).toString();

// Check against a specific count requirement or the default count.
int required = IdentityConfig.getInstance().getRequiredKillsForIdentity();
Expand Down
10 changes: 0 additions & 10 deletions common/src/main/java/draylar/identity/api/PlayerFavorites.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
package draylar.identity.api;

import dev.architectury.networking.NetworkManager;
import draylar.identity.api.variant.IdentityType;
import draylar.identity.impl.PlayerDataProvider;
import draylar.identity.network.NetworkHandler;
import draylar.identity.network.impl.FavoritePackets;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtString;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import java.util.List;
import java.util.Set;

public class PlayerFavorites {
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/draylar/identity/api/PlayerIdentity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;

public class PlayerIdentity {

Expand Down Expand Up @@ -57,7 +57,7 @@ public static void sync(ServerPlayerEntity changed, ServerPlayerEntity packetTar

// put entity type ID under the key "id", or "minecraft:empty" if no identity is equipped (or the identity entity type is invalid)
packet.writeUuid(changed.getUuid());
packet.writeString(identity == null ? "minecraft:empty" : Registry.ENTITY_TYPE.getId(identity.getType()).toString());
packet.writeString(identity == null ? "minecraft:empty" : Registries.ENTITY_TYPE.getId(identity.getType()).toString());
packet.writeNbt(entityTag);
NetworkManager.sendToPlayer(packetTarget, NetworkHandler.IDENTITY_SYNC, packet);
}
Expand Down
9 changes: 0 additions & 9 deletions common/src/main/java/draylar/identity/api/PlayerUnlocks.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
package draylar.identity.api;

import dev.architectury.event.EventResult;
import dev.architectury.networking.NetworkManager;
import draylar.identity.api.event.UnlockIdentityCallback;
import draylar.identity.api.variant.IdentityType;
import draylar.identity.impl.PlayerDataProvider;
import draylar.identity.network.NetworkHandler;
import draylar.identity.network.impl.UnlockPackets;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtString;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class PlayerUnlocks {

Expand Down
14 changes: 7 additions & 7 deletions common/src/main/java/draylar/identity/api/model/EntityArms.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Pair;
import net.minecraft.util.math.Vec3f;
import org.jetbrains.annotations.Nullable;
import draylar.identity.math.math;

import java.util.LinkedHashMap;
import java.util.Map;
Expand Down Expand Up @@ -71,15 +71,15 @@ public static void init() {
register(LlamaEntityModel.class, (llama, model) -> ((LlamaEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> {});
register(PandaEntityModel.class, (llama, model) -> ((QuadrupedEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> stack.translate(0, -0.5, 0));
register(BlazeEntityModel.class, (llama, model) -> ((BlazeEntityModelAccessor) model).getRods()[10], (stack, model) -> {
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(45));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-15));
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-25));
stack.multiply(math.getDegreesQuaternion(math.POSITIVE_Z(), 45));
stack.multiply(math.getDegreesQuaternion(math.POSITIVE_Y(), -15));
stack.multiply(math.getDegreesQuaternion(math.POSITIVE_X(), -25));
stack.translate(0, 0, -.25);
});
register(OcelotEntityModel.class, (ocelot, model) -> ((OcelotEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> {});
register(SpiderEntityModel.class, (spider, model) -> ((SpiderEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> {
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-15));
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(15));
stack.multiply(math.getDegreesQuaternion(math.POSITIVE_Y(), -15));
stack.multiply(math.getDegreesQuaternion(math.POSITIVE_X(), 15));
stack.translate(0, 0, 0);
});
register(IronGolemEntityModel.class, (golem, model) -> model.getRightArm(), (stack, model) -> {
Expand All @@ -101,7 +101,7 @@ public static void init() {

// types
register(EntityType.PILLAGER, (pillager, model) -> ((IllagerEntityModelAccessor) model).getRightArm(), (stack, model) -> {
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-10));
stack.multiply(math.getDegreesQuaternion(math.POSITIVE_X(), -10));
stack.translate(0, .5, -.3);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -78,16 +78,16 @@ public static <Z extends LivingEntity> IdentityType<Z> from(Z entity) {
@Nullable
public static IdentityType<?> from(NbtCompound compound) {
Identifier id = new Identifier(compound.getString("EntityID"));
if(!Registry.ENTITY_TYPE.containsId(id)) {
if(!Registries.ENTITY_TYPE.containsId(id)) {
return null;
}

return new IdentityType(Registry.ENTITY_TYPE.get(id), compound.contains("Variant") ? compound.getInt("Variant") : -1);
return new IdentityType(Registries.ENTITY_TYPE.get(id), compound.contains("Variant") ? compound.getInt("Variant") : -1);
}

public static List<IdentityType<?>> getAllTypes(World world) {
if(LIVING_TYPE_CASH.isEmpty()) {
for (EntityType<?> type : Registry.ENTITY_TYPE) {
for (EntityType<?> type : Registries.ENTITY_TYPE) {
Entity instance = type.create(world);
if(instance instanceof LivingEntity) {
LIVING_TYPE_CASH.add((EntityType<? extends LivingEntity>) type);
Expand Down Expand Up @@ -124,7 +124,7 @@ public static <Z extends LivingEntity> IdentityType<Z> from(EntityType<?> entity

public NbtCompound writeCompound() {
NbtCompound compound = new NbtCompound();
compound.putString("EntityID", Registry.ENTITY_TYPE.getId(type).toString());
compound.putString("EntityID", Registries.ENTITY_TYPE.getId(type).toString());
compound.putInt("Variant", variantData);
return compound;
}
Expand Down
Loading