Skip to content

Commit

Permalink
Revert ComponentContainer#tickComponents rename
Browse files Browse the repository at this point in the history
The previous change broke compatibility between modules
  • Loading branch information
Pyrofab committed Oct 17, 2020
1 parent b49ea8b commit 787a09a
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ public interface ComponentContainer extends NbtSerializable {
@Contract(mutates = "this")
void copyFrom(ComponentContainer other);

void tickServerComponents();
@ApiStatus.Experimental
void tickComponents();

@CheckEnv(Env.CLIENT)
@ApiStatus.Experimental
void tickClientComponents();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static <I> Class<? extends ComponentContainer> spinComponentContainer(Cla
init.visitVarInsn(Opcodes.ILOAD, 1);
init.visitMethodInsn(Opcodes.INVOKESPECIAL, STATIC_COMPONENT_CONTAINER, "<init>", FAST_COMPONENT_CONTAINER_CTOR_DESC, false);

MethodVisitor serverTick = classNode.visitMethod(Opcodes.ACC_PUBLIC, "tickServerComponents", "()V", null, null);
MethodVisitor serverTick = classNode.visitMethod(Opcodes.ACC_PUBLIC, "tickComponents", "()V", null, null);
serverTick.visitCode();
MethodVisitor clientTick = classNode.visitMethod(Opcodes.ACC_PUBLIC, "tickClientComponents", "()V", null, null);
clientTick.visitCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Set<ComponentKey<?>> keys() {
}

@Override // overridden by ASM
public void tickServerComponents() {
public void tickComponents() {
for (ComponentKey<?> key : this.keys()) {
Component c = key.getFromContainer(this);
if (c instanceof ServerTickingComponent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class MixinWorld {
// ModifyVariable to easily catch the local variable we want
@ModifyVariable(method = "tickBlockEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Tickable;tick()V", shift = At.Shift.AFTER))
protected BlockEntity tick(BlockEntity be) {
((InternalComponentProvider) be).getComponentContainer().tickServerComponents();
((InternalComponentProvider) be).getComponentContainer().tickComponents();
return be;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
public abstract class MixinServerWorld {
@Inject(method = "tickChunk", at = @At("RETURN"))
private void tick(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci) {
((InternalComponentProvider) chunk).getComponentContainer().tickServerComponents();
((InternalComponentProvider) chunk).getComponentContainer().tickComponents();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public abstract class MixinServerWorld {

@Inject(method = "tickEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;tick()V", shift = At.Shift.AFTER))
private void tick(Entity entity, CallbackInfo ci) {
((InternalComponentProvider) entity).getComponentContainer().tickServerComponents();
((InternalComponentProvider) entity).getComponentContainer().tickComponents();
}

@Inject(method = "tickPassenger", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;tickRiding()V", shift = At.Shift.AFTER))
private void tickRiding(Entity vehicle, Entity passenger, CallbackInfo ci) {
((InternalComponentProvider) passenger).getComponentContainer().tickServerComponents();
((InternalComponentProvider) passenger).getComponentContainer().tickComponents();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public abstract class MixinMinecraftServer {

@Inject(at = @At("TAIL"), method = "tick")
private void onEndTick(BooleanSupplier shouldKeepTicking, CallbackInfo info) {
((InternalComponentProvider) ComponentProvider.fromLevel(this.getSaveProperties().getMainWorldProperties())).getComponentContainer().tickServerComponents();
((InternalComponentProvider) ComponentProvider.fromLevel(this.getSaveProperties().getMainWorldProperties())).getComponentContainer().tickComponents();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public abstract class MixinMinecraftServer {
@Inject(at = @At("TAIL"), method = "tick")
private void onEndTick(BooleanSupplier shouldKeepTicking, CallbackInfo info) {
ServerScoreboard scoreboard = this.getScoreboard();
((InternalComponentProvider) ComponentProvider.fromScoreboard(scoreboard)).getComponentContainer().tickServerComponents();
((InternalComponentProvider) ComponentProvider.fromScoreboard(scoreboard)).getComponentContainer().tickComponents();

for (Team team : scoreboard.getTeams()) {
((InternalComponentProvider) ComponentProvider.fromTeam(team)).getComponentContainer().tickServerComponents();
((InternalComponentProvider) ComponentProvider.fromTeam(team)).getComponentContainer().tickComponents();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void constructor(CallbackInfo ci) {

@Inject(method = "tick", at = @At("RETURN"))
private void tick(BooleanSupplier shouldKeepTicking, CallbackInfo ci) {
((InternalComponentProvider) this).getComponentContainer().tickServerComponents();
((InternalComponentProvider) this).getComponentContainer().tickComponents();
}

@Override
Expand Down

0 comments on commit 787a09a

Please sign in to comment.