aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-03-05 18:44:04 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-03-06 05:22:00 +0200
commitbb9dcef4b53d201cf4bcac3bf88d2042a1ce226c (patch)
treeda5b4cd93e1514dea69495826b2a187cb7c0b946 /src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
parent09792f49ee89c6b4ff37464acec4b94b3f9f370b (diff)
downloadCITResewn-bb9dcef4b53d201cf4bcac3bf88d2042a1ce226c.tar.gz
CITResewn-bb9dcef4b53d201cf4bcac3bf88d2042a1ce226c.tar.bz2
CITResewn-bb9dcef4b53d201cf4bcac3bf88d2042a1ce226c.zip
Documentation (29/44, 0/35)
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
index c5f1922..cfc10f8 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
@@ -11,23 +11,47 @@ import net.minecraft.nbt.NbtElement;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
+import javax.annotation.Nullable;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
+/**
+ * Holds momentary information to be used for CITs' condition matching and type effects.
+ */
public class CITContext {
+ /**
+ * The main item stack to check for the CIT.
+ */
public final ItemStack stack;
+
+ /**
+ * The item's containing world(defaults to {@link MinecraftClient#world} if null)
+ */
public final World world;
+
+ /**
+ * The item's associated living entity if present. (null if not relevant)
+ */
+ @Nullable
public final LivingEntity entity;
+ /**
+ * Cached enchantment map from {@link #stack}.
+ * @see #enchantments()
+ */
private Map<Identifier, Integer> enchantments = null;
- public CITContext(ItemStack stack, World world, LivingEntity entity) {
+ public CITContext(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity) {
this.stack = stack;
this.world = world == null ? MinecraftClient.getInstance().world : world;
this.entity = entity;
}
+ /**
+ * @see #enchantments
+ * @return a map of this context item's enchantments
+ */
public Map<Identifier, Integer> enchantments() {
if (this.enchantments == null) {
this.enchantments = new LinkedHashMap<>();