Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FabricMC/fabric
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.94.0+1.20.5
Choose a base ref
...
head repository: FabricMC/fabric
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.94.1+1.20.4
Choose a head ref
  • 20 commits
  • 54 files changed
  • 11 contributors

Commits on Dec 27, 2023

  1. Copy the full SHA
    06274a4 View commit details
  2. Add Client After Block Break Event (#3367)

    * Add clientside after block break event
    
    * Update tests
    
    * Checkstyle, of course
    
    * Update Javadoc
    
    * New Event
    
    * Checkstyle 2 electric boogaloo
    
    * Remove block entity parameter
    
    * Refactor ClientPlayerBlockBreakEvents
    
    * Update Javadoc
    kevinthegreat1 authored Dec 27, 2023
    Copy the full SHA
    389931e View commit details
  3. Bump version

    modmuss50 committed Dec 27, 2023
    Copy the full SHA
    1681346 View commit details

Commits on Jan 5, 2024

  1. Copy the full SHA
    875cc14 View commit details
  2. Bump version

    modmuss50 committed Jan 5, 2024
    Copy the full SHA
    dbf67aa View commit details

Commits on Jan 11, 2024

  1. Copy the full SHA
    e843423 View commit details
  2. Check for the correct BE type in the lookup API (#3510)

    The block lookup API's registerForBlockEntities method currently just
    registers the passed provider for each valid block for that block
    entity.
    
    However, in some situations (such as update suppression or a misbehaving
    mod), the wrong block entity will be present for one of these blocks.
    This means that the (incorrect) block entity will be passed off to the
    provider. Providers (especially those registered with
    registerForBlockEntity) will often blind-cast the supplied BE, leading
    to crashes.
    
    While the wrong BE being present is a bug, we should follow vanilla's
    lead and handle this more gracefully. In this case, we just check
    whether the correct BE type is present before forwarding it to the
    main provider.
    SquidDev authored Jan 11, 2024
    Copy the full SHA
    82b1bb3 View commit details
  3. Add a system property for a custom output directory for gametest stru…

    …ctures (#3509)
    
    * Add a check for the output directory in the test command
    
    * Fix style and add a run configuration with the output directory set
    
    * Update fabric-gametest-api-v1/build.gradle
    
    ---------
    
    Co-authored-by: modmuss <modmuss50@gmail.com>
    ErrorCraft and modmuss50 authored Jan 11, 2024
    Copy the full SHA
    a21facc View commit details
  4. Copy the full SHA
    b7e1463 View commit details
  5. add fabric-api-bom and fabric-api-catalog (#3487)

    * feat: add fabric-api-bom and fabric-api-catalog
    
    * spotlessApply
    
    * Apply suggestions from code review
    
    Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: modmuss <modmuss50@gmail.com>
    Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
    3 people authored Jan 11, 2024
    Copy the full SHA
    679aae3 View commit details
  6. Bump version

    modmuss50 committed Jan 11, 2024
    Copy the full SHA
    0fd1430 View commit details
  7. Exclude meta projects from main maven artifact.

    This fixes being unable to depend on it in dev.
    modmuss50 committed Jan 11, 2024
    Copy the full SHA
    7eebb47 View commit details
  8. Bump version

    modmuss50 committed Jan 11, 2024
    Copy the full SHA
    a462da6 View commit details

Commits on Jan 15, 2024

  1. Add mob conversion event (#3511)

    * Add mob conversion event
    
    * spacing
    
    * use a smarter mixin strategy
    
    * add pig and villager lightning triggers
    
    * tyop
    
    Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
    
    * handle tadpole -> frog conversion
    
    - update javadoc to clarify the handled cases
    - document keepEquipment parameter
    - improve mixin handler names
    
    ---------
    
    Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
    Syst3ms and haykam821 authored Jan 15, 2024
    Copy the full SHA
    44c0f8c View commit details
  2. Stack aware getFoodComponent (#3520)

    * Stack aware `getFoodComponent`
    
    Co-authored-by: Phoupraw <50520903+phoupraw@users.noreply.github.com>
    
    * Back to redirects
    
    ---------
    
    Co-authored-by: Phoupraw <50520903+phoupraw@users.noreply.github.com>
    modmuss50 and Phoupraw authored Jan 15, 2024
    Copy the full SHA
    d6f2b08 View commit details
  3. Don't tick gametests if the server isn't ticking (#3528)

    * Don't tick gametests if the server isn't ticking
    
    * Fix import order
    jaredlll08 authored Jan 15, 2024
    Copy the full SHA
    85d85a9 View commit details
  4. Update to loom 1.5 (#3515)

    * Update to loom 1.5
    
    * Continue to use the mixin AP for now.
    
    * Bump
    
    (cherry picked from commit 05ec3fa)
    modmuss50 committed Jan 15, 2024
    Copy the full SHA
    a438717 View commit details
  5. Bump version

    modmuss50 committed Jan 15, 2024
    Copy the full SHA
    e572f21 View commit details

Commits on Jan 17, 2024

  1. Copy the full SHA
    bf1eca5 View commit details
  2. Bump version

    modmuss50 committed Jan 17, 2024
    Copy the full SHA
    502a698 View commit details
Showing with 1,229 additions and 117 deletions.
  1. +18 −10 build.gradle
  2. +31 −0 fabric-api-bom/build.gradle
  3. +57 −0 fabric-api-catalog/build.gradle
  4. +8 −8 fabric-api-lookup-api-v1/src/main/java/net/fabricmc/fabric/impl/lookup/block/BlockApiLookupImpl.java
  5. +28 −0 ...ity-events-v1/src/main/java/net/fabricmc/fabric/api/entity/event/v1/ServerLivingEntityEvents.java
  6. +36 −0 fabric-entity-events-v1/src/main/java/net/fabricmc/fabric/mixin/entity/event/MobEntityMixin.java
  7. +46 −0 fabric-entity-events-v1/src/main/java/net/fabricmc/fabric/mixin/entity/event/PigEntityMixin.java
  8. +46 −0 fabric-entity-events-v1/src/main/java/net/fabricmc/fabric/mixin/entity/event/TadpoleEntityMixin.java
  9. +46 −0 ...ic-entity-events-v1/src/main/java/net/fabricmc/fabric/mixin/entity/event/VillagerEntityMixin.java
  10. +7 −3 fabric-entity-events-v1/src/main/resources/fabric-entity-events-v1.mixins.json
  11. +4 −0 fabric-entity-events-v1/src/testmod/java/net/fabricmc/fabric/test/entity/event/EntityEventTests.java
  12. +59 −0 ...-v0/src/client/java/net/fabricmc/fabric/api/event/client/player/ClientPlayerBlockBreakEvents.java
  13. +10 −1 .../java/net/fabricmc/fabric/mixin/event/interaction/client/ClientPlayerInteractionManagerMixin.java
  14. +6 −2 ...nts-interaction-v0/src/main/java/net/fabricmc/fabric/api/event/player/PlayerBlockBreakEvents.java
  15. +3 −9 ...raction-v0/src/testmod/java/net/fabricmc/fabric/test/event/interaction/PlayerBreakBlockTests.java
  16. +1 −0 fabric-events-interaction-v0/src/testmod/resources/fabric.mod.json
  17. +32 −0 ...modClient/java/net/fabricmc/fabric/test/client/event/interaction/ClientPlayerBlockBreakTests.java
  18. +11 −0 fabric-gametest-api-v1/build.gradle
  19. +8 −1 fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric/mixin/gametest/MinecraftServerMixin.java
  20. +45 −0 fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric/mixin/gametest/TestCommandMixin.java
  21. +1 −0 fabric-gametest-api-v1/src/main/resources/fabric-gametest-api-v1.mixins.json
  22. +13 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java
  23. +13 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItemStack.java
  24. +32 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BlockItemMixin.java
  25. +41 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/CatEntityMixin.java
  26. +32 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/CookingRecipeJsonBuilderMixin.java
  27. +46 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/FoxEntityMixin.java
  28. +40 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/HungerManagerMixin.java
  29. +32 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/ItemMixin.java
  30. +6 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/ItemStackMixin.java
  31. +24 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/LivingEntityMixin.java
  32. +57 −0 fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/WolfEntityMixin.java
  33. +7 −1 fabric-item-api-v1/src/main/resources/fabric-item-api-v1.mixins.json
  34. +63 −0 fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/FoodGameInitializer.java
  35. +95 −0 fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/FoodGameTest.java
  36. +3 −0 ...-item-api-v1/src/testmod/resources/assets/fabric-item-api-v1-testmod/models/item/damage_food.json
  37. +3 −0 ...ic-item-api-v1/src/testmod/resources/assets/fabric-item-api-v1-testmod/models/item/name_food.json
  38. +4 −2 fabric-item-api-v1/src/testmod/resources/fabric.mod.json
  39. +0 −6 ...ng-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientLoginNetworkAddon.java
  40. +13 −5 .../src/client/java/net/fabricmc/fabric/mixin/networking/client/ClientCommonNetworkHandlerMixin.java
  41. +2 −0 ...1/src/client/java/net/fabricmc/fabric/mixin/networking/client/ClientLoginNetworkHandlerMixin.java
  42. +1 −6 ...king-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerLoginNetworkAddon.java
  43. +2 −0 ...ing-api-v1/src/main/java/net/fabricmc/fabric/mixin/networking/ServerLoginNetworkHandlerMixin.java
  44. +20 −5 ...g-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/login/NetworkingLoginQueryTest.java
  45. +28 −1 ...ng-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/play/NetworkingPlayPacketTest.java
  46. +9 −2 ...dClient/java/net/fabricmc/fabric/test/networking/client/login/NetworkingLoginQueryClientTest.java
  47. +1 −1 ...r-api-v1/src/testmod/java/net/fabricmc/fabric/test/object/builder/PersistentStateManagerTest.java
  48. +61 −0 fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/mixin/transfer/JukeboxBlockEntityMixin.java
  49. +1 −0 fabric-transfer-api-v1/src/main/resources/fabric-transfer-api-v1.mixins.json
  50. +20 −0 ...sfer-api-v1/src/testmod/java/net/fabricmc/fabric/test/transfer/gametests/VanillaStorageTests.java
  51. +51 −51 gradle.properties
  52. +1 −1 gradle/module-validation.gradle
  53. +2 −2 gradle/module-versioning.gradle
  54. +3 −0 settings.gradle
28 changes: 18 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ plugins {
id "idea"
id "maven-publish"
id 'jacoco'
id "fabric-loom" version "1.4.4" apply false
id "fabric-loom" version "1.5.4" apply false
id "com.diffplug.spotless" version "6.20.0"
id "org.ajoberstar.grgit" version "3.1.0"
id "me.modmuss50.remotesign" version "0.4.0" apply false
@@ -16,6 +16,11 @@ def ENV = System.getenv()
version = project.version + "+" + (ENV.GITHUB_RUN_NUMBER ? "" : "local-") + getBranch()
logger.lifecycle("Building Fabric: " + version)

def metaProjects = [
'deprecated',
'fabric-api-bom',
'fabric-api-catalog'
]

import net.fabricmc.loom.util.gradle.SourceSetHelper
import groovy.json.JsonSlurper
@@ -132,7 +137,7 @@ allprojects {
setupRepositories(repositories)
}

if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

@@ -152,6 +157,9 @@ allprojects {

loom {
splitEnvironmentSourceSets()
mixin {
useLegacyMixinAp = true
}
}

sourceSets {
@@ -200,7 +208,7 @@ allprojects {
}

allprojects.each { p ->
if (project.name == "deprecated") {
if (metaProjects.contains(project.name)) {
return
}

@@ -332,7 +340,7 @@ remapTestmodJar {
def testModJarTasks = []

subprojects {
if (it.name == "deprecated" || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) {
if (metaProjects.contains(it.name) || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) {
return
}

@@ -374,7 +382,7 @@ javadoc {
}

allprojects.each {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

@@ -592,7 +600,7 @@ def addPomMetadataInformation(Project project, MavenPom pom) {
}

subprojects {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

@@ -663,7 +671,7 @@ publishing {
def depsNode = asNode().appendNode("dependencies")
subprojects.each {
// The maven BOM containing all of the deprecated modules is added manually below.
if (it.path.startsWith(":deprecated")) {
if (it.path.startsWith(":deprecated") || metaProjects.contains(it.name)) {
return
}

@@ -705,7 +713,7 @@ void setupRepositories(RepositoryHandler repositories) {
}

subprojects.each {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

@@ -718,7 +726,7 @@ def devOnlyModules = ["fabric-gametest-api-v1",]
dependencies {
afterEvaluate {
subprojects.each {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

@@ -734,7 +742,7 @@ dependencies {
remapJar {
afterEvaluate {
subprojects.each {
if (it.name in devOnlyModules || it.name == "deprecated") {
if (it.name in devOnlyModules || metaProjects.contains(it.name)) {
return
}

31 changes: 31 additions & 0 deletions fabric-api-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id 'java-platform'
}

version = rootProject.version

publishing.publications {
register('mavenJava', MavenPublication) {
from(components['javaPlatform'])
}
}

tasks.withType(GenerateModuleMetadata) {
// todo: RemoteSignJar fails when this is false (as set by parent build script)
enabled = true
}

dependencies {
constraints {
for (proj in rootProject.allprojects) {
if (proj == project) { // the bom itself
continue
}
if (proj.name == 'fabric-api-catalog') {
continue
}

api(project(proj.path))
}
}
}
57 changes: 57 additions & 0 deletions fabric-api-catalog/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
plugins {
id 'version-catalog'
}

version = rootProject.version

publishing.publications {
register('mavenJava', MavenPublication) {
from components.versionCatalog
}
}

tasks.withType(GenerateModuleMetadata) {
// todo: RemoteSignJar fails when this is false (as set by parent build script)
enabled = true
}

// Avoid configuration ordering issues by creating the catalog entries during task execution time
tasks.register('configureCatalog') {
doFirst {
doConfigureCatalog()
}
}
tasks.named('generateCatalogAsToml') {
dependsOn('configureCatalog')
}

def doConfigureCatalog() {
for (proj in rootProject.allprojects) {
if (proj == project) { // the catalog itself
continue
}

String catalogName = proj.name
if (catalogName == 'fabric-api-base') {
catalogName = 'base'
} else if (catalogName == 'fabric-api-bom') {
catalogName = 'bom'
} else if (catalogName == 'deprecated') {
catalogName = 'deprecated-fabric-api'
} else if (catalogName == 'fabric-api') {
catalogName = 'fabric-api'
} else {
catalogName = catalogName.substring('fabric-'.length())
}

if (proj.parent != null && proj.parent.name == 'deprecated') {
catalogName = 'deprecated-' + catalogName
}

catalog {
versionCatalog {
library(catalogName, "net.fabricmc.fabric-api:${proj.name}:${proj.version}")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -153,17 +153,17 @@ public void registerForBlockEntities(BlockEntityApiProvider<A, C> provider, Bloc
throw new IllegalArgumentException("Must register at least one BlockEntityType instance with a BlockEntityApiProvider.");
}

BlockApiProvider<A, C> nullCheckedProvider = (world, pos, state, blockEntity, context) -> {
if (blockEntity == null) {
return null;
} else {
return provider.find(blockEntity, context);
}
};

for (BlockEntityType<?> blockEntityType : blockEntityTypes) {
Objects.requireNonNull(blockEntityType, "Encountered null block entity type while registering a block entity API provider mapping.");

BlockApiProvider<A, C> nullCheckedProvider = (world, pos, state, blockEntity, context) -> {
if (blockEntity == null || blockEntity.getType() != blockEntityType) {
return null;
} else {
return provider.find(blockEntity, context);
}
};

Block[] blocks = ((BlockEntityTypeAccessor) blockEntityType).getBlocks().toArray(new Block[0]);
registerForBlocks(nullCheckedProvider, blocks);
}
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.MobEntity;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
@@ -73,6 +74,21 @@ public final class ServerLivingEntityEvents {
}
});

/**
* An event that is called when a mob has been converted to another type.
*
* <p>When this event is called, the old instance has not yet been discarded, and the new one has not yet been spawned.
* Mods may use this event to copy some of the old entity's data to the converted one.</p>
*
* <p>This event only handles cases where the entity type changes, requiring a new instance. Notably it does not
* cover mooshrooms changing color from lightning, creepers getting charged, or wolves being tamed.</p>
*/
public static final Event<MobConversion> MOB_CONVERSION = EventFactory.createArrayBacked(MobConversion.class, callbacks -> (previous, converted, keepEquipment) -> {
for (MobConversion callback : callbacks) {
callback.onConversion(previous, converted, keepEquipment);
}
});

@FunctionalInterface
public interface AllowDamage {
/**
@@ -112,6 +128,18 @@ public interface AfterDeath {
void afterDeath(LivingEntity entity, DamageSource damageSource);
}

@FunctionalInterface
public interface MobConversion {
/**
* Called when a mob is converted to another type.
*
* @param previous the previous entity instance
* @param converted the new instance for the converted entity
* @param keepEquipment whether the converted entity should keep the previous one's equipment, like armor
*/
void onConversion(MobEntity previous, MobEntity converted, boolean keepEquipment);
}

private ServerLivingEntityEvents() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.entity.event;

import com.llamalad7.mixinextras.sugar.Local;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.MobEntity;

import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;

@Mixin(MobEntity.class)
public class MobEntityMixin {
@ModifyArg(method = "convertTo", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z"))
private Entity afterEntityConverted(Entity converted, @Local(argsOnly = true) boolean keepEquipment) {
ServerLivingEntityEvents.MOB_CONVERSION.invoker().onConversion((MobEntity) (Object) this, (MobEntity) converted, keepEquipment);
return converted;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.entity.event;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.world.World;

import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;

@Mixin(PigEntity.class)
abstract class PigEntityMixin extends AnimalEntity {
protected PigEntityMixin(EntityType<? extends AnimalEntity> entityType, World world) {
super(entityType, world);
}

@ModifyArg(
method = "onStruckByLightning",
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z")
)
private Entity afterPiglinConversion(Entity converted) {
ServerLivingEntityEvents.MOB_CONVERSION.invoker().onConversion(this, (MobEntity) converted, false);
return converted;
}
}
Loading