mirror of
https://github.com/FabricMC/fabric.git
synced 2025-09-07 03:39:18 +00:00
23w35a (#3292)
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.api.object.builder.v1.advancement;
|
||||
|
||||
import net.minecraft.advancement.criterion.Criterion;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import net.fabricmc.fabric.mixin.object.builder.CriteriaAccessor;
|
||||
|
||||
/**
|
||||
* Allows registering advancement criteria for triggers.
|
||||
*
|
||||
* <p>A registered criterion (trigger) can be retrieved through
|
||||
* {@link net.minecraft.advancement.criterion.Criteria#getById(Identifier)}.</p>
|
||||
*
|
||||
* @see net.minecraft.advancement.criterion.Criteria
|
||||
* @deprecated Replaced by access widener for {@link net.minecraft.advancement.criterion.Criteria#register(Criterion)}
|
||||
* in Fabric Transitive Access Wideners (v1).
|
||||
*/
|
||||
@Deprecated
|
||||
public final class CriterionRegistry {
|
||||
/**
|
||||
* Registers a criterion for a trigger for advancements.
|
||||
*
|
||||
* @param <T> the criterion's type
|
||||
* @param criterion the criterion registered
|
||||
* @return the criterion registered, for chaining
|
||||
* @throws IllegalArgumentException if a criterion with the same {@link
|
||||
* Criterion#getId() id} exists
|
||||
*/
|
||||
public static <T extends Criterion<?>> T register(T criterion) {
|
||||
CriteriaAccessor.callRegister(criterion);
|
||||
return criterion;
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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.object.builder;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import net.minecraft.advancement.criterion.Criteria;
|
||||
import net.minecraft.advancement.criterion.Criterion;
|
||||
|
||||
@Mixin(Criteria.class)
|
||||
public interface CriteriaAccessor {
|
||||
@Invoker
|
||||
static <T extends Criterion<?>> T callRegister(T object) {
|
||||
throw new AssertionError("Mixin dummy");
|
||||
}
|
||||
}
|
@@ -5,7 +5,6 @@
|
||||
"mixins": [
|
||||
"AbstractBlockAccessor",
|
||||
"AbstractBlockSettingsAccessor",
|
||||
"CriteriaAccessor",
|
||||
"DefaultAttributeRegistryAccessor",
|
||||
"DefaultAttributeRegistryMixin",
|
||||
"DetectorRailBlockMixin",
|
||||
|
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.test.object.builder;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.advancement.criterion.ImpossibleCriterion;
|
||||
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.advancement.CriterionRegistry;
|
||||
|
||||
public final class CriterionRegistryTest {
|
||||
public static void init() {
|
||||
CriterionRegistry.register(new CustomCriterion());
|
||||
}
|
||||
|
||||
static class CustomCriterion extends ImpossibleCriterion {
|
||||
static final Identifier ID = ObjectBuilderTestConstants.id("custom");
|
||||
|
||||
@Override
|
||||
public Identifier getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Conditions conditionsFromJson(JsonObject jsonObject, AdvancementEntityPredicateDeserializer advancementEntityPredicateDeserializer) {
|
||||
ObjectBuilderTestConstants.LOGGER.info("Loading custom criterion in advancement!");
|
||||
return super.conditionsFromJson(jsonObject, advancementEntityPredicateDeserializer);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "minecraft:command_block_minecart"
|
||||
},
|
||||
"title": {
|
||||
"text": "Criterion registry test advancement"
|
||||
},
|
||||
"description": {
|
||||
"text": "Criterion registry test advancement description"
|
||||
},
|
||||
"frame": "task",
|
||||
"show_toast": false,
|
||||
"announce_to_chat": false,
|
||||
"hidden": false,
|
||||
"background": "minecraft:textures/gui/advancements/backgrounds/stone.png"
|
||||
},
|
||||
"criteria": {
|
||||
"custom": {
|
||||
"trigger": "fabric-object-builder-api-v1-testmod:custom"
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"custom"
|
||||
]
|
||||
]
|
||||
}
|
@@ -29,7 +29,6 @@
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"net.fabricmc.fabric.test.object.builder.BlockEntityTypeBuilderTest",
|
||||
"net.fabricmc.fabric.test.object.builder.CriterionRegistryTest::init",
|
||||
"net.fabricmc.fabric.test.object.builder.FabricBlockSettingsTest",
|
||||
"net.fabricmc.fabric.test.object.builder.VillagerTypeTest1",
|
||||
"net.fabricmc.fabric.test.object.builder.VillagerTypeTest2",
|
||||
|
Reference in New Issue
Block a user