Skip to content

Commit

Permalink
Preliminary 1.19.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Dec 22, 2022
1 parent 21a8fc9 commit 640d412
Show file tree
Hide file tree
Showing 239 changed files with 235 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import com.google.common.collect.ImmutableList;
import dev.architectury.event.events.common.PlayerEvent;
import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.networking.NetworkChannel;
import dev.architectury.platform.Platform;
import dev.architectury.registry.CreativeTabRegistry;
import dev.architectury.utils.Env;
import dev.architectury.utils.PlatformExpectedError;
import dev.itsmeow.betteranimalsplus.client.dumb.SafeSyncThing;
import dev.itsmeow.betteranimalsplus.common.CommonEventHandler;
import dev.itsmeow.betteranimalsplus.common.entity.EntityCoyote;
Expand All @@ -19,7 +17,8 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ItemLike;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -71,24 +70,23 @@ public static void construct() {
}

public static void init(Consumer<Runnable> enqueue) {
BetterAnimalsPlusMod.addEggItems();
ModWorldGen.init(enqueue);
LOGGER.info("Overspawning lammergeiers...");
}

public static boolean isDev(UUID uuid) {
//return DEVS.contains(uuid);
return true;
return DEVS.contains(uuid);
}

public static boolean isDev(Player player) {
return isDev(player.getGameProfile().getId());
}

public static final CreativeModeTab TAB = getPlatformTab();
public static final CreativeTabRegistry.TabSupplier TAB = CreativeTabRegistry.create(new ResourceLocation(Ref.MOD_ID, "main"), () -> new ItemStack(ModItems.ANTLER.get()));

@ExpectPlatform
public static CreativeModeTab getPlatformTab() {
throw new PlatformExpectedError("getPlatformTab(): Expected Platform");
public static void addEggItems() {
CreativeTabRegistry.append(TAB, ModEntities.getEntities().values().stream().map(cont -> cont.getEggItem().get()).collect(Collectors.toList()).toArray(new ItemLike[0]));
}

public static void onPlayerJoin(ServerPlayer player) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.itsmeow.betteranimalsplus.client;

import com.google.common.collect.ImmutableMap;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.architectury.platform.Platform;
import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry;
import dev.itsmeow.betteranimalsplus.BetterAnimalsPlusMod;
Expand Down Expand Up @@ -60,7 +60,7 @@ public static void registerEntityRenders() {
RenderFactory.addRender(ModEntities.PROJECTILE_TARANTULA_HAIR::get, RenderTarantulaHair::new);
R.addRender(ModEntities.TARANTULA::getEntityType, 1F, r -> r.tVariant().mSingle(ModelTarantula::new, "tarantula").preRender((e, s, p) -> {
if(e.isClimbing()) {
s.mulPose(Vector3f.XP.rotationDegrees(-90F));
s.mulPose(Axis.XP.rotationDegrees(-90F));
s.translate(0.0F, 0.75F, -0.5F);
}
}).layer(t -> new LayerEyes<>(t, ModResources.tarantula_eyes)));
Expand All @@ -82,7 +82,7 @@ public static void registerEntityRenders() {
R.addRender(ModEntities.LAMPREY::getEntityType, 0.4F, r -> r.tVariant().mSingle(ModelLamprey::new, "lamprey").preRender((e, s, p) -> {
s.scale(0.5F, 0.5F, 0.5F);
if(e.getVehicle() != null) {
s.mulPose(Vector3f.YP.rotationDegrees(180F));
s.mulPose(Axis.YP.rotationDegrees(180F));
s.translate(0, 0, 0.5F);
}
}));
Expand Down Expand Up @@ -184,29 +184,29 @@ public static void registerEntityRenders() {
float f = Mth.lerp(p, e.prevSquidPitch, e.squidPitch);
float f1 = Mth.lerp(p, e.prevSquidYaw, e.squidYaw);
s.translate(0.0F, 0.5F, 0.0F);
s.mulPose(Vector3f.YP.rotationDegrees(180.0F - y));
s.mulPose(Vector3f.XP.rotationDegrees(f));
s.mulPose(Vector3f.YP.rotationDegrees(f1));
s.mulPose(Axis.YP.rotationDegrees(180.0F - y));
s.mulPose(Axis.XP.rotationDegrees(f));
s.mulPose(Axis.YP.rotationDegrees(f1));
s.translate(0.0F, -1.2F, 0.0F);
}));
R.addRender(ModEntities.SQUID_GIANT::getEntityType, 3F, r -> r.tSingle("squid_giant").mSingle(ModelGiantSquid::new, "giant_squid").simpleScale(e -> 2.2F).handleRotation((e, p) -> Mth.lerp(p, e.lastTentacleAngle, e.tentacleAngle)).applyRotations((e, s, a, y, p) -> {
float f = Mth.lerp(p, e.prevSquidPitch, e.squidPitch);
float f1 = Mth.lerp(p, e.prevSquidYaw, e.squidYaw);
s.translate(0.0F, 0.5F, 0.0F);
s.mulPose(Vector3f.YP.rotationDegrees(180.0F - y));
s.mulPose(Vector3f.XP.rotationDegrees(f));
s.mulPose(Vector3f.YP.rotationDegrees(f1));
s.mulPose(Axis.YP.rotationDegrees(180.0F - y));
s.mulPose(Axis.XP.rotationDegrees(f));
s.mulPose(Axis.YP.rotationDegrees(f1));
s.translate(0.0F, -1.2F, 0.0F);
}));
R.addRender(ModEntities.PIRANHA::getEntityType, 0.4F, r -> r.tSingle("piranha").mSingle(ModelPiranha::new, "piranha").simpleScale(e -> 0.3F));
R.addRender(ModEntities.OCTOPUS::getEntityType, 1F, r -> r.tVariant().mSingle(ModelOctopus::new, "octopus").handleRotation((e, p) -> Mth.lerp(p, e.lastTentacleAngle, e.tentacleAngle)).applyRotations((e, s, a, y, p) -> {
// s.translate(0.0F, 0.5F, 0.0F);
s.mulPose(Vector3f.YP.rotationDegrees(180.0F - y));
s.mulPose(Axis.YP.rotationDegrees(180.0F - y));
if(e.isInWaterOrBubble() && (!e.isAboveBlock() || e.getDeltaMovement().length() > 0.01)) {
float f = Mth.lerp(p, e.prevSquidPitch, e.squidPitch);
float f1 = Mth.lerp(p, e.prevSquidYaw, e.squidYaw);
s.mulPose(Vector3f.XP.rotationDegrees(f));
s.mulPose(Vector3f.YP.rotationDegrees(f1));
s.mulPose(Axis.XP.rotationDegrees(f));
s.mulPose(Axis.YP.rotationDegrees(f1));
}
// s.translate(0.0F, -1.2F, 0.0F);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
Expand Down Expand Up @@ -89,8 +89,8 @@ public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int
matrixStackIn.translate(0.0F, 0.05F, 0.025F);
float angle = 6.0F + f2_r / 2.0F + f1_r;
angle = Math.min(angle, 90F);
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(angle));
matrixStackIn.mulPose(Vector3f.ZP.rotationDegrees(f3_r / 2.0F));
matrixStackIn.mulPose(Axis.XP.rotationDegrees(angle));
matrixStackIn.mulPose(Axis.ZP.rotationDegrees(f3_r / 2.0F));
super.renderToBuffer(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
matrixStackIn.popPose();
this.bearCapeArmL1.visible = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
Expand Down Expand Up @@ -98,8 +98,8 @@ public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int
matrixStackIn.translate(0.0F, 0.05F, 0.025F);
float angle = 6.0F + f2_r / 2.0F + f1_r;
angle = Math.min(angle, 90F);
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(angle));
matrixStackIn.mulPose(Vector3f.ZP.rotationDegrees(f3_r / 2.0F));
matrixStackIn.mulPose(Axis.XP.rotationDegrees(angle));
matrixStackIn.mulPose(Axis.ZP.rotationDegrees(f3_r / 2.0F));
super.renderToBuffer(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
matrixStackIn.popPose();
this.wolfCapeArmL1.visible = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.client.model.abstracts.ModelBAP;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
Expand Down Expand Up @@ -102,7 +102,7 @@ public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float

@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float r, float g, float b, float a) {
poseStack.mulPose(Vector3f.YP.rotationDegrees(rotation)); // Yaw
poseStack.mulPose(Axis.YP.rotationDegrees(rotation)); // Yaw
stem01.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
stem02.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
stem03.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.client.model.abstracts.ModelBAP;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
Expand Down Expand Up @@ -96,7 +96,7 @@ public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float

@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float r, float g, float b, float a) {
poseStack.mulPose(Vector3f.YP.rotationDegrees(rotation)); // Yaw
poseStack.mulPose(Axis.YP.rotationDegrees(rotation)); // Yaw
stem01.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
stem02.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
stem03.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.client.model.abstracts.ModelBAP;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
Expand Down Expand Up @@ -121,7 +121,7 @@ public static LayerDefinition createBodyLayer() {

@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float r, float g, float b, float a) {
poseStack.mulPose(Vector3f.YP.rotationDegrees(rotation)); // Yaw
poseStack.mulPose(Axis.YP.rotationDegrees(rotation)); // Yaw
stem01.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
stem02.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
stem03.render(poseStack, buffer, packedLight, packedOverlay, r, g, b, a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.client.model.abstracts.ModelBAP;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
Expand Down Expand Up @@ -71,7 +71,7 @@ public static LayerDefinition createBodyLayer() {
@Override
public void renderToBuffer(PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
if (putOnSide) {
matrixStackIn.mulPose(Vector3f.ZP.rotationDegrees(90F));
matrixStackIn.mulPose(Axis.ZP.rotationDegrees(90F));
matrixStackIn.translate(1.5F, -1.75F, 0F);
}
this.body01.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.client.model.abstracts.ModelBAP;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
Expand Down Expand Up @@ -95,7 +95,7 @@ public void renderToBuffer(PoseStack stack, VertexConsumer bufferIn, int packedL
stack.pushPose();
{
if (!this.isInWater) {
stack.mulPose(Vector3f.ZP.rotationDegrees(90F));
stack.mulPose(Axis.ZP.rotationDegrees(90F));
stack.translate(2F, -1F, 0F);
}
this.body.render(stack, bufferIn, packedLightIn, packedOverlayIn);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.itsmeow.betteranimalsplus.client.renderer.blockentity;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.Ref;
import dev.itsmeow.betteranimalsplus.client.model.block.ModelTrillium;
import dev.itsmeow.betteranimalsplus.client.model.block.ModelTrilliumMulti;
Expand Down Expand Up @@ -46,7 +46,7 @@ public void render(BlockEntityTrillium blockEntity, float partialTicks, PoseStac
matrixStackIn.pushPose();
{
matrixStackIn.translate(0.5F, 1.5F, 0.5F);
matrixStackIn.mulPose(Vector3f.ZP.rotationDegrees(180F));
matrixStackIn.mulPose(Axis.ZP.rotationDegrees(180F));

matrixStackIn.pushPose();
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import dev.itsmeow.betteranimalsplus.common.entity.projectile.EntityTarantulaHair;
import dev.itsmeow.betteranimalsplus.init.ModResources;
import net.minecraft.client.renderer.MultiBufferSource;
Expand All @@ -14,6 +12,9 @@
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import org.joml.Matrix3f;
import org.joml.Matrix4f;
import org.joml.Vector3f;

public class RenderTarantulaHair extends EntityRenderer<EntityTarantulaHair> {

Expand All @@ -24,9 +25,9 @@ public RenderTarantulaHair(EntityRendererProvider.Context ctx) {
@Override
public void render(EntityTarantulaHair entityIn, float entityYaw, float partialTicks, PoseStack matrixStackIn, MultiBufferSource bufferIn, int packedLightIn) {
matrixStackIn.pushPose();
matrixStackIn.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90.0F));
matrixStackIn.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(45.0F));
matrixStackIn.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90.0F));
matrixStackIn.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
matrixStackIn.mulPose(Axis.XP.rotationDegrees(45.0F));
matrixStackIn.scale(0.05625F, 0.05625F, 0.05625F);
matrixStackIn.translate(-4.0D, 0.0D, 0.0D);
VertexConsumer ivertexbuilder = bufferIn.getBuffer(RenderType.entityCutout(this.getTextureLocation(entityIn)));
Expand All @@ -43,7 +44,7 @@ public void render(EntityTarantulaHair entityIn, float entityYaw, float partialT
this.vert(matrix4f, matrix3f, ivertexbuilder, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, packedLightIn);

for (int j = 0; j < 4; ++j) {
matrixStackIn.mulPose(Vector3f.XP.rotationDegrees(90.0F));
matrixStackIn.mulPose(Axis.XP.rotationDegrees(90.0F));
this.vert(matrix4f, matrix3f, ivertexbuilder, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, packedLightIn);
this.vert(matrix4f, matrix3f, ivertexbuilder, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, packedLightIn);
this.vert(matrix4f, matrix3f, ivertexbuilder, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, packedLightIn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@
import dev.architectury.event.events.common.EntityEvent;
import dev.architectury.event.events.common.InteractionEvent;
import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.registry.registries.Registries;
import dev.architectury.utils.PlatformExpectedError;
import dev.itsmeow.betteranimalsplus.Ref;
import dev.itsmeow.betteranimalsplus.common.entity.*;
import dev.itsmeow.betteranimalsplus.common.entity.util.IHaveHunger;
import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntitySharkBase;
import dev.itsmeow.betteranimalsplus.init.ModEntities;
import dev.itsmeow.betteranimalsplus.init.ModLootTables;
import dev.itsmeow.betteranimalsplus.init.ModTriggers;
import dev.itsmeow.betteranimalsplus.mixin.MobAccessor;
import dev.itsmeow.imdlib.IMDLib;
import dev.itsmeow.imdlib.entity.interfaces.IBucketable;
import dev.itsmeow.imdlib.entity.util.variant.IVariant;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
Expand Down Expand Up @@ -134,7 +133,7 @@ public static EventResult rightClickBlock(Player player, InteractionHand hand, B

public static CompoundEventResult<ItemStack> rightClickItem(Player player, InteractionHand hand) {
ItemStack stack = player.getItemInHand(hand);
ResourceLocation reg = Registries.get(Ref.MOD_ID).get(Registry.ITEM_REGISTRY).getId(stack.getItem());
ResourceLocation reg = IMDLib.getRegistry(Registries.ITEM).getId(stack.getItem());
if(reg != null && reg.getPath().equals("portable_jukebox") && player instanceof ServerPlayer) {
if(stack.getTagElement("Disc") != null) {
Item item = ItemStack.of(stack.getTagElement("Disc")).getItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import dev.itsmeow.betteranimalsplus.init.ModEntities;
import dev.itsmeow.betteranimalsplus.init.ModItems;
import dev.itsmeow.betteranimalsplus.init.ModSoundEvents;
import dev.itsmeow.imdlib.IMDLib;
import dev.itsmeow.imdlib.entity.EntityTypeContainer;
import dev.itsmeow.imdlib.entity.util.variant.IVariant;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ItemParticleOption;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
Expand Down Expand Up @@ -266,10 +267,10 @@ public boolean canHoldItem(ItemStack newStack) {
public boolean isPickupBlacklisted(Item item) {
for(String itemsId : (List<String>) getContainer().getCustomConfiguration().getAnyHolder(List.class, PICKUP_BLOCK_LIST_KEY).get()) {
if (itemsId.startsWith("#")) {
if(item.builtInRegistryHolder().is(TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemsId.substring(1))))) {
if(item.builtInRegistryHolder().is(TagKey.create(Registries.ITEM, new ResourceLocation(itemsId.substring(1))))) {
return true;
}
} else if(itemsId.equals(Registry.ITEM.getKey(item).toString())) {
} else if(itemsId.equals(IMDLib.getRegistry(Registries.ITEM).getKey(item).toString())) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ public void onPlayerJump(int jumpPowerIn) {
}

@Override
public boolean canJump() {
public boolean canJump(Player player) {
return true;
}

Expand Down
Loading

0 comments on commit 640d412

Please sign in to comment.