Skip to content

Commit

Permalink
1.21.0 First pass
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Oct 10, 2024
1 parent 12eba28 commit b42e289
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 106 deletions.
15 changes: 7 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# suppress inspection "UnusedProperty" for whole file
org.gradle.jvmargs=-Xmx2G

paradiseLostVersion=2.2.5-beta+1.20.5
paradiseLostVersion=2.2.5-beta+1.21.0

minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
loader_version=0.16.5
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.16.7
javaVersion=21

fabric_version=0.97.8+1.20.5
customportalapiVersion=0.0.1-beta65.5-1.20.5
cardinalComponentsVersion=6.0.0
fabric_version=0.102.0+1.21
customportalapiVersion=0.0.1-beta66-1.21
cardinalComponentsVersion=6.1.0
crowdinTranslateVersion=1.20
clothConfigVersion=14.0.139
fabricAsmVersion=2.3
4 changes: 2 additions & 2 deletions src/main/java/net/id/paradiselost/ParadiseLost.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public class ParadiseLost implements ModInitializer, ClientModInitializer, Dedic
*/
public static Identifier locate(String location) {
if (location.contains(":")) {
return new Identifier(location);
return Identifier.of(location);
} else {
return new Identifier(MOD_ID, location);
return Identifier.of(MOD_ID, location);
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/net/id/paradiselost/api/BlockLikeEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
import net.minecraft.item.AutomaticItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
import net.minecraft.registry.BuiltinRegistries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.server.network.EntityTrackerEntry;
import net.minecraft.state.property.Properties;
import net.minecraft.util.crash.CrashReportSection;
import net.minecraft.util.hit.BlockHitResult;
Expand Down Expand Up @@ -376,8 +379,8 @@ public boolean entityDataRequiresOperator() {
}

@Override
public EntitySpawnS2CPacket createSpawnPacket() {
return new EntitySpawnS2CPacket(this, Block.getRawIdFromState(this.getBlockState()) * (this.partOfSet ? -1 : 1));
public Packet<ClientPlayPacketListener> createSpawnPacket(EntityTrackerEntry entityTrackerEntry) {
return new EntitySpawnS2CPacket(this, entityTrackerEntry, Block.getRawIdFromState(this.getBlockState()) * (this.partOfSet ? -1 : 1));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import net.fabricmc.api.Environment;
import net.id.paradiselost.util.ParadiseLostSoundEvents;
import net.kyrptonaught.customportalapi.CustomPortalBlock;
import net.kyrptonaught.customportalapi.interfaces.EntityInCustomPortal;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.MinecraftClient;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.BlockPos;
Expand All @@ -22,7 +20,7 @@ public ParadiseLostPortalBlock(Settings settings) {
@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
if (!(MinecraftClient.getInstance().player instanceof EntityInCustomPortal entity && entity.didTeleport()) && random.nextInt(200) == 0) {
if (random.nextInt(200) == 0) {
world.getProfiler().push("portal");
world.playSound((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, ParadiseLostSoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, random.nextFloat() * 0.4F + 0.8F, false);
world.getProfiler().pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ public void clear() {

protected void readComponents(BlockEntity.ComponentsAccess components) {
super.readComponents(components);
(components.getOrDefault(DataComponentTypes.CONTAINER, ContainerComponent.DEFAULT)).copyTo(this.getItemsBeingCooked());
(components.getOrDefault(ComponentTypes.CONTAINER, ContainerComponent.DEFAULT)).copyTo(this.getItemsBeingCooked());
}

protected void addComponents(ComponentMap.Builder componentMapBuilder) {
super.addComponents(componentMapBuilder);
componentMapBuilder.add(DataComponentTypes.CONTAINER, ContainerComponent.fromStacks(this.getItemsBeingCooked()));
componentMapBuilder.add(ComponentTypes.CONTAINER, ContainerComponent.fromStacks(this.getItemsBeingCooked()));
}

public void removeFromCopiedStackNbt(NbtCompound nbt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.fabricmc.fabric.mixin.client.rendering.EntityModelLayersAccessor;
import net.id.paradiselost.ParadiseLost;
import net.id.paradiselost.client.model.armor.PhoenixArmorModel;
import net.id.paradiselost.client.model.block.DungeonSwitchModel;
import net.id.paradiselost.client.model.entity.*;
import net.minecraft.client.model.Dilation;
import net.minecraft.client.model.TexturedModelData;
Expand All @@ -30,7 +29,6 @@ public class ParadiseLostModelLayers {
public static final EntityModelLayer MOA = register("moa", "main", MoaModel.getTexturedModelData());
public static final EntityModelLayer PHOENIX_ARMOR = register("phoenix_armor", "main", PhoenixArmorModel.getTexturedModelData());

public static final EntityModelLayer DUNGEON_SWITCH = register("dungeon_switch", "main", DungeonSwitchModel.getTexturedModelData());

public static EntityModelLayer register(Identifier id, String layer, TexturedModelData data) {
EntityModelLayer entityModelLayer = new EntityModelLayer(id, layer);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@Environment(EnvType.CLIENT)
public class PhoenixArmorRenderer implements ArmorRenderer { //24: Left this in to repurpose it later because I liked it
private static final Identifier TEXTURE = new Identifier("minecraft", "textures/models/armor/paradise_lost_phoenix_layer_1.png");
private static final Identifier TEXTURE = Identifier.of("minecraft", "textures/models/armor/paradise_lost_phoenix_layer_1.png");
private static PhoenixArmorModel phoenixArmorModel;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static void renderCherine(DrawContext context, MinecraftClient client, B

private static void renderOlvite(DrawContext context, MinecraftClient client, BloodstoneCapturedData bloodstoneCapturedData) {
StatusEffectSpriteManager statusEffectSpriteManager = client.getStatusEffectSpriteManager();
var effectAtlas = client.getSpriteAtlas(new Identifier("textures/atlas/blocks.png"));
var effectAtlas = client.getSpriteAtlas(Identifier.of("textures/atlas/blocks.png"));
Sprite affinitySprite = effectAtlas.apply(ParadiseLost.locate("item/icons/affinity"));
Sprite raceSprite = effectAtlas.apply(ParadiseLost.locate("item/icons/race"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.id.paradiselost.blocks.util.DynamicColorBlock;
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.color.world.FoliageColors;
import net.minecraft.client.color.world.GrassColors;
import net.minecraft.registry.Registries;
import net.minecraft.world.biome.FoliageColors;
import net.minecraft.world.biome.GrassColors;

@Environment(EnvType.CLIENT)
public class ParadiseLostColorProviders {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/id/paradiselost/component/MoaGenes.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public Identifier getTexture() {
Identifier id = this.race.getId();
String name = id.getPath();
String namespace = id.getNamespace();
return new Identifier(namespace, "textures/entity/moa/" + name + ".png");
return Identifier.of(namespace, "textures/entity/moa/" + name + ".png");
}

public float getHunger() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,6 @@ public UUID getOwnerUuid() {
return getGenes().getOwner();
}

@Override
public EntityView method_48926() {
return null;
}

@Nullable
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ public boolean canBeSaddled() {
}

@Override
public void saddle(@Nullable SoundCategory sound) {
public void saddle(ItemStack stack, @Nullable SoundCategory soundCategory) {
//this.items.setStack(0, new ItemStack(Items.SADDLE));
if (sound != null) {
getWorld().playSoundFromEntity(null, this, SoundEvents.ENTITY_PIG_SADDLE, sound, 0.5F, 1.0F);
if (soundCategory != null) {
getWorld().playSoundFromEntity(null, this, SoundEvents.ENTITY_PIG_SADDLE, soundCategory, 0.5F, 1.0F);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ private static Settings unstackableRareTool() {

public static final Item GLAZED_GOLD_UPGRADE = add("glazed_gold_upgrade_smithing_template", new SmithingTemplateItem(
GLAZED_GOLD_UPGRADE_APPLIES_TO_TEXT, GLAZED_GOLD_UPGRADE_INGREDIENTS_TEXT, GLAZED_GOLD_UPGRADE_TEXT, GLAZED_GOLD_UPGRADE_BASE_SLOT_DESCRIPTION_TEXT, GLAZED_GOLD_UPGRADE_ADDITIONS_SLOT_DESCRIPTION_TEXT,
List.of(new Identifier("item/empty_armor_slot_helmet"), new Identifier("item/empty_armor_slot_chestplate"), new Identifier("item/empty_armor_slot_leggings"), new Identifier("item/empty_armor_slot_boots"),
new Identifier("item/empty_slot_hoe"), new Identifier("item/empty_slot_axe"), new Identifier("item/empty_slot_sword"), new Identifier("item/empty_slot_shovel"), new Identifier("item/empty_slot_pickaxe")),
List.of(new Identifier("item/empty_slot_ingot"))
List.of(Identifier.of("item/empty_armor_slot_helmet"), Identifier.of("item/empty_armor_slot_chestplate"), Identifier.of("item/empty_armor_slot_leggings"), Identifier.of("item/empty_armor_slot_boots"),
Identifier.of("item/empty_slot_hoe"), Identifier.of("item/empty_slot_axe"), Identifier.of("item/empty_slot_sword"), Identifier.of("item/empty_slot_shovel"), Identifier.of("item/empty_slot_pickaxe")),
List.of(Identifier.of("item/empty_slot_ingot"))
));

private static Settings wearable() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/id/paradiselost/items/misc/MoaEggItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import net.id.paradiselost.entities.passive.moa.MoaAttributes;
import net.id.paradiselost.entities.passive.moa.MoaEntity;
import net.id.paradiselost.items.utils.ParadiseLostDataComponentTypes;
import net.minecraft.client.item.TooltipType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
Expand Down Expand Up @@ -47,7 +47,7 @@ public ActionResult useOnBlock(ItemUsageContext contextIn) {

@Override
@Environment(EnvType.CLIENT)
public void appendTooltip(ItemStack stack, net.minecraft.item.Item.TooltipContext context, List<Text> tooltip, TooltipType type) {
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
var genes = stack.getOrDefault(ParadiseLostDataComponentTypes.MOA_GENES, null);
if (genes != null) {
Identifier raceId = genes.race();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.id.paradiselost.items.tools;

import com.google.common.base.Suppliers;
import net.fabricmc.yarn.constants.MiningLevels;
import net.id.paradiselost.items.ParadiseLostItems;
import net.minecraft.block.Block;
import net.minecraft.item.ToolMaterial;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import net.fabricmc.api.Environment;
import net.id.paradiselost.items.utils.ParadiseLostDataComponentTypes;
import net.id.paradiselost.util.ParadiseLostSoundEvents;
import net.minecraft.client.item.TooltipType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.sound.SoundCategory;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
Expand All @@ -29,7 +29,7 @@ public BloodstoneItem(net.minecraft.item.Item.Settings settings) {

@Override
@Environment(EnvType.CLIENT)
public void appendTooltip(ItemStack stack, net.minecraft.item.Item.TooltipContext context, List<Text> tooltip, TooltipType type) {
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
tooltip.addAll(getDefaultText());
super.appendTooltip(stack, context, tooltip, type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.id.paradiselost.ParadiseLost;
import net.minecraft.component.DataComponentType;
import net.minecraft.component.ComponentType;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.codec.PacketCodecs;
Expand All @@ -23,14 +23,14 @@ public class ParadiseLostDataComponentTypes {

// Registered Components

public static final DataComponentType<MoaGeneComponent> MOA_GENES = register("moa_genes", (builder) -> builder.codec(MoaGeneComponent.CODEC).packetCodec(MoaGeneComponent.PACKET_CODEC).cache());
public static final DataComponentType<BloodstoneComponent> BLOODSTONE = register("bloodstone", (builder) -> builder.codec(BloodstoneComponent.CODEC).packetCodec(BloodstoneComponent.PACKET_CODEC));
public static final ComponentType<MoaGeneComponent> MOA_GENES = register("moa_genes", (builder) -> builder.codec(MoaGeneComponent.CODEC).packetCodec(MoaGeneComponent.PACKET_CODEC).cache());
public static final ComponentType<BloodstoneComponent> BLOODSTONE = register("bloodstone", (builder) -> builder.codec(BloodstoneComponent.CODEC).packetCodec(BloodstoneComponent.PACKET_CODEC));


// Util

private static <T> DataComponentType<T> register(String id, UnaryOperator<DataComponentType.Builder<T>> builderOperator) {
return Registry.register(Registries.DATA_COMPONENT_TYPE, locate(id), builderOperator.apply(DataComponentType.builder()).build());
private static <T> ComponentType<T> register(String id, UnaryOperator<ComponentType.Builder<T>> builderOperator) {
return Registry.register(Registries.DATA_COMPONENT_TYPE, locate(id), builderOperator.apply(ComponentType.builder()).build());
}

public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class CloudRendererMixin {
@Nullable
private VertexBuffer cloudsBuffer;

@Shadow private BufferBuilder.BuiltBuffer renderClouds(BufferBuilder builder, double x, double y, double z, Vec3d color) {
@Shadow private BuiltBuffer buildCloudsBuffer(Tessellator tessellator, double x, double y, double z, Vec3d color) {
throw new AssertionError();
}

Expand Down Expand Up @@ -100,15 +100,13 @@ private void internalCloudRender(MatrixStack matrices, Matrix4f matrix4f, Matrix

if (this.cloudsDirty) {
this.cloudsDirty = false;
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
if (this.cloudsBuffer != null) {
this.cloudsBuffer.close();
}

this.cloudsBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
BufferBuilder.BuiltBuffer builtBuffer = this.renderClouds(bufferBuilder, posX, posY, posZ, vec3d);
this.cloudsBuffer.bind();
this.cloudsBuffer.upload(builtBuffer);
this.cloudsBuffer.upload(this.buildCloudsBuffer(Tessellator.getInstance(), posX, posY, posZ, vec3d));
VertexBuffer.unbind();
}

Expand Down

This file was deleted.

0 comments on commit b42e289

Please sign in to comment.