mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-28 07:55:53 +00:00
1.20.2-pre1
This commit is contained in:
368 files changed
+3555
-6356
No files matched your search
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.loot;
|
||||
|
||||
/*
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -22,7 +22,7 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* This LootItemCondition "forge:can_tool_perform_action" can be used to check if a tool can perform a given ToolAction.
|
||||
*/
|
||||
* /
|
||||
public class CanToolPerformAction implements LootItemCondition {
|
||||
|
||||
public static final LootItemConditionType LOOT_CONDITION_TYPE = new LootItemConditionType(new CanToolPerformAction.Serializer());
|
||||
@@ -64,3 +64,4 @@ public class CanToolPerformAction implements LootItemCondition {
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.loot;
|
||||
|
||||
/*
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.mojang.serialization.Codec;
|
||||
@@ -26,7 +26,7 @@ import java.util.function.Function;
|
||||
* {@link LootModifier} Supplies base functionality; most modders should only need to extend that.<br/>
|
||||
* Requires a {@link Codec} to be registered: {@link ForgeRegistries#GLOBAL_LOOT_MODIFIER_SERIALIZERS}, and returned in {@link #codec()}
|
||||
* Individual instances of modifiers must be registered via json, see forge:loot_modifiers/global_loot_modifiers
|
||||
*/
|
||||
* /
|
||||
public interface IGlobalLootModifier {
|
||||
Codec<IGlobalLootModifier> DIRECT_CODEC = ExtraCodecs.lazyInitializedCodec(() -> ForgeRegistries.GLOBAL_LOOT_MODIFIER_SERIALIZERS.get().getCodec())
|
||||
.dispatch(IGlobalLootModifier::codec, Function.identity());
|
||||
@@ -74,12 +74,13 @@ public interface IGlobalLootModifier {
|
||||
* @param generatedLoot the list of ItemStacks that will be dropped, generated by loot tables
|
||||
* @param context the LootContext, identical to what is passed to loot tables
|
||||
* @return modified loot drops
|
||||
*/
|
||||
* /
|
||||
@NotNull
|
||||
ObjectArrayList<ItemStack> apply(ObjectArrayList<ItemStack> generatedLoot, LootContext context);
|
||||
|
||||
/**
|
||||
* Returns the registered codec for this modifier
|
||||
*/
|
||||
* /
|
||||
Codec<? extends IGlobalLootModifier> codec();
|
||||
}
|
||||
*/
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.loot;
|
||||
|
||||
/*
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.mojang.datafixers.Products;
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* A base implementation of a Global Loot Modifier for modders to extend.
|
||||
* Takes care of ILootCondition matching and comes with the base codec to extend.
|
||||
*/
|
||||
* /
|
||||
public abstract class LootModifier implements IGlobalLootModifier
|
||||
{
|
||||
protected final LootItemCondition[] conditions;
|
||||
@@ -35,7 +35,7 @@ public abstract class LootModifier implements IGlobalLootModifier
|
||||
* </p>
|
||||
* Otherwise can follow this with #and() to add more fields.
|
||||
* Examples: Forge Test Subclasses or {@link BendingTrunkPlacer#CODEC}
|
||||
*/
|
||||
* /
|
||||
protected static <T extends LootModifier> Products.P1<RecordCodecBuilder.Mu<T>, LootItemCondition[]> codecStart(RecordCodecBuilder.Instance<T> instance)
|
||||
{
|
||||
return instance.group(LOOT_CONDITIONS_CODEC.fieldOf("conditions").forGetter(lm -> lm.conditions));
|
||||
@@ -44,7 +44,7 @@ public abstract class LootModifier implements IGlobalLootModifier
|
||||
/**
|
||||
* Constructs a LootModifier.
|
||||
* @param conditionsIn the ILootConditions that need to be matched before the loot is modified.
|
||||
*/
|
||||
* /
|
||||
protected LootModifier(LootItemCondition[] conditionsIn)
|
||||
{
|
||||
this.conditions = conditionsIn;
|
||||
@@ -64,7 +64,8 @@ public abstract class LootModifier implements IGlobalLootModifier
|
||||
* @param generatedLoot the list of ItemStacks that will be dropped, generated by loot tables
|
||||
* @param context the LootContext, identical to what is passed to loot tables
|
||||
* @return modified loot drops
|
||||
*/
|
||||
* /
|
||||
@NotNull
|
||||
protected abstract ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context);
|
||||
}
|
||||
*/
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.loot;
|
||||
|
||||
/*
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -16,7 +16,6 @@ import java.util.*;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import net.minecraft.world.level.storage.loot.Deserializers;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -87,9 +86,10 @@ public class LootModifierManager extends SimpleJsonResourceReloadListener {
|
||||
|
||||
/**
|
||||
* An immutable collection of the registered loot modifiers in layered order.
|
||||
*/
|
||||
* /
|
||||
public Collection<IGlobalLootModifier> getAllLootMods() {
|
||||
return registeredLootModifiers.values();
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.loot;
|
||||
|
||||
/*
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
@@ -77,3 +77,4 @@ public class LootTableIdCondition implements LootItemCondition
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in new issue
Block a user