mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Redesign CreativeTab collection event to be a lot more straight forward. (#9198)
This commit is contained in:
1 parent
4cf5508e04
commit
ec3abdea14
41 files changed
+696
-512
No files matched your search
@@ -58,8 +58,7 @@ public class ExampleMod
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
// Register the item to a creative tab
|
||||
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS,
|
||||
EXAMPLE_BLOCK_ITEM.get()));
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event)
|
||||
@@ -69,6 +68,12 @@ public class ExampleMod
|
||||
LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT));
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(EXAMPLE_BLOCK_ITEM);
|
||||
}
|
||||
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(ServerStartingEvent event)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
public void m_258021_(FeatureFlagSet p_260125_, boolean p_259855_) {
|
||||
CreativeModeTab.ItemDisplayBuilder creativemodetab$itemdisplaybuilder = new CreativeModeTab.ItemDisplayBuilder(this, p_260125_);
|
||||
- this.f_256824_.m_257865_(p_260125_, creativemodetab$itemdisplaybuilder, p_259855_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCreativeModeTabBuildContents(this, this.f_256824_).m_257865_(p_260125_, creativemodetab$itemdisplaybuilder, p_259855_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCreativeModeTabBuildContents(this, this.f_256824_, p_260125_, creativemodetab$itemdisplaybuilder, p_259855_);
|
||||
this.f_243839_ = creativemodetab$itemdisplaybuilder.f_244363_;
|
||||
this.f_243841_ = creativemodetab$itemdisplaybuilder.f_244585_;
|
||||
this.m_257466_();
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.graph.ElementOrder;
|
||||
import com.google.common.graph.GraphBuilder;
|
||||
import com.google.common.graph.MutableGraph;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.mojang.blaze3d.shaders.FogShape;
|
||||
@@ -74,7 +70,6 @@ import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.locale.Language;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
@@ -94,9 +89,11 @@ import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ItemStackLinkedSet;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.GameType;
|
||||
@@ -144,7 +141,7 @@ import net.minecraftforge.client.textures.ForgeTextureMetadata;
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ItemStackMap;
|
||||
import net.minecraftforge.common.util.MutableHashedLinkedMap;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
@@ -153,8 +150,6 @@ import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.loading.toposort.CyclePresentException;
|
||||
import net.minecraftforge.fml.loading.toposort.TopologicalSort;
|
||||
import net.minecraftforge.network.NetworkConstants;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
@@ -176,7 +171,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -1189,106 +1183,26 @@ public class ForgeHooksClient
|
||||
return new ResourceLocation(loc.getNamespace(), normalised);
|
||||
}
|
||||
|
||||
public static CreativeModeTab.DisplayItemsGenerator onCreativeModeTabBuildContents(CreativeModeTab tab, CreativeModeTab.DisplayItemsGenerator originalGenerator) {
|
||||
Set<CreativeModeTabEvent.DisplayItemsAdapter> customGenerators = new HashSet<>();
|
||||
CreativeModeTabEvent.BuildContents event = ModLoader.get().postEventWithReturn(new net.minecraftforge.event.CreativeModeTabEvent.BuildContents(tab, customGenerators));
|
||||
|
||||
record ModificationEntry(CreativeModeTab.TabVisibility tabVisibility, ItemStack before, ItemStack after) {}
|
||||
|
||||
return (featureFlagSet, output, hasPermissions) -> {
|
||||
final Map<ItemStack, CreativeModeTab.TabVisibility> originalEntries = ItemStackMap.createTypeAndTagLinkedMap();
|
||||
final Map<ItemStack, ModificationEntry> entries = ItemStackMap.createTypeAndTagMap();
|
||||
|
||||
originalGenerator.accept(featureFlagSet, originalEntries::put, hasPermissions);
|
||||
customGenerators.forEach(generator -> generator.accept(featureFlagSet, (stack, visibility, before, after) -> {
|
||||
if (stack.getCount() != 1)
|
||||
throw new IllegalArgumentException("The stack count must be 1");
|
||||
|
||||
entries.put(stack, new ModificationEntry(visibility, before, after));
|
||||
}, hasPermissions));
|
||||
|
||||
// We switch to the stacks tag here, as we need to be able to compare and hash them for the graph!
|
||||
// We could not handle this with an open hashset since the builder does not support this internally.
|
||||
final MutableGraph<CompoundTag> graph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build();
|
||||
final Map<CompoundTag, ItemStack> tagToStack = Maps.newHashMap();
|
||||
|
||||
CompoundTag lastStackTag = null;
|
||||
for (ItemStack stack : originalEntries.keySet())
|
||||
{
|
||||
final CompoundTag tag = stack.serializeNBT();
|
||||
tagToStack.put(tag, stack);
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
graph.addNode(tag);
|
||||
}
|
||||
if (lastStackTag != null)
|
||||
{
|
||||
graph.putEdge(lastStackTag, tag);
|
||||
}
|
||||
lastStackTag = tag;
|
||||
public static void onCreativeModeTabBuildContents(CreativeModeTab tab, CreativeModeTab.DisplayItemsGenerator originalGenerator, FeatureFlagSet flags, CreativeModeTab.Output output, boolean hasPermisions)
|
||||
{
|
||||
final var entries = new MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility>(ItemStackLinkedSet.TYPE_AND_TAG,
|
||||
(key, left, right) -> {
|
||||
//throw new IllegalStateException("Accidentally adding the same item stack twice " + key.getDisplayName().getString() + " to a Creative Mode Tab: " + tab.getDisplayName().getString());
|
||||
// Vanilla adds enchanting books twice in both visibilities.
|
||||
// This is just code cleanliness for them. For us lets just increase the visibility and merge the entries.
|
||||
return CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS;
|
||||
}
|
||||
);
|
||||
|
||||
CompoundTag finalLastStackTag = lastStackTag;
|
||||
entries.forEach((stack, modificationEntry) -> {
|
||||
final CompoundTag tag = stack.serializeNBT();
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
graph.addNode(tag);
|
||||
tagToStack.put(tag, stack);
|
||||
}
|
||||
if (!modificationEntry.after.isEmpty())
|
||||
{
|
||||
final CompoundTag afterTag = modificationEntry.after.serializeNBT();
|
||||
graph.putEdge(afterTag, tag);
|
||||
tagToStack.put(afterTag, modificationEntry.after);
|
||||
}
|
||||
else if (finalLastStackTag != null)
|
||||
{
|
||||
// If the user does not specify an after, we assume it is the last stack and put it after that.
|
||||
graph.putEdge(finalLastStackTag, tag);
|
||||
}
|
||||
if (!modificationEntry.before.isEmpty())
|
||||
{
|
||||
final CompoundTag beforeTag = modificationEntry.before.serializeNBT();
|
||||
graph.putEdge(tag, beforeTag);
|
||||
tagToStack.put(beforeTag, modificationEntry.before);
|
||||
}
|
||||
});
|
||||
originalGenerator.accept(flags, (stack, vis) -> {
|
||||
if (stack.getCount() != 1)
|
||||
throw new IllegalArgumentException("The stack count must be 1");
|
||||
entries.put(stack, vis);
|
||||
}, hasPermisions);
|
||||
|
||||
try
|
||||
{
|
||||
List<CompoundTag> tierList = TopologicalSort.topologicalSort(graph, null);
|
||||
ModLoader.get().postEvent(new CreativeModeTabEvent.BuildContents(tab, flags, hasPermisions, entries));
|
||||
|
||||
// Now we unwind the tags again so that they are sorted neatly.
|
||||
for (CompoundTag tag : tierList)
|
||||
{
|
||||
final ItemStack stack = tagToStack.get(tag);
|
||||
if (originalEntries.containsKey(stack))
|
||||
{
|
||||
output.accept(stack, originalEntries.get(stack));
|
||||
}
|
||||
else if (entries.containsKey(stack))
|
||||
{
|
||||
output.accept(stack, entries.get(stack).tabVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CyclePresentException cyclePresentException)
|
||||
{
|
||||
LOGGER.error("Failed to inject custom items into creative mode tab {} due to a cycle in the dependency graph", tab, cyclePresentException);
|
||||
LOGGER.warn("Detected cycles:");
|
||||
for (Set<Object> cycle : cyclePresentException.getCycles())
|
||||
{
|
||||
graph.edges().forEach(edge -> {
|
||||
if (cycle.contains(edge.nodeU()) && cycle.contains(edge.nodeV()))
|
||||
{
|
||||
LOGGER.warn(" - {} -> {}", tagToStack.get(edge.nodeU()), tagToStack.get(edge.nodeV()));
|
||||
}
|
||||
});
|
||||
}
|
||||
LOGGER.error("Falling back to default!");
|
||||
originalGenerator.accept(featureFlagSet, output, hasPermissions);
|
||||
}
|
||||
};
|
||||
for (var entry : entries)
|
||||
output.accept(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import it.unimi.dsi.fastutil.Hash.Strategy;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap;
|
||||
|
||||
/**
|
||||
* A mutable linked map with a hashing strategy and a merge function.
|
||||
*
|
||||
* @param <K> the type of keys
|
||||
* @param <V> the type of mapped values
|
||||
*/
|
||||
public class MutableHashedLinkedMap<K, V> implements Iterable<Map.Entry<K, V>>
|
||||
{
|
||||
private final Strategy<? super K> strategy;
|
||||
private final Map<K, Entry> entries;
|
||||
private final MergeFunction<K, V> merge;
|
||||
private Entry head = null;
|
||||
private Entry last = null;
|
||||
|
||||
/**
|
||||
* Creates a mutable linked map with a default new-value-selecting merge function.
|
||||
*
|
||||
* @param strategy the hashing strategy
|
||||
*/
|
||||
public MutableHashedLinkedMap(Strategy<? super K> strategy)
|
||||
{
|
||||
this(strategy, (k, v1, v2) -> v2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a mutable linked map with a custom merge function.
|
||||
*
|
||||
* @param strategy the hashing strategy
|
||||
* @param merge the function used when merging an existing value and a new value
|
||||
*/
|
||||
public MutableHashedLinkedMap(Strategy<? super K> strategy, MergeFunction<K, V> merge)
|
||||
{
|
||||
this.strategy = strategy;
|
||||
this.entries = new Object2ObjectOpenCustomHashMap<>(strategy);
|
||||
this.merge = merge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the mapping with the specified key and value pair.
|
||||
*
|
||||
* <p>If there is a mapping already associated with this key, then the previous value and the specified (new) value
|
||||
* are merged according to this collection's merge function, and the position of the entry is not modified. If there
|
||||
* is no such mapping, then the key-value mapping is inserted at the end of this collection.</p>
|
||||
*
|
||||
* @param key key to be inserted
|
||||
* @param value (new) value to be associated with the key
|
||||
* @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key
|
||||
*/
|
||||
@Nullable
|
||||
public V put(K key, V value)
|
||||
{
|
||||
var old = entries.get(key);
|
||||
if (old != null)
|
||||
{
|
||||
V ret = old.value;
|
||||
old.value = merge.apply(key, ret, value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
var self = new Entry(key, value);
|
||||
|
||||
var l = last;
|
||||
self.previous = l;
|
||||
if (l == null)
|
||||
head = self;
|
||||
else
|
||||
l.next = self;
|
||||
last = self;
|
||||
|
||||
entries.put(key, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean contains(K key) { return this.entries.containsKey(key); }
|
||||
public boolean isEmpty() { return this.entries.isEmpty(); }
|
||||
|
||||
@Nullable
|
||||
public V remove(K key)
|
||||
{
|
||||
var ret = this.entries.remove(key);
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
remove(ret);
|
||||
return ret.getValue();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public V get(K key)
|
||||
{
|
||||
var entry = entries.get(key);
|
||||
return entry == null ? null : entry.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Map.Entry<K, V>> iterator()
|
||||
{
|
||||
return new Iterator<>()
|
||||
{
|
||||
private Entry current = head;
|
||||
@Override public boolean hasNext() { return current != null; }
|
||||
@Override
|
||||
public Map.Entry<K, V> next()
|
||||
{
|
||||
if (!hasNext())
|
||||
throw new NoSuchElementException();
|
||||
var ret = current;
|
||||
current = current.next;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the mapping with the specified key and value pair at the beginning of this map.
|
||||
*
|
||||
* <p>If there is a mapping already associated with this key, then the previous value and the specified (new) value
|
||||
* are first merged according to this map's merge function, then the entry is moved to the beginning of the map.</p>
|
||||
*
|
||||
* @param key key to be inserted at the beginning
|
||||
* @param value (new) value to be associated with the key
|
||||
* @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key
|
||||
*
|
||||
* @see #putBefore(Object, Object, Object)
|
||||
*/
|
||||
@Nullable
|
||||
public V putFirst(K key, V value)
|
||||
{
|
||||
if (head != null)
|
||||
return putBefore(head.getKey(), key, value);
|
||||
return put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the mapping with this key and value pair immediately after the entry with the specified positioning key.
|
||||
*
|
||||
* <p>If the specified positioning key is not present within this map, then this method behaves like
|
||||
* {@link #put(Object, Object)}. If there is a mapping already associated with this key, then the previous value
|
||||
* and the specified (new) value are first merged according to this map's merge function, then the entry is
|
||||
* moved to directly after the entry with the specified positioning key.</p>
|
||||
*
|
||||
* @param after the key to position this new entry afterwards
|
||||
* @param key key to be inserted at the beginning
|
||||
* @param value (new) value to be associated with the key
|
||||
* @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key
|
||||
*
|
||||
* @see #putBefore(Object, Object, Object)
|
||||
*/
|
||||
@Nullable
|
||||
public V putAfter(K after, K key, V value)
|
||||
{
|
||||
var target = entries.get(after);
|
||||
if (target == null)
|
||||
return put(key, value);
|
||||
|
||||
V ret = null;
|
||||
var entry = entries.get(key);
|
||||
if (entry != null)
|
||||
{
|
||||
ret = entry.value;
|
||||
entry.value = merge.apply(key, ret, value);
|
||||
remove(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = new Entry(key, value);
|
||||
entries.put(key, entry);
|
||||
}
|
||||
|
||||
entry.previous = target;
|
||||
if (target.next == null)
|
||||
last = target;
|
||||
else
|
||||
target.next.previous = entry;
|
||||
entry.next = target.next;
|
||||
|
||||
target.next = entry;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the mapping with this key and value pair immediately before the entry with the specified positioning key.
|
||||
*
|
||||
* <p>If the specified positioning key is not present within this map, then this method behaves like
|
||||
* {@link #put(Object, Object)}. If there is a mapping already associated with this key, then the previous value
|
||||
* and the specified (new) value are first merged according to this map's merge function, then the entry is
|
||||
* moved to directly before the entry with the specified positioning key.</p>
|
||||
*
|
||||
* @param before the key to position this new entry afterwards
|
||||
* @param key key to be inserted at the beginning
|
||||
* @param value (new) value to be associated with the key
|
||||
* @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key
|
||||
*
|
||||
* @see #putAfter(Object, Object, Object)
|
||||
*/
|
||||
@Nullable
|
||||
public V putBefore(K before, K key, V value)
|
||||
{
|
||||
var target = entries.get(before);
|
||||
if (target == null)
|
||||
return put(key, value);
|
||||
|
||||
V ret = null;
|
||||
var entry = entries.get(key);
|
||||
if (entry != null)
|
||||
{
|
||||
ret = entry.value;
|
||||
entry.value = merge.apply(key, ret, value);
|
||||
remove(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = new Entry(key, value);
|
||||
entries.put(key, entry);
|
||||
}
|
||||
|
||||
entry.previous = target.previous;
|
||||
if (target.previous == null)
|
||||
head = entry;
|
||||
else
|
||||
target.previous.next = entry;
|
||||
entry.next = target;
|
||||
|
||||
target.previous = entry;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void remove(Entry e)
|
||||
{
|
||||
if (head == null)
|
||||
head = e.next;
|
||||
else if (e.previous != null) // Should never be null, but just in case.
|
||||
{
|
||||
e.previous.next = e.next;
|
||||
e.previous = null;
|
||||
}
|
||||
|
||||
if (last == e)
|
||||
last = e.previous;
|
||||
else if (e.next != null) // Should never be null, but just in case.
|
||||
{
|
||||
e.next.previous = e.previous;
|
||||
e.next = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface MergeFunction<Key, Value>
|
||||
{
|
||||
Value apply(Key key, Value left, Value right);
|
||||
}
|
||||
|
||||
private class Entry implements Map.Entry<K, V>
|
||||
{
|
||||
private final K key;
|
||||
private V value;
|
||||
|
||||
private Entry previous;
|
||||
private Entry next;
|
||||
|
||||
private Entry(K key, V value)
|
||||
{
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override public K getKey() { return this.key; }
|
||||
@Override public V getValue() { return this.value; }
|
||||
@Override
|
||||
public V setValue(V value)
|
||||
{
|
||||
var old = this.value;
|
||||
this.value = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Entry[" + this.key + ", " + this.value + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (!(o instanceof Map.Entry))
|
||||
return false;
|
||||
|
||||
Map.Entry<?,?> e = (Map.Entry<?, ?>)o;
|
||||
return (key == null ? e.getKey() == null : key.equals(e.getKey())) &&
|
||||
(value == null ? e.getValue() == null : value.equals(e.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return (key == null ? 0 : strategy.hashCode(key)) ^
|
||||
(value == null ? 0 : value.hashCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,18 @@ package net.minecraftforge.event;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.CreativeModeTab.Output;
|
||||
import net.minecraft.world.item.CreativeModeTab.TabVisibility;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.CreativeModeTabRegistry;
|
||||
import net.minecraftforge.common.util.MutableHashedLinkedMap;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
@@ -106,58 +109,20 @@ public class CreativeModeTabEvent extends Event implements IModBusEvent
|
||||
* This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.
|
||||
*/
|
||||
public static final class BuildContents extends CreativeModeTabEvent
|
||||
public static final class BuildContents extends CreativeModeTabEvent implements Output
|
||||
{
|
||||
private final CreativeModeTab tab;
|
||||
private final Set<DisplayItemsAdapter> customGenerators;
|
||||
private final FeatureFlagSet flags;
|
||||
private final boolean hasPermissions;
|
||||
private final MutableHashedLinkedMap<ItemStack, TabVisibility> entries;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public BuildContents(CreativeModeTab tab, Set<DisplayItemsAdapter> customGenerators)
|
||||
public BuildContents(CreativeModeTab tab, FeatureFlagSet flags, boolean hasPermissions, MutableHashedLinkedMap<ItemStack, TabVisibility> entries)
|
||||
{
|
||||
this.tab = tab;
|
||||
this.customGenerators = customGenerators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given generator.
|
||||
*/
|
||||
public void register(DisplayItemsAdapter generator)
|
||||
{
|
||||
this.customGenerators.add(generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given generator if the provided creative mode tab matches this event's currently populating tab.
|
||||
*/
|
||||
public void register(CreativeModeTab tab, DisplayItemsAdapter generator)
|
||||
{
|
||||
if (this.tab == tab)
|
||||
this.customGenerators.add(generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given generator if the provided tab name matches this event's currently populating tab's name.
|
||||
*/
|
||||
public void register(ResourceLocation tabName, DisplayItemsAdapter generator)
|
||||
{
|
||||
if (this.tab == CreativeModeTabRegistry.getTab(tabName))
|
||||
this.customGenerators.add(generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given item if the provided creative mode tab matches this event's currently populating tab.
|
||||
*/
|
||||
public void registerSimple(CreativeModeTab tab, ItemLike item)
|
||||
{
|
||||
this.register(tab, (enabledFlags, output, permissions) -> output.accept(item));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given items if the provided creative mode tab matches this event's currently populating tab.
|
||||
*/
|
||||
public void registerSimple(CreativeModeTab tab, ItemLike... items)
|
||||
{
|
||||
this.register(tab, (enabledFlags, output, permissions) -> output.acceptAll(items));
|
||||
this.flags = flags;
|
||||
this.hasPermissions = hasPermissions;
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,70 +132,36 @@ public class CreativeModeTabEvent extends Event implements IModBusEvent
|
||||
{
|
||||
return this.tab;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface DisplayItemsAdapter
|
||||
{
|
||||
void accept(FeatureFlagSet enabledFlags, CreativeModeTabPopulator populator, boolean hasPermissions);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface CreativeModeTabPopulator
|
||||
{
|
||||
void accept(ItemStack stack, CreativeModeTab.TabVisibility visibility, ItemStack before, ItemStack after);
|
||||
|
||||
default void accept(ItemStack stack, ItemStack before, ItemStack after)
|
||||
public FeatureFlagSet getFlags()
|
||||
{
|
||||
accept(stack, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS, before, after);
|
||||
return this.flags;
|
||||
}
|
||||
|
||||
default void accept(ItemLike stack, CreativeModeTab.TabVisibility visibility, ItemStack before, ItemStack after)
|
||||
public boolean hasPermissions()
|
||||
{
|
||||
accept(new ItemStack(stack), visibility, before, after);
|
||||
return this.hasPermissions;
|
||||
}
|
||||
|
||||
default void accept(ItemLike stack, ItemStack before, ItemStack after)
|
||||
public MutableHashedLinkedMap<ItemStack, TabVisibility> getEntries()
|
||||
{
|
||||
accept(stack, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS, before, after);
|
||||
return this.entries;
|
||||
}
|
||||
|
||||
default void accept(ItemStack stack, CreativeModeTab.TabVisibility visibility)
|
||||
@Override
|
||||
public void accept(ItemStack stack, TabVisibility visibility)
|
||||
{
|
||||
accept(stack, visibility, ItemStack.EMPTY, ItemStack.EMPTY);
|
||||
getEntries().put(stack, visibility);
|
||||
}
|
||||
|
||||
default void accept(ItemStack stack)
|
||||
public void accept(Supplier<? extends ItemLike> item, CreativeModeTab.TabVisibility visibility)
|
||||
{
|
||||
this.accept(stack, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
|
||||
this.accept(item.get(), visibility);
|
||||
}
|
||||
|
||||
default void accept(ItemLike itemLike, CreativeModeTab.TabVisibility visibility)
|
||||
public void accept(Supplier<? extends ItemLike> item)
|
||||
{
|
||||
this.accept(new ItemStack(itemLike), visibility);
|
||||
}
|
||||
|
||||
default void accept(ItemLike itemLike)
|
||||
{
|
||||
this.accept(new ItemStack(itemLike), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
|
||||
}
|
||||
|
||||
default void acceptAll(Collection<ItemStack> stacks, CreativeModeTab.TabVisibility visibility)
|
||||
{
|
||||
stacks.forEach(stack -> this.accept(stack, visibility));
|
||||
}
|
||||
|
||||
default void acceptAll(Collection<ItemStack> stacks)
|
||||
{
|
||||
this.acceptAll(stacks, CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
|
||||
}
|
||||
|
||||
default void acceptAll(ItemLike... items)
|
||||
{
|
||||
for (ItemLike item : items)
|
||||
{
|
||||
this.accept(item);
|
||||
}
|
||||
this.accept(item.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,10 @@ import java.util.List;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.CreativeModeTab.TabVisibility;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
@@ -62,28 +64,28 @@ public class CreativeModeTabTest
|
||||
}));
|
||||
}
|
||||
|
||||
private static ItemStack i(ItemLike item) { return new ItemStack(item); }
|
||||
|
||||
private static void onCreativeModeTabBuildContents(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
var entries = event.getEntries();
|
||||
var vis = TabVisibility.PARENT_AND_SEARCH_TABS;
|
||||
if (event.getTab() == LOGS)
|
||||
{
|
||||
event.register((flags, builder, hasPermissions) -> {
|
||||
builder.accept(new ItemStack(Blocks.STRIPPED_ACACIA_LOG), ItemStack.EMPTY, new ItemStack(Blocks.ACACIA_LOG));
|
||||
builder.accept(new ItemStack(Blocks.STRIPPED_BIRCH_LOG), ItemStack.EMPTY, new ItemStack(Blocks.BIRCH_LOG));
|
||||
builder.accept(new ItemStack(Blocks.STRIPPED_DARK_OAK_LOG), ItemStack.EMPTY, new ItemStack(Blocks.DARK_OAK_LOG));
|
||||
builder.accept(new ItemStack(Blocks.STRIPPED_JUNGLE_LOG), ItemStack.EMPTY, new ItemStack(Blocks.JUNGLE_LOG));
|
||||
builder.accept(new ItemStack(Blocks.STRIPPED_OAK_LOG), ItemStack.EMPTY, new ItemStack(Blocks.OAK_LOG));
|
||||
builder.accept(new ItemStack(Blocks.STRIPPED_SPRUCE_LOG), ItemStack.EMPTY, new ItemStack(Blocks.SPRUCE_LOG));
|
||||
});
|
||||
entries.putAfter(i(Blocks.ACACIA_LOG), i(Blocks.STRIPPED_ACACIA_LOG), vis);
|
||||
entries.putAfter(i(Blocks.BIRCH_LOG), i(Blocks.STRIPPED_BIRCH_LOG), vis);
|
||||
entries.putAfter(i(Blocks.DARK_OAK_LOG), i(Blocks.STRIPPED_DARK_OAK_LOG), vis);
|
||||
entries.putAfter(i(Blocks.JUNGLE_LOG), i(Blocks.STRIPPED_JUNGLE_LOG), vis);
|
||||
entries.putAfter(i(Blocks.OAK_LOG), i(Blocks.STRIPPED_OAK_LOG), vis);
|
||||
entries.putAfter(i(Blocks.SPRUCE_LOG), i(Blocks.STRIPPED_SPRUCE_LOG), vis);
|
||||
}
|
||||
|
||||
if (event.getTab() == STONE)
|
||||
{
|
||||
event.register((flags, builder, hasPermissions) -> {
|
||||
builder.accept(new ItemStack(Blocks.SMOOTH_STONE), new ItemStack(Blocks.GRANITE), new ItemStack(Blocks.STONE));
|
||||
builder.accept(new ItemStack(Blocks.POLISHED_GRANITE), new ItemStack(Blocks.DIORITE), new ItemStack(Blocks.GRANITE));
|
||||
builder.accept(new ItemStack(Blocks.POLISHED_DIORITE), new ItemStack(Blocks.ANDESITE), new ItemStack(Blocks.DIORITE));
|
||||
builder.accept(new ItemStack(Blocks.POLISHED_ANDESITE), ItemStack.EMPTY, new ItemStack(Blocks.ANDESITE));
|
||||
});
|
||||
entries.putBefore(i(Blocks.STONE), i(Blocks.SMOOTH_STONE), vis);
|
||||
entries.putBefore(i(Blocks.GRANITE), i(Blocks.POLISHED_GRANITE), vis);
|
||||
entries.putBefore(i(Blocks.DIORITE), i(Blocks.POLISHED_DIORITE), vis);
|
||||
entries.putBefore(i(Blocks.ANDESITE), i(Blocks.POLISHED_ANDESITE), vis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(CustomSoundTypeTest.MODID)
|
||||
public class CustomSoundTypeTest
|
||||
{
|
||||
@@ -51,7 +48,12 @@ public class CustomSoundTypeTest
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
SOUND_EVENTS.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.INGREDIENTS, TEST_STEP_BLOCK_ITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(TEST_STEP_BLOCK_ITEM);
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,13 @@ public class DeferredRegistryTest {
|
||||
modBus.addListener(this::gatherData);
|
||||
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.INGREDIENTS, ITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(ITEM);
|
||||
}
|
||||
|
||||
public void serverStarted(ServerStartedEvent event)
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod("be_onload_test")
|
||||
public class BlockEntityOnLoadTest
|
||||
@@ -54,11 +53,16 @@ public class BlockEntityOnLoadTest
|
||||
BLOCKS.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
BE_TYPES.register(modBus);
|
||||
|
||||
modBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, TEST_BLOCK_ITEM.get()));
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(TEST_BLOCK_ITEM);
|
||||
}
|
||||
|
||||
private static class TestBlock extends Block implements EntityBlock
|
||||
{
|
||||
public TestBlock(Properties props) { super(props); }
|
||||
|
||||
@@ -35,8 +35,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Adds a blaze head block and item to test the event for registering a custom skull model and to demonstrate the proper way to register a custom mob skull.
|
||||
*
|
||||
@@ -61,8 +59,13 @@ public class CustomHeadTest
|
||||
BLOCKS.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
BLOCK_ENTITIES.register(modBus);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, BLAZE_HEAD_ITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(BLAZE_HEAD_ITEM);
|
||||
}
|
||||
|
||||
private static class CustomSkullBlock extends SkullBlock
|
||||
|
||||
@@ -35,8 +35,6 @@ import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(CustomSignsTest.MODID)
|
||||
public class CustomSignsTest
|
||||
{
|
||||
@@ -66,11 +64,16 @@ public class CustomSignsTest
|
||||
|
||||
eventBus.addListener(this::clientSetup);
|
||||
eventBus.addListener(this::commonSetup);
|
||||
|
||||
eventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, TEST_SIGN.get()));
|
||||
eventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(TEST_SIGN);
|
||||
}
|
||||
|
||||
private void clientSetup(final FMLClientSetupEvent event)
|
||||
{
|
||||
BlockEntityRenderers.register(CUSTOM_SIGN.get(), SignRenderer::new);
|
||||
|
||||
@@ -56,7 +56,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -88,11 +87,16 @@ public class FullPotsAccessorDemo
|
||||
BLOCKS.register(bus);
|
||||
ITEMS.register(bus);
|
||||
BLOCK_ENTITIES.register(bus);
|
||||
|
||||
bus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.INGREDIENTS, DIORITE_POT_ITEM.get()));
|
||||
bus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(DIORITE_POT_ITEM);
|
||||
}
|
||||
|
||||
private static class DioriteFlowerPotBlock extends Block implements EntityBlock
|
||||
{
|
||||
private static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
|
||||
|
||||
@@ -7,8 +7,6 @@ package net.minecraftforge.debug.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -66,8 +64,13 @@ public class PistonEventTest
|
||||
BLOCKS.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::gatherData);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, SHIFT_ON_MOVE_ITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(SHIFT_ON_MOVE_ITEM);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -25,8 +25,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(RedstoneSidedConnectivityTest.MODID)
|
||||
public class RedstoneSidedConnectivityTest
|
||||
{
|
||||
@@ -48,8 +46,13 @@ public class RedstoneSidedConnectivityTest
|
||||
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
BLOCKS.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, TEST_REDSTONE_BLOCKITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(TEST_REDSTONE_BLOCKITEM);
|
||||
}
|
||||
|
||||
private static class EastRedstoneBlock extends Block
|
||||
|
||||
@@ -19,8 +19,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Test mod that demos disabling ambient occlusion on specific faces of "elements" models.
|
||||
*/
|
||||
@@ -50,8 +48,17 @@ public class AmbientOcclusionElementsTest
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS,
|
||||
AO_BLOCK_SHADE_ITEM.get(), AO_BLOCK_NO_SHADE_ITEM.get(), NO_AO_BLOCK_SHADE_ITEM.get(), NO_AO_BLOCK_NO_SHADE_ITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
{
|
||||
event.accept(AO_BLOCK_SHADE_ITEM);
|
||||
event.accept(AO_BLOCK_NO_SHADE_ITEM);
|
||||
event.accept(NO_AO_BLOCK_SHADE_ITEM);
|
||||
event.accept(NO_AO_BLOCK_NO_SHADE_ITEM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,17 @@ public class CustomArmorModelTest
|
||||
{
|
||||
final IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.INGREDIENTS,
|
||||
RED_LEGGINGS.get(), ENDERMAN_CHESTPLATE.get(), ENDERMAN_BOOTS.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
{
|
||||
event.accept(RED_LEGGINGS);
|
||||
event.accept(ENDERMAN_CHESTPLATE);
|
||||
event.accept(ENDERMAN_BOOTS);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TintedArmorItem extends ArmorItem
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(CustomTooltipTest.ID)
|
||||
public class CustomTooltipTest
|
||||
@@ -65,10 +64,16 @@ public class CustomTooltipTest
|
||||
modEventBus.register(ClientModBusEventHandler.class);
|
||||
}
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.INGREDIENTS, CUSTOM_ITEM.get()));
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(CUSTOM_ITEM);
|
||||
}
|
||||
|
||||
static record CustomTooltip(int color) implements TooltipComponent
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,7 +37,12 @@ public class EmissiveElementsTest
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS, TEST_BLOCK_ITEM.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(TEST_BLOCK_ITEM);
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(CompositeModelTest.MODID)
|
||||
public class CompositeModelTest
|
||||
{
|
||||
@@ -87,7 +85,12 @@ public class CompositeModelTest
|
||||
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.INGREDIENTS, composite_item.get()));
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(composite_item);
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,6 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/*
|
||||
* Test mod for the custom transform types feature.
|
||||
* This test mod adds an item that should be held in the main hand, while another item is in the offhand.
|
||||
@@ -129,13 +127,13 @@ public class CustomTransformTypeTest
|
||||
BLOCKS.register(modBus);
|
||||
BLOCK_ENTITY_TYPES.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(ITEM_HANGER_ITEM.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(ITEM_HANGER_ITEM);
|
||||
}
|
||||
|
||||
public void gatherData(GatherDataEvent event)
|
||||
|
||||
@@ -15,8 +15,6 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(DynBucketModelTest.MODID)
|
||||
public class DynBucketModelTest
|
||||
{
|
||||
@@ -33,14 +31,16 @@ public class DynBucketModelTest
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modEventBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(DRIP_BUCKET.get());
|
||||
output.accept(LAVA_OBSIDIAN.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
{
|
||||
event.accept(DRIP_BUCKET);
|
||||
event.accept(LAVA_OBSIDIAN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,12 +88,13 @@ public class MegaModelTest
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
BLOCK_ENTITIES.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.BUILDING_BLOCKS) {
|
||||
onBuildContents.register((p_259204_, p_259752_, p_260123_) -> p_259752_.accept(TEST_BLOCK_ITEM.get()));
|
||||
}
|
||||
});
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(TEST_BLOCK_ITEM);
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
|
||||
@@ -12,17 +12,14 @@ import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
@Mod(MultiLayerModelTest.MODID)
|
||||
public class MultiLayerModelTest
|
||||
@@ -32,44 +29,34 @@ public class MultiLayerModelTest
|
||||
public static final String VERSION = "0.0";
|
||||
|
||||
private static final String blockName = "test_layer_block";
|
||||
private static final ResourceLocation blockId = new ResourceLocation(MODID, blockName);
|
||||
@ObjectHolder(registryName = "block", value = blockName)
|
||||
public static final Block TEST_BLOCK = null;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public static class Registration
|
||||
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
|
||||
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||
private static final RegistryObject<Block> TEST_BLOCK = BLOCKS.register(blockName, () -> new Block(Block.Properties.of(Material.WOOD).noOcclusion()));
|
||||
private static final RegistryObject<Item> TEST_BLOCK_ITEM = ITEMS.register(blockName, () -> new BlockItem(TEST_BLOCK.get(), new Item.Properties()));
|
||||
|
||||
public MultiLayerModelTest()
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegisterEvent event)
|
||||
{
|
||||
if (!ENABLED || !event.getRegistryKey().equals(ForgeRegistries.Keys.BLOCKS))
|
||||
return;
|
||||
event.register(ForgeRegistries.Keys.BLOCKS, blockId, () -> new Block(Block.Properties.of(Material.WOOD).noOcclusion()));
|
||||
}
|
||||
if (!ENABLED)
|
||||
return;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegisterEvent event)
|
||||
{
|
||||
if (!ENABLED || !event.getRegistryKey().equals(ForgeRegistries.Keys.ITEMS))
|
||||
return;
|
||||
event.register(ForgeRegistries.Keys.ITEMS, blockId, () -> new BlockItem(TEST_BLOCK, new Item.Properties()));
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(TEST_BLOCK.asItem());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void clientSetup(FMLClientSetupEvent event)
|
||||
{
|
||||
if (!ENABLED)
|
||||
return;
|
||||
ItemBlockRenderTypes.setRenderLayer(TEST_BLOCK, (layer) -> {
|
||||
return layer == RenderType.solid() || layer == RenderType.translucent();
|
||||
});
|
||||
}
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(TEST_BLOCK);
|
||||
}
|
||||
|
||||
private void clientSetup(FMLClientSetupEvent event)
|
||||
{
|
||||
ItemBlockRenderTypes.setRenderLayer(TEST_BLOCK.get(), (layer) -> {
|
||||
return layer == RenderType.solid() || layer == RenderType.translucent();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ package net.minecraftforge.debug.client.model;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.ModelBaker;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -48,7 +47,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
@@ -127,20 +126,22 @@ public class NewModelLoaderTest
|
||||
|
||||
modEventBus.addListener(this::modelRegistry);
|
||||
modEventBus.addListener(this::datagen);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(obj_item.get());
|
||||
output.accept(custom_transforms.get());
|
||||
output.accept(custom_vanilla_loader.get());
|
||||
output.accept(custom_loader.get());
|
||||
output.accept(item_layers.get());
|
||||
output.accept(separate_perspective.get());
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
{
|
||||
Arrays.asList(
|
||||
obj_item,
|
||||
custom_transforms,
|
||||
custom_vanilla_loader,
|
||||
custom_loader,
|
||||
item_layers,
|
||||
separate_perspective
|
||||
).forEach(event::accept);
|
||||
}
|
||||
}
|
||||
|
||||
public void modelRegistry(ModelEvent.RegisterGeometryLoaders event)
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
package net.minecraftforge.debug.client.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
@@ -56,12 +54,13 @@ public class TRSRTransformerTest {
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> mod.addListener(this::onModelBake));
|
||||
BLOCKS.register(mod);
|
||||
ITEMS.register(mod);
|
||||
mod.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.BUILDING_BLOCKS) {
|
||||
onBuildContents.register((p_259204_, p_259752_, p_260123_) -> p_259752_.accept(TEST_ITEM.get()));
|
||||
}
|
||||
});
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(TEST_ITEM);
|
||||
}
|
||||
|
||||
public void onModelBake(ModelEvent.BakingCompleted e) {
|
||||
|
||||
@@ -8,19 +8,19 @@ package net.minecraftforge.debug.entity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -39,20 +39,24 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
import net.minecraft.world.item.Item.Properties;
|
||||
|
||||
@Mod("gravity_attribute_test")
|
||||
@Mod(GravityAttributeTest.MODID)
|
||||
public class GravityAttributeTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
private static Logger logger = LogManager.getLogger();
|
||||
public static final String MODID = "gravity_attribute_test";
|
||||
private static Logger logger = LogManager.getLogger(MODID);
|
||||
private int ticks;
|
||||
private static final UUID REDUCED_GRAVITY_ID = UUID.fromString("DEB06000-7979-4242-8888-00000DEB0600");
|
||||
private static final AttributeModifier REDUCED_GRAVITY = (new AttributeModifier(REDUCED_GRAVITY_ID, "Reduced gravity", (double)-0.80, Operation.MULTIPLY_TOTAL));
|
||||
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||
private static final RegistryObject<Item> TEST_ITEM = ITEMS.register("gravity_stick", () -> new ItemGravityStick(new Properties().rarity(Rarity.RARE)));
|
||||
|
||||
|
||||
public GravityAttributeTest()
|
||||
@@ -60,7 +64,10 @@ public class GravityAttributeTest
|
||||
if (ENABLE)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().register(this);
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
modEventBus.register(this);
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,19 +122,10 @@ public class GravityAttributeTest
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerItems(RegisterEvent event)
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
event.register(ForgeRegistries.Keys.ITEMS, helper -> helper.register("gravity_stick",
|
||||
new ItemGravityStick(new Properties().rarity(Rarity.RARE))));
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(ForgeRegistries.ITEMS.getValue(new ResourceLocation("gravity_attribute_test", "gravity_stick")));
|
||||
});
|
||||
}
|
||||
});
|
||||
if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES)
|
||||
event.accept(TEST_ITEM);
|
||||
}
|
||||
|
||||
public static class ItemGravityStick extends Item
|
||||
|
||||
@@ -41,14 +41,15 @@ public class ItemUseAnimationTest
|
||||
|
||||
public ItemUseAnimationTest()
|
||||
{
|
||||
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.COMBAT) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(THING.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
var modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.COMBAT)
|
||||
event.accept(THING);
|
||||
}
|
||||
|
||||
private static class ThingItem extends Item
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Tests if the patch to PlayerEntity to make it utilize Attributes.ATTACK_KNOCKBACK works
|
||||
@@ -46,13 +45,13 @@ public class PlayerAttackKnockbackTest {
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modEventBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.COMBAT) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(KNOCKBACK_SWORD.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.COMBAT)
|
||||
event.accept(KNOCKBACK_SWORD);
|
||||
}
|
||||
|
||||
static class KnockbackSwordItem extends SwordItem {
|
||||
|
||||
@@ -173,22 +173,18 @@ public class FluidTypeTest
|
||||
ITEMS.register(modEventBus);
|
||||
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> new FluidTypeTestClient(modEventBus));
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(new Consumer<CreativeModeTabEvent.BuildContents>() {
|
||||
@Override
|
||||
public void accept(CreativeModeTabEvent.BuildContents onBuildContents) {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permission) -> {
|
||||
output.accept(new ItemStack(TEST_FLUID_BUCKET.get()));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(TEST_FLUID_BUCKET);
|
||||
}
|
||||
|
||||
private void commonSetup(FMLCommonSetupEvent event)
|
||||
{
|
||||
// Add Interactions for sources
|
||||
@@ -218,7 +214,7 @@ public class FluidTypeTest
|
||||
|
||||
private void registerBlockColors(RegisterColorHandlersEvent.Block event)
|
||||
{
|
||||
event.getBlockColors().register((state, getter, pos, index) ->
|
||||
event.register((state, getter, pos, index) ->
|
||||
{
|
||||
if (getter != null && pos != null)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ public class NewFluidTest
|
||||
private static ForgeFlowingFluid.Properties makeProperties()
|
||||
{
|
||||
return new ForgeFlowingFluid.Properties(test_fluid_type, test_fluid, test_fluid_flowing)
|
||||
.bucket(test_fluid_bucket).block(test_fluid_block);
|
||||
.bucket(TEST_FLUID_BUCKET).block(test_fluid_block);
|
||||
}
|
||||
|
||||
public static RegistryObject<FluidType> test_fluid_type = FLUID_TYPES.register("test_fluid", () -> new FluidType(FluidType.Properties.create())
|
||||
@@ -111,7 +111,7 @@ public class NewFluidTest
|
||||
public static RegistryObject<LiquidBlock> test_fluid_block = BLOCKS.register("test_fluid_block", () ->
|
||||
new LiquidBlock(test_fluid, Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable())
|
||||
);
|
||||
public static RegistryObject<Item> test_fluid_bucket = ITEMS.register("test_fluid_bucket", () ->
|
||||
public static RegistryObject<Item> TEST_FLUID_BUCKET = ITEMS.register("test_fluid_bucket", () ->
|
||||
new BucketItem(test_fluid, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))
|
||||
);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class NewFluidTest
|
||||
public static RegistryObject<Block> fluidloggable_block = BLOCKS.register("fluidloggable_block", () ->
|
||||
new FluidloggableBlock(Properties.of(Material.WOOD).noCollission().strength(100.0F).noLootTable())
|
||||
);
|
||||
public static RegistryObject<Item> fluidloggable_blockitem = ITEMS.register("fluidloggable_block", () ->
|
||||
public static RegistryObject<Item> FLUID_LOGGABLE_BLOCK_ITEM = ITEMS.register("fluidloggable_block", () ->
|
||||
new BlockItem(fluidloggable_block.get(), new Item.Properties())
|
||||
);
|
||||
|
||||
@@ -135,15 +135,16 @@ public class NewFluidTest
|
||||
ITEMS.register(modEventBus);
|
||||
FLUID_TYPES.register(modEventBus);
|
||||
FLUIDS.register(modEventBus);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(fluidloggable_blockitem.get());
|
||||
output.accept(test_fluid_bucket.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
{
|
||||
event.accept(FLUID_LOGGABLE_BLOCK_ITEM);
|
||||
event.accept(TEST_FLUID_BUCKET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ public class NewFluidTest
|
||||
Validate.isTrue(state.getBlock() == Blocks.WATER && state2 == state);
|
||||
ItemStack stack = Fluids.WATER.getFluidType().getBucket(new FluidStack(Fluids.WATER, 1));
|
||||
Validate.isTrue(stack.getItem() == Fluids.WATER.getBucket());
|
||||
event.enqueueWork(() -> DispenserBlock.registerBehavior(test_fluid_bucket.get(), DispenseFluidContainer.getInstance()));
|
||||
event.enqueueWork(() -> DispenserBlock.registerBehavior(TEST_FLUID_BUCKET.get(), DispenseFluidContainer.getInstance()));
|
||||
}
|
||||
|
||||
// WARNING: this doesn't allow "any fluid", only the fluid from this test mod!
|
||||
@@ -198,7 +199,7 @@ public class NewFluidTest
|
||||
public ItemStack pickupBlock(LevelAccessor worldIn, BlockPos pos, BlockState state) {
|
||||
if (state.getValue(FLUIDLOGGED)) {
|
||||
worldIn.setBlock(pos, state.setValue(FLUIDLOGGED, false), 3);
|
||||
return new ItemStack(test_fluid_bucket.get());
|
||||
return new ItemStack(TEST_FLUID_BUCKET.get());
|
||||
} else {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ import net.minecraft.world.item.Item.Properties;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(CustomElytraTest.MOD_ID)
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = CustomElytraTest.MOD_ID)
|
||||
public class CustomElytraTest
|
||||
@@ -48,13 +46,13 @@ public class CustomElytraTest
|
||||
final IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::onClientSetup);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(TEST_ELYTRA.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(TEST_ELYTRA);
|
||||
}
|
||||
|
||||
private void onClientSetup(FMLClientSetupEvent event)
|
||||
|
||||
@@ -19,8 +19,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(CustomMobBucketTest.MODID)
|
||||
public class CustomMobBucketTest
|
||||
{
|
||||
@@ -41,13 +39,13 @@ public class CustomMobBucketTest
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modEventBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(COW_BUCKET.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(COW_BUCKET);
|
||||
}
|
||||
}
|
||||
@@ -31,14 +31,15 @@ public class CustomShieldTest
|
||||
|
||||
public CustomShieldTest()
|
||||
{
|
||||
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.COMBAT) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(CUSTOM_SHIELD_ITEM.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
var modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.COMBAT)
|
||||
event.accept(CUSTOM_SHIELD_ITEM);
|
||||
}
|
||||
|
||||
private static class CustomShieldItem extends Item
|
||||
|
||||
@@ -17,15 +17,13 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(EnderMaskTest.MODID)
|
||||
public class EnderMaskTest
|
||||
{
|
||||
public static final String MODID = "ender_mask_test";
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||
|
||||
public static RegistryObject<Item> ender_mask = ITEMS.register("ender_mask", () ->
|
||||
public static RegistryObject<Item> ENDER_MASK = ITEMS.register("ender_mask", () ->
|
||||
new ArmorItem(ArmorMaterials.LEATHER, EquipmentSlot.HEAD, (new Item.Properties()))
|
||||
{
|
||||
@Override
|
||||
@@ -40,12 +38,12 @@ public class EnderMaskTest
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modEventBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(ender_mask.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(ENDER_MASK);
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,6 @@
|
||||
package net.minecraftforge.debug.item;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.client.renderer.entity.PigRenderer;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
@@ -51,20 +49,20 @@ public class ForgeSpawnEggItemTest
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().register(this);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(EGG.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
var eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(eventBus);
|
||||
ENTITIES.register(eventBus);
|
||||
eventBus.register(this);
|
||||
eventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(EGG);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRegisterAttributes(final EntityAttributeCreationEvent event)
|
||||
{
|
||||
|
||||
@@ -23,8 +23,6 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(HiddenTooltipPartsTest.MOD_ID)
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, modid = HiddenTooltipPartsTest.MOD_ID)
|
||||
public class HiddenTooltipPartsTest
|
||||
@@ -37,14 +35,15 @@ public class HiddenTooltipPartsTest
|
||||
|
||||
public HiddenTooltipPartsTest()
|
||||
{
|
||||
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(TEST_ITEM.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
var modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modBus);
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(TEST_ITEM);
|
||||
}
|
||||
|
||||
static class TestItem extends Item
|
||||
|
||||
@@ -17,8 +17,6 @@ import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(RangedMobsUseModdedWeaponsTest.MOD_ID)
|
||||
public class RangedMobsUseModdedWeaponsTest {
|
||||
|
||||
@@ -45,14 +43,16 @@ public class RangedMobsUseModdedWeaponsTest {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::onClientSetup);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.COMBAT) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(MODDED_BOW.get());
|
||||
output.accept(MODDED_CROSSBOW.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.COMBAT)
|
||||
{
|
||||
event.accept(MODDED_BOW);
|
||||
event.accept(MODDED_CROSSBOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,13 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mod(SnowBootsTest.MODID)
|
||||
public class SnowBootsTest
|
||||
{
|
||||
public static final String MODID = "snow_boots_test";
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||
|
||||
public static RegistryObject<Item> snow_boots = ITEMS.register("snow_boots", () ->
|
||||
public static RegistryObject<Item> SNOW_BOOTS = ITEMS.register("snow_boots", () ->
|
||||
new ArmorItem(ArmorMaterials.DIAMOND, EquipmentSlot.FEET, (new Item.Properties()))
|
||||
{
|
||||
@Override
|
||||
@@ -38,12 +36,12 @@ public class SnowBootsTest
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ITEMS.register(modEventBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.COMBAT) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(snow_boots.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.COMBAT)
|
||||
event.accept(SNOW_BOOTS);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,6 @@ import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -97,22 +96,15 @@ public class TagBasedToolTypesTest
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
modEventBus.addListener(this::gatherData);
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(new Consumer<CreativeModeTabEvent.BuildContents>() {
|
||||
@Override
|
||||
public void accept(CreativeModeTabEvent.BuildContents onBuildContents) {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
|
||||
onBuildContents.register((flags, output, permission) -> {
|
||||
output.accept(TOOL.get());
|
||||
});
|
||||
} else if (onBuildContents.getTab() == CreativeModeTabs.BUILDING_BLOCKS) {
|
||||
onBuildContents.register((flags, output, permission) -> {
|
||||
output.accept(ORE_ITEM.get());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES)
|
||||
event.accept(TOOL);
|
||||
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
|
||||
event.accept(ORE_ITEM);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -70,17 +70,16 @@ public class GameTestTest
|
||||
BLOCKS.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
BLOCK_ENTITIES.register(modBus);
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(ENERGY_BLOCK_ITEM.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modBus.addListener(this::addCreative);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(ENERGY_BLOCK_ITEM);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRegisterGameTests(RegisterGameTestsEvent event)
|
||||
{
|
||||
|
||||
@@ -9,8 +9,6 @@ import com.mojang.datafixers.util.Pair;
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -51,13 +49,13 @@ public class ForgeChunkManagerTest
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
BLOCKS.register(modEventBus);
|
||||
ITEMS.register(modEventBus);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener((Consumer<CreativeModeTabEvent.BuildContents>) onBuildContents -> {
|
||||
if (onBuildContents.getTab() == CreativeModeTabs.INGREDIENTS) {
|
||||
onBuildContents.register((flags, output, permissions) -> {
|
||||
output.accept(CHUNK_LOADER_ITEM.get());
|
||||
});
|
||||
}
|
||||
});
|
||||
modEventBus.addListener(this::addCreative);
|
||||
}
|
||||
|
||||
private void addCreative(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if (event.getTab() == CreativeModeTabs.INGREDIENTS)
|
||||
event.accept(CHUNK_LOADER_ITEM);
|
||||
}
|
||||
|
||||
private void commonSetup(FMLCommonSetupEvent event)
|
||||
|
||||
Reference in new issue
Block a user