Skip to content

Commit

Permalink
Update to 1.20.5-pre1
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Apr 13, 2024
1 parent b112cd2 commit c172744
Show file tree
Hide file tree
Showing 35 changed files with 185 additions and 1,124 deletions.
6 changes: 0 additions & 6 deletions .idea/copyright/CCA.xml

This file was deleted.

13 changes: 10 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import net.fabricmc.loom.task.RemapJarTask
import java.net.URI

plugins {
id("fabric-loom") version "1.5-SNAPSHOT"
id("io.github.ladysnake.chenille") version "0.12.0-SNAPSHOT+build.1"
id("fabric-loom") version "1.6-SNAPSHOT"
id("io.github.ladysnake.chenille") version "0.12.0"
id("org.cadixdev.licenser") version "0.6.1"
}

Expand All @@ -18,7 +18,7 @@ allprojects {
apply(plugin = "io.github.ladysnake.chenille")

chenille {
javaVersion = 17
javaVersion = 21
license = "MIT"
displayName = providers.gradleProperty("display_name").get()
owners = providers.gradleProperty("owners").get()
Expand All @@ -38,6 +38,13 @@ allprojects {
includeGroupByRegex("dev\\.onyxstudios.*")
}
}
maven {
name = "Ladysnake Mods Snapshots"
url = URI("https://maven.ladysnake.org/snapshots")
content {
includeGroup("org.ladysnake")
}
}
maven {
name = "JitPack"
url = URI("https://jitpack.io")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
import org.ladysnake.cca.api.v3.component.ComponentRegistryV3;
import org.ladysnake.cca.api.v3.component.ComponentV3;

public interface
Vita extends ComponentV3 {
public interface Vita extends ComponentV3 {
ComponentKey<Vita> KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("cca-base-test", "vita"), Vita.class);

static Vita get(Object provider) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand Down Expand Up @@ -66,13 +67,6 @@ public abstract class MixinBlockEntity implements ComponentProvider {
@Unique
private ComponentContainer components;

@Inject(method = "createFromNbt", at = @At("RETURN"))
private static void readComponentData(BlockPos pos, BlockState state, NbtCompound nbt, CallbackInfoReturnable<BlockEntity> cir) {
if (cir.getReturnValue() != null) {
cir.getReturnValue().asComponentProvider().getComponentContainer().fromTag(nbt);
}
}

@Inject(method = "<init>", at = @At("RETURN"))
private void init(BlockEntityType<?> type, BlockPos pos, BlockState state, CallbackInfo ci) {
// Promise, this is a BlockEntity
Expand All @@ -85,19 +79,9 @@ private void writeNbt(CallbackInfoReturnable<NbtCompound> cir) {
this.components.toTag(cir.getReturnValue());
}

/**
* Yay redundancy!
*
* <p>This method may be overridden without calling super(), so we need safety nets.
* On the other hand, we still need this inject because mods can also call {@link BlockEntity#readNbt(NbtCompound)} directly.
* We mostly do not care about what happens on the client though, since we have our own packets.
*
* @see #readComponentData(BlockPos, BlockState, NbtCompound, CallbackInfoReturnable)
* @see MixinBlockDataObject#readComponentData(NbtCompound, CallbackInfo)
*/
@Inject(method = "readNbt", at = @At(value = "RETURN"))
private void readNbt(NbtCompound tag, CallbackInfo ci) {
this.components.fromTag(tag);
@Inject(method = "read", at = @At(value = "RETURN"))
private void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup, CallbackInfo ci) {
this.components.fromTag(nbt);
}

@Nonnull
Expand Down Expand Up @@ -125,5 +109,4 @@ public <C extends AutoSyncedComponent> ComponentUpdatePayload<?> toComponentPack
data
);
}

}

This file was deleted.

This file was deleted.

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

@Mixin(ServerPlayerEntity.class)
public abstract class MixinServerPlayerEntity {
@Inject(method = "openCommandBlockScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;create(Lnet/minecraft/block/entity/BlockEntity;Ljava/util/function/Function;)Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;"))
@Inject(method = "openCommandBlockScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;create(Lnet/minecraft/block/entity/BlockEntity;Ljava/util/function/BiFunction;)Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;"))
private void syncBlockEntity(CommandBlockBlockEntity commandBlock, CallbackInfo ci) {
BlockEntitySyncCallback.EVENT.invoker().onBlockEntitySync((ServerPlayerEntity)(Object) this, commandBlock);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
"compatibilityLevel": "JAVA_8",
"package": "org.ladysnake.cca.mixin.block",
"mixins": [
"common.MixinBlockDataObject",
"common.MixinBlockEntity",
"common.MixinBlockStateArgument",
"common.MixinChunkDataSender",
"common.MixinChunkHolder",
"common.MixinFallingBlockEntity",
"common.MixinServerPlayerEntity",
"common.MixinWorldChunk"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public void beSerialize(TestContext ctx) {
)
);
be.getComponent(Vita.KEY).setVitality(42);
NbtCompound nbt = be.createNbt();
NbtCompound nbt = be.createNbt(ctx.getWorld().getRegistryManager());
BlockEntity be1 = Objects.requireNonNull(
BlockEntityType.END_GATEWAY.instantiate(
pos, Blocks.END_GATEWAY.getDefaultState()
)
);
GameTestUtil.assertTrue("New BlockEntity should have values zeroed", be1.getComponent(Vita.KEY).getVitality() == 0);
be1.readNbt(nbt);
be1.read(nbt, ctx.getWorld().getRegistryManager());
GameTestUtil.assertTrue("BlockEntity component data should survive deserialization", be1.getComponent(Vita.KEY).getVitality() == 42);
ctx.complete();
}
Expand All @@ -73,14 +73,14 @@ public void canQueryThroughLookup(TestContext ctx) {
)
);
getVita(ctx, pos, be).setVitality(42);
NbtCompound nbt = be.createNbt();
NbtCompound nbt = be.createNbt(ctx.getWorld().getRegistryManager());
BlockEntity be1 = Objects.requireNonNull(
BlockEntityType.END_GATEWAY.instantiate(
pos, Blocks.END_GATEWAY.getDefaultState()
)
);
GameTestUtil.assertTrue("New BlockEntity should have values zeroed", getVita(ctx, pos, be1).getVitality() == 0);
be1.readNbt(nbt);
be1.read(nbt, ctx.getWorld().getRegistryManager());
GameTestUtil.assertTrue("BlockEntity component data should survive deserialization", getVita(ctx, pos, be1).getVitality() == 42);
ctx.complete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
package org.ladysnake.cca.mixin.entity.common;

import net.minecraft.component.DataComponentTypes;
import net.minecraft.entity.Bucketable;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.item.ItemStack;
Expand All @@ -33,12 +34,9 @@

@Mixin(Bucketable.class)
public interface BucketableMixin {
@Inject(method = "copyDataToStack(Lnet/minecraft/entity/mob/MobEntity;Lnet/minecraft/item/ItemStack;)V", at = @At("RETURN"))
private static void writeComponentsToStack(MobEntity entity, ItemStack stack, CallbackInfo ci) {
NbtCompound nbt = stack.getNbt();
if (nbt != null) {
entity.asComponentProvider().getComponentContainer().toTag(nbt);
}
@Inject(method = "method_57302", at = @At("RETURN"))
private static void writeComponentsToStack(MobEntity mobEntity, NbtCompound nbtCompound, CallbackInfo ci) {
mobEntity.asComponentProvider().getComponentContainer().toTag(nbtCompound);
}

@Inject(method = "copyDataFromNbt(Lnet/minecraft/entity/mob/MobEntity;Lnet/minecraft/nbt/NbtCompound;)V", at = @At("RETURN"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.data.DataTracker;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
Expand All @@ -35,7 +36,7 @@ public TestEntity(EntityType<?> type, World world) {
}

@Override
protected void initDataTracker() {
protected void initDataTracker(DataTracker.Builder builder) {

}

Expand Down
3 changes: 0 additions & 3 deletions cardinal-components-item/build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions cardinal-components-item/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencies {
api(project(path = ":cardinal-components-base", configuration = "namedElements"))
}

loom {
accessWidenerPath = project.file("src/main/resources/cardinal-components-item.accesswidener")
}
Loading

0 comments on commit c172744

Please sign in to comment.