Port to 1.18.2 (#2824)
* Port to 1.18.2-pre1 * 1.18.2-pre3 * Fix build. * Fixes and cleanup * Build fix? * Update REI
This commit is contained in:
parent
4465ffa1aa
commit
f7d5139332
34 changed files with 406 additions and 393 deletions
8
.github/workflows/check.yml
vendored
8
.github/workflows/check.yml
vendored
|
@ -2,14 +2,18 @@ name: Check
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java: [ 17-jdk, 18-jdk ]
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
container:
|
container:
|
||||||
image: eclipse-temurin:17-jdk
|
image: openjdk:${{ matrix.java }}
|
||||||
options: --user root
|
options: --user root
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
- uses: gradle/wrapper-validation-action@v1
|
||||||
- run: ./gradlew build --stacktrace
|
- run: ./gradlew runDatagen --stacktrace
|
||||||
|
- run: ./gradlew build --stacktrace -x runDatagen
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -28,7 +28,7 @@ jobs:
|
||||||
workflow_id: release.yml
|
workflow_id: release.yml
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
- uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
- run: ./gradlew checkVersion build publish curseforge github --stacktrace
|
- run: ./gradlew checkVersion build publish curseforge github --stacktrace -x test
|
||||||
env:
|
env:
|
||||||
RELEASE_CHANNEL: ${{ github.event.inputs.channel }}
|
RELEASE_CHANNEL: ${{ github.event.inputs.channel }}
|
||||||
MAVEN_URL: ${{ secrets.MAVEN_URL }}
|
MAVEN_URL: ${{ secrets.MAVEN_URL }}
|
||||||
|
|
|
@ -378,9 +378,9 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose() {
|
public void close() {
|
||||||
closeSelectedTab();
|
closeSelectedTab();
|
||||||
super.onClose();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -30,10 +30,14 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.recipe.ShapedRecipe;
|
import net.minecraft.recipe.ShapedRecipe;
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.Tag;
|
||||||
|
import net.minecraft.tag.TagKey;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryEntry;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
public class ShapedRecipeHelper {
|
public class ShapedRecipeHelper {
|
||||||
public static JsonObject rewriteForNetworkSync(JsonObject shapedRecipeJson) {
|
public static JsonObject rewriteForNetworkSync(JsonObject shapedRecipeJson) {
|
||||||
|
@ -49,8 +53,12 @@ public class ShapedRecipeHelper {
|
||||||
if (ingredientEntry instanceof Ingredient.StackEntry stackEntry) {
|
if (ingredientEntry instanceof Ingredient.StackEntry stackEntry) {
|
||||||
entries.add(stackEntry.toJson());
|
entries.add(stackEntry.toJson());
|
||||||
} else if (ingredientEntry instanceof Ingredient.TagEntry tagEntry) {
|
} else if (ingredientEntry instanceof Ingredient.TagEntry tagEntry) {
|
||||||
final Tag<Item> tag = tagEntry.tag;
|
final TagKey<Item> tag = tagEntry.tag;
|
||||||
final Item[] items = tag.values().toArray(new Item[0]);
|
final Item[] items = streamItemsFromTag(tag).toArray(Item[]::new);
|
||||||
|
|
||||||
|
if (items.length == 0) {
|
||||||
|
throw new IllegalStateException("No items in %s tag".formatted(tag.id()));
|
||||||
|
}
|
||||||
|
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
@ -62,6 +70,10 @@ public class ShapedRecipeHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entries.size() == 0) {
|
||||||
|
throw new IllegalStateException("Cannot write no entries");
|
||||||
|
}
|
||||||
|
|
||||||
keys.add(entry.getKey(), entries);
|
keys.add(entry.getKey(), entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,4 +81,9 @@ public class ShapedRecipeHelper {
|
||||||
shapedRecipeJson.add("key", keys);
|
shapedRecipeJson.add("key", keys);
|
||||||
return shapedRecipeJson;
|
return shapedRecipeJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Stream<Item> streamItemsFromTag(TagKey<Item> tag) {
|
||||||
|
return StreamSupport.stream(Registry.ITEM.iterateEntries(tag).spliterator(), false)
|
||||||
|
.map(RegistryEntry::value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of RebornCore, licensed under the MIT License (MIT).
|
|
||||||
*
|
|
||||||
* Copyright (c) 2021 TeamReborn
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package reborncore.common.crafting.ingredient;
|
|
||||||
|
|
||||||
import net.minecraft.tag.Tag;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SimpleTag<T> implements Tag.Identified<T> {
|
|
||||||
private final List<T> entries;
|
|
||||||
private final Identifier identifier;
|
|
||||||
|
|
||||||
public SimpleTag(List<T> entries, Identifier identifier) {
|
|
||||||
this.entries = entries;
|
|
||||||
this.identifier = identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean contains(T entry) {
|
|
||||||
return entries.contains(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<T> values() {
|
|
||||||
return Collections.unmodifiableList(entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Identifier getId() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,31 +38,26 @@ import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class StackIngredient extends RebornIngredient {
|
public class StackIngredient extends RebornIngredient {
|
||||||
|
|
||||||
private final List<ItemStack> stacks;
|
private final ItemStack stack;
|
||||||
|
|
||||||
private final Optional<Integer> count;
|
private final Optional<Integer> count;
|
||||||
private final Optional<NbtCompound> nbt;
|
private final Optional<NbtCompound> nbt;
|
||||||
private final boolean requireEmptyNbt;
|
private final boolean requireEmptyNbt;
|
||||||
|
|
||||||
public StackIngredient(List<ItemStack> stacks, Optional<Integer> count, Optional<NbtCompound> nbt, boolean requireEmptyNbt) {
|
public StackIngredient(ItemStack stack, Optional<Integer> count, Optional<NbtCompound> nbt, boolean requireEmptyNbt) {
|
||||||
this.stacks = stacks;
|
this.stack = stack;
|
||||||
this.count = count;
|
this.count = Objects.requireNonNull(count);
|
||||||
this.nbt = nbt;
|
this.nbt = Objects.requireNonNull(nbt);
|
||||||
this.requireEmptyNbt = requireEmptyNbt;
|
this.requireEmptyNbt = requireEmptyNbt;
|
||||||
Validate.isTrue(stacks.size() == 1, "stack size must 1");
|
Validate.isTrue(!stack.isEmpty(), "ingredient must not empty");
|
||||||
}
|
|
||||||
|
|
||||||
public StackIngredient(List<ItemStack> stacks, int count, @Nullable NbtCompound nbt, boolean requireEmptyNbt) {
|
|
||||||
this(stacks, count > 1 ? Optional.of(count) : Optional.empty(), Optional.ofNullable(nbt), requireEmptyNbt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RebornIngredient deserialize(JsonObject json) {
|
public static RebornIngredient deserialize(JsonObject json) {
|
||||||
|
@ -87,7 +82,7 @@ public class StackIngredient extends RebornIngredient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new StackIngredient(Collections.singletonList(new ItemStack(item)), stackSize, tag, requireEmptyTag);
|
return new StackIngredient(new ItemStack(item), stackSize, tag, requireEmptyTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,12 +91,15 @@ public class StackIngredient extends RebornIngredient {
|
||||||
if (itemStack.isEmpty()) {
|
if (itemStack.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (stacks.stream().noneMatch(recipeStack -> recipeStack.getItem() == itemStack.getItem())) {
|
|
||||||
|
if (stack.getItem() != itemStack.getItem()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count.isPresent() && count.get() > itemStack.getCount()) {
|
if (count.isPresent() && count.get() > itemStack.getCount()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt.isPresent()) {
|
if (nbt.isPresent()) {
|
||||||
if (!itemStack.hasNbt()) {
|
if (!itemStack.hasNbt()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -118,6 +116,7 @@ public class StackIngredient extends RebornIngredient {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !requireEmptyNbt || !itemStack.hasNbt();
|
return !requireEmptyNbt || !itemStack.hasNbt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,19 +127,17 @@ public class StackIngredient extends RebornIngredient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getPreviewStacks() {
|
public List<ItemStack> getPreviewStacks() {
|
||||||
return Collections.unmodifiableList(
|
ItemStack copy = stack.copy();
|
||||||
stacks.stream()
|
copy.setCount(count.orElse(1));
|
||||||
.map(ItemStack::copy)
|
copy.setNbt(nbt.orElse(null));
|
||||||
.peek(itemStack -> itemStack.setCount(count.orElse(1)))
|
return Collections.singletonList(copy);
|
||||||
.peek(itemStack -> itemStack.setNbt(nbt.orElse(null)))
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonObject toJson(boolean networkSync) {
|
public JsonObject toJson(boolean networkSync) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
|
||||||
jsonObject.addProperty("item", Registry.ITEM.getId(stacks.get(0).getItem()).toString());
|
jsonObject.addProperty("item", Registry.ITEM.getId(stack.getItem()).toString());
|
||||||
count.ifPresent(integer -> jsonObject.addProperty("count", integer));
|
count.ifPresent(integer -> jsonObject.addProperty("count", integer));
|
||||||
|
|
||||||
if (requireEmptyNbt) {
|
if (requireEmptyNbt) {
|
||||||
|
|
|
@ -25,43 +25,40 @@
|
||||||
package reborncore.common.crafting.ingredient;
|
package reborncore.common.crafting.ingredient;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonSyntaxException;
|
|
||||||
import net.fabricmc.fabric.api.tag.TagFactory;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.recipe.Ingredient;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.tag.ServerTagManagerHolder;
|
import net.minecraft.tag.TagKey;
|
||||||
import net.minecraft.tag.Tag;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryEntry;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
public class TagIngredient extends RebornIngredient {
|
public class TagIngredient extends RebornIngredient {
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
private final Optional<Integer> count;
|
private final Optional<Integer> count;
|
||||||
|
|
||||||
public TagIngredient(Tag.Identified<Item> tag, Optional<Integer> count) {
|
public TagIngredient(TagKey<Item> tag, Optional<Integer> count) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagIngredient(Tag.Identified<Item> tag, int count) {
|
|
||||||
this(tag, count > 1 ? Optional.of(count) : Optional.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ItemStack itemStack) {
|
public boolean test(ItemStack itemStack) {
|
||||||
if (count.isPresent() && count.get() > itemStack.getCount()) {
|
if (count.isPresent() && count.get() > itemStack.getCount()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return tag.contains(itemStack.getItem());
|
|
||||||
|
return itemStack.isIn(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,7 +68,7 @@ public class TagIngredient extends RebornIngredient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getPreviewStacks() {
|
public List<ItemStack> getPreviewStacks() {
|
||||||
return tag.values().stream().map(ItemStack::new).peek(itemStack -> itemStack.setCount(count.orElse(1))).collect(Collectors.toList());
|
return streamItems().map(ItemStack::new).peek(itemStack -> itemStack.setCount(count.orElse(1))).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RebornIngredient deserialize(JsonObject json) {
|
public static RebornIngredient deserialize(JsonObject json) {
|
||||||
|
@ -89,17 +86,14 @@ public class TagIngredient extends RebornIngredient {
|
||||||
Validate.isTrue(item != Items.AIR, "item cannot be air");
|
Validate.isTrue(item != Items.AIR, "item cannot be air");
|
||||||
items.add(item);
|
items.add(item);
|
||||||
}
|
}
|
||||||
return new TagIngredient(new SimpleTag<>(items, tagIdent), count);
|
|
||||||
|
return new Synced(TagKey.of(Registry.ITEM_KEY, tagIdent), count, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
Identifier identifier = new Identifier(JsonHelper.getString(json, "tag"));
|
Identifier identifier = new Identifier(JsonHelper.getString(json, "tag"));
|
||||||
|
|
||||||
Tag.Identified<Item> tag = TagFactory.of(() -> ServerTagManagerHolder.getTagManager().getOrCreateTagGroup(Registry.ITEM_KEY)).create(identifier);
|
TagKey<Item> tagKey = TagKey.of(Registry.ITEM_KEY, identifier);
|
||||||
if (tag == null) {
|
return new TagIngredient(tagKey, count);
|
||||||
throw new JsonSyntaxException("Unknown item tag '" + identifier + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TagIngredient(tag, count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,7 +103,7 @@ public class TagIngredient extends RebornIngredient {
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("tag", tag.getId().toString());
|
jsonObject.addProperty("tag", tag.id().toString());
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,17 +112,41 @@ public class TagIngredient extends RebornIngredient {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("tag_server_sync", true);
|
jsonObject.addProperty("tag_server_sync", true);
|
||||||
|
|
||||||
Item[] items = tag.values().toArray(new Item[0]);
|
Item[] items = streamItems().toArray(Item[]::new);
|
||||||
jsonObject.addProperty("items", items.length);
|
jsonObject.addProperty("items", items.length);
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
jsonObject.addProperty("item_" + i, Registry.ITEM.getId(items[i]).toString());
|
jsonObject.addProperty("item_" + i, Registry.ITEM.getId(items[i]).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
count.ifPresent(integer -> jsonObject.addProperty("count", integer));
|
count.ifPresent(integer -> jsonObject.addProperty("count", integer));
|
||||||
jsonObject.addProperty("tag_identifier", tag.getId().toString());
|
jsonObject.addProperty("tag_identifier", tag.id().toString());
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Stream<Item> streamItems() {
|
||||||
|
return StreamSupport.stream(Registry.ITEM.iterateEntries(tag).spliterator(), false)
|
||||||
|
.map(RegistryEntry::value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Synced extends TagIngredient {
|
||||||
|
private final List<Item> items;
|
||||||
|
|
||||||
|
public Synced(TagKey<Item> tag, Optional<Integer> count, List<Item> items) {
|
||||||
|
super(tag, count);
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean test(ItemStack itemStack) {
|
||||||
|
return items.contains(itemStack.getItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Stream<Item> streamItems() {
|
||||||
|
return items.stream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return count.orElse(1);
|
return count.orElse(1);
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
|
|
||||||
package reborncore.common.misc;
|
package reborncore.common.misc;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.tag.TagFactory;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.TagKey;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public class RebornCoreTags {
|
public class RebornCoreTags {
|
||||||
public static final Tag.Identified<Item> WATER_EXPLOSION_ITEM = TagFactory.ITEM.create(new Identifier("reborncore", "water_explosion"));
|
public static final TagKey<Item> WATER_EXPLOSION_ITEM = TagKey.of(Registry.ITEM_KEY, new Identifier("reborncore", "water_explosion"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.misc;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.TagKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if an item, block etc. has a tag solely for compatibility with other mods.
|
* Tells if an item, block etc. has a tag solely for compatibility with other mods.
|
||||||
|
@ -41,6 +41,6 @@ public interface TagConvertible<T> {
|
||||||
*
|
*
|
||||||
* @return the common tag of this object
|
* @return the common tag of this object
|
||||||
*/
|
*/
|
||||||
Tag.Identified<T> asTag();
|
TagKey<T> asTag();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public abstract class MixinItemEntity extends Entity {
|
||||||
@Inject(method = "tick", at = @At("RETURN"))
|
@Inject(method = "tick", at = @At("RETURN"))
|
||||||
public void tick(CallbackInfo info) {
|
public void tick(CallbackInfo info) {
|
||||||
if (!world.isClient && isTouchingWater() && !getStack().isEmpty()) {
|
if (!world.isClient && isTouchingWater() && !getStack().isEmpty()) {
|
||||||
if (RebornCoreTags.WATER_EXPLOSION_ITEM.contains(getStack().getItem())) {
|
if (getStack().isIn(RebornCoreTags.WATER_EXPLOSION_ITEM)) {
|
||||||
world.createExplosion(this, getX(), getY(), getZ(), 2F, Explosion.DestructionType.BREAK);
|
world.createExplosion(this, getX(), getY(), getZ(), 2F, Explosion.DestructionType.BREAK);
|
||||||
this.remove(RemovalReason.KILLED);
|
this.remove(RemovalReason.KILLED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,11 @@
|
||||||
"reborncore.common.mixins.json"
|
"reborncore.common.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.12.12",
|
"fabricloader": ">=0.13.3",
|
||||||
"fabric": ">=0.40.0",
|
"fabric": ">=0.40.0",
|
||||||
"team_reborn_energy": ">=2.2.0",
|
"team_reborn_energy": ">=2.2.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0"
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
|
"minecraft": "~1.18.2-beta.1"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
"Team Reborn",
|
"Team Reborn",
|
||||||
|
|
|
@ -8,7 +8,7 @@ accessible class net/minecraft/recipe/Ingredient$Entry
|
||||||
accessible class net/minecraft/recipe/Ingredient$TagEntry
|
accessible class net/minecraft/recipe/Ingredient$TagEntry
|
||||||
accessible class net/minecraft/recipe/Ingredient$StackEntry
|
accessible class net/minecraft/recipe/Ingredient$StackEntry
|
||||||
accessible field net/minecraft/recipe/Ingredient entries [Lnet/minecraft/recipe/Ingredient$Entry;
|
accessible field net/minecraft/recipe/Ingredient entries [Lnet/minecraft/recipe/Ingredient$Entry;
|
||||||
accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/minecraft/tag/Tag;
|
accessible field net/minecraft/recipe/Ingredient$TagEntry tag Lnet/minecraft/tag/TagKey;
|
||||||
|
|
||||||
accessible method net/minecraft/client/gui/screen/ingame/HandledScreen getSlotAt (DD)Lnet/minecraft/screen/slot/Slot;
|
accessible method net/minecraft/client/gui/screen/ingame/HandledScreen getSlotAt (DD)Lnet/minecraft/screen/slot/Slot;
|
||||||
|
|
||||||
|
|
|
@ -191,11 +191,12 @@ dependencies {
|
||||||
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"
|
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"
|
||||||
|
|
||||||
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
|
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
|
||||||
gametestImplementation 'org.apache.groovy:groovy:4.0.0-rc-2'
|
gametestImplementation 'org.apache.groovy:groovy:4.0.0'
|
||||||
datagenImplementation 'org.apache.groovy:groovy:4.0.0-rc-2'
|
datagenImplementation 'org.apache.groovy:groovy:4.0.0'
|
||||||
|
|
||||||
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
gametestImplementation ("com.google.truth:truth:1.1.3") {
|
||||||
exclude module: "guava"
|
exclude module: "guava"
|
||||||
|
exclude module: "asm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,14 @@ org.gradle.jvmargs=-Xmx2G
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.18.1
|
minecraft_version=1.18.2-rc1
|
||||||
yarn_version=1.18.1+build.18
|
yarn_version=1.18.2-rc1+build.2
|
||||||
loader_version=0.12.12
|
loader_version=0.13.3
|
||||||
fapi_version=0.46.4+1.18
|
fapi_version=0.47.8+1.18.2
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
energy_version=2.2.0
|
energy_version=2.2.0
|
||||||
rei_version=7.1.361
|
rei_version=8.0.438
|
||||||
trinkets_version=3.0.2
|
trinkets_version=3.0.2
|
||||||
autoswitch_version=-SNAPSHOT
|
autoswitch_version=-SNAPSHOT
|
||||||
dashloader_version=2.0
|
dashloader_version=2.0
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
269
gradlew
vendored
269
gradlew
vendored
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,67 +17,101 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MSYS* | MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
@ -106,80 +140,95 @@ location of your Java installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit"
|
||||||
fi
|
esac
|
||||||
ulimit -n $MAX_FD
|
case $MAX_FD in #(
|
||||||
if [ $? -ne 0 ] ; then
|
'' | soft) :;; #(
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
*)
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
else
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
import techreborn.datagen.recipes.machine.grinder.GrinderRecipesProvider
|
import techreborn.datagen.recipes.machine.grinder.GrinderRecipesProvider
|
||||||
import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
|
import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
|
||||||
import techreborn.datagen.recipes.crafting.CraftingRecipesProvider
|
import techreborn.datagen.recipes.crafting.CraftingRecipesProvider
|
||||||
|
import techreborn.datagen.tags.TRBlockTagProvider
|
||||||
import techreborn.datagen.tags.TRItemTagProvider
|
import techreborn.datagen.tags.TRItemTagProvider
|
||||||
import techreborn.datagen.tags.WaterExplosionTagProvider
|
import techreborn.datagen.tags.WaterExplosionTagProvider
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
|
||||||
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||||
fabricDataGenerator.addProvider(WaterExplosionTagProvider.&new)
|
fabricDataGenerator.addProvider(WaterExplosionTagProvider.&new)
|
||||||
fabricDataGenerator.addProvider(TRItemTagProvider.&new)
|
fabricDataGenerator.addProvider(TRItemTagProvider.&new)
|
||||||
|
fabricDataGenerator.addProvider(TRBlockTagProvider.&new)
|
||||||
// tags before all else, very important!!
|
// tags before all else, very important!!
|
||||||
fabricDataGenerator.addProvider(SmeltingRecipesProvider.&new)
|
fabricDataGenerator.addProvider(SmeltingRecipesProvider.&new)
|
||||||
fabricDataGenerator.addProvider(CraftingRecipesProvider.&new)
|
fabricDataGenerator.addProvider(CraftingRecipesProvider.&new)
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
package techreborn.datagen.recipes
|
package techreborn.datagen.recipes
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipesProvider
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider
|
||||||
import net.minecraft.advancement.criterion.CriterionConditions
|
import net.minecraft.advancement.criterion.CriterionConditions
|
||||||
import net.minecraft.data.server.recipe.RecipeJsonProvider
|
import net.minecraft.data.server.recipe.RecipeJsonProvider
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.recipe.Ingredient
|
import net.minecraft.recipe.Ingredient
|
||||||
import net.minecraft.tag.Tag
|
import net.minecraft.tag.TagKey
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
|
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ import techreborn.init.ModRecipes
|
||||||
|
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
|
||||||
protected Consumer<RecipeJsonProvider> exporter
|
protected Consumer<RecipeJsonProvider> exporter
|
||||||
TechRebornRecipesProvider(FabricDataGenerator dataGenerator) {
|
TechRebornRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||||
super(dataGenerator)
|
super(dataGenerator)
|
||||||
|
@ -58,7 +58,7 @@ abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
||||||
}
|
}
|
||||||
if (input instanceof ItemConvertible) {
|
if (input instanceof ItemConvertible) {
|
||||||
return Ingredient.ofItems(input)
|
return Ingredient.ofItems(input)
|
||||||
} else if (input instanceof Tag.Identified) {
|
} else if (input instanceof TagKey) {
|
||||||
return Ingredient.fromTag(input)
|
return Ingredient.fromTag(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
||||||
static String getCriterionName(def input) {
|
static String getCriterionName(def input) {
|
||||||
if (input instanceof ItemConvertible) {
|
if (input instanceof ItemConvertible) {
|
||||||
return hasItem(input)
|
return hasItem(input)
|
||||||
} else if (input instanceof Tag.Identified) {
|
} else if (input instanceof TagKey) {
|
||||||
return "has_tag_" + input.getId()
|
return "has_tag_" + input.id()
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException()
|
throw new IllegalArgumentException()
|
||||||
|
@ -78,7 +78,7 @@ abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
||||||
static CriterionConditions getCriterionConditions(def input) {
|
static CriterionConditions getCriterionConditions(def input) {
|
||||||
if (input instanceof ItemConvertible) {
|
if (input instanceof ItemConvertible) {
|
||||||
return conditionsFromItem(input)
|
return conditionsFromItem(input)
|
||||||
} else if (input instanceof Tag.Identified) {
|
} else if (input instanceof TagKey) {
|
||||||
return conditionsFromTag(input)
|
return conditionsFromTag(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
||||||
static String getInputPath(def input) {
|
static String getInputPath(def input) {
|
||||||
if (input instanceof ItemConvertible) {
|
if (input instanceof ItemConvertible) {
|
||||||
return getItemPath(input)
|
return getItemPath(input)
|
||||||
} else if (input instanceof Tag.Identified) {
|
} else if (input instanceof TagKey) {
|
||||||
return input.getId().toString().replace(":", "_")
|
return input.id().toString().replace(":", "_")
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException()
|
throw new IllegalArgumentException()
|
||||||
|
@ -98,8 +98,8 @@ abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
||||||
static String getName(def input) {
|
static String getName(def input) {
|
||||||
if (input instanceof ItemConvertible) {
|
if (input instanceof ItemConvertible) {
|
||||||
return getItemPath(input)
|
return getItemPath(input)
|
||||||
} else if (input instanceof Tag.Identified) {
|
} else if (input instanceof TagKey) {
|
||||||
String name = input.getId().toString()
|
String name = input.id().toString()
|
||||||
if (name.contains(":"))
|
if (name.contains(":"))
|
||||||
name = name.substring(name.indexOf(":")+1)
|
name = name.substring(name.indexOf(":")+1)
|
||||||
return name
|
return name
|
||||||
|
@ -113,8 +113,8 @@ abstract class TechRebornRecipesProvider extends FabricRecipesProvider {
|
||||||
if (input instanceof ItemConvertible) {
|
if (input instanceof ItemConvertible) {
|
||||||
name = getItemPath(input)
|
name = getItemPath(input)
|
||||||
return name.substring(0,name.indexOf("_"))
|
return name.substring(0,name.indexOf("_"))
|
||||||
} else if (input instanceof Tag.Identified) {
|
} else if (input instanceof TagKey) {
|
||||||
name = input.getId().toString()
|
name = input.id().toString()
|
||||||
if (name.contains(":"))
|
if (name.contains(":"))
|
||||||
name = name.substring(name.indexOf(":")+1)
|
name = name.substring(name.indexOf(":")+1)
|
||||||
return name.substring(0,name.indexOf("_"))
|
return name.substring(0,name.indexOf("_"))
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
package techreborn.datagen.recipes.crafting
|
package techreborn.datagen.recipes.crafting
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonFactory
|
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder
|
||||||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonFactory
|
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder
|
||||||
import net.minecraft.data.server.recipe.SingleItemRecipeJsonFactory
|
import net.minecraft.data.server.recipe.SingleItemRecipeJsonBuilder
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
|
@ -192,7 +192,7 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null) {
|
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null) {
|
||||||
ShapelessRecipeJsonFactory.create(output, outputSize).input(createIngredient(input), inputSize)
|
ShapelessRecipeJsonBuilder.create(output, outputSize).input(createIngredient(input), inputSize)
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
|
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
|
||||||
}
|
}
|
||||||
|
@ -207,13 +207,13 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1) {
|
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1) {
|
||||||
return ShapedRecipeJsonFactory.create(output, outputAmount)
|
return ShapedRecipeJsonBuilder.create(output, outputAmount)
|
||||||
.input(character, createIngredient(input))
|
.input(character, createIngredient(input))
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false) {
|
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false) {
|
||||||
ShapedRecipeJsonFactory factory = ShapedRecipeJsonFactory.create(output)
|
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(output)
|
||||||
.input(char1, createIngredient(input1))
|
.input(char1, createIngredient(input1))
|
||||||
.input(char2, createIngredient(input2))
|
.input(char2, createIngredient(input2))
|
||||||
if (crit1)
|
if (crit1)
|
||||||
|
@ -224,7 +224,7 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1) {
|
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1) {
|
||||||
return SingleItemRecipeJsonFactory.createStonecutting(createIngredient(input), output, outputAmount)
|
return SingleItemRecipeJsonBuilder.createStonecutting(createIngredient(input), output, outputAmount)
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,13 @@ package techreborn.datagen.recipes.machine
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.tag.Tag
|
import net.minecraft.tag.TagKey
|
||||||
import reborncore.common.crafting.ingredient.RebornIngredient
|
import reborncore.common.crafting.ingredient.RebornIngredient
|
||||||
import reborncore.common.crafting.ingredient.StackIngredient
|
import reborncore.common.crafting.ingredient.StackIngredient
|
||||||
import reborncore.common.crafting.ingredient.TagIngredient
|
import reborncore.common.crafting.ingredient.TagIngredient
|
||||||
|
|
||||||
class IngredientBuilder {
|
class IngredientBuilder {
|
||||||
private Tag.Identified<Item> tag
|
private TagKey<Item> tag
|
||||||
private List<ItemStack> stacks = new ArrayList<>()
|
private List<ItemStack> stacks = new ArrayList<>()
|
||||||
|
|
||||||
private IngredientBuilder() {
|
private IngredientBuilder() {
|
||||||
|
@ -59,7 +59,7 @@ class IngredientBuilder {
|
||||||
throw new IllegalStateException()
|
throw new IllegalStateException()
|
||||||
}
|
}
|
||||||
|
|
||||||
def tag(Tag.Identified<Item> tag) {
|
def tag(TagKey<Item> tag) {
|
||||||
this.tag = tag
|
this.tag = tag
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.data.server.recipe.RecipeJsonProvider
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.recipe.RecipeSerializer
|
import net.minecraft.recipe.RecipeSerializer
|
||||||
import net.minecraft.tag.Tag
|
import net.minecraft.tag.TagKey
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.registry.Registry
|
import net.minecraft.util.registry.Registry
|
||||||
import reborncore.common.crafting.RebornRecipe
|
import reborncore.common.crafting.RebornRecipe
|
||||||
|
@ -68,7 +68,7 @@ class MachineRecipeJsonFactory<R extends RebornRecipe> {
|
||||||
ingredient {
|
ingredient {
|
||||||
item object
|
item object
|
||||||
}
|
}
|
||||||
} else if (object instanceof Tag.Identified) {
|
} else if (object instanceof TagKey) {
|
||||||
ingredient {
|
ingredient {
|
||||||
tag object
|
tag object
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
package techreborn.datagen.recipes.smelting
|
package techreborn.datagen.recipes.smelting
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
import net.minecraft.data.server.recipe.CookingRecipeJsonFactory
|
import net.minecraft.data.server.recipe.CookingRecipeJsonBuilder
|
||||||
import net.minecraft.item.ItemConvertible
|
import net.minecraft.item.ItemConvertible
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.recipe.CookingRecipeSerializer
|
import net.minecraft.recipe.CookingRecipeSerializer
|
||||||
|
@ -75,7 +75,7 @@ class SmeltingRecipesProvider extends TechRebornRecipesProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
def offerCookingRecipe(def input, ItemConvertible output, float experience, int cookingTime, CookingRecipeSerializer<?> serializer, String prefix = "") {
|
def offerCookingRecipe(def input, ItemConvertible output, float experience, int cookingTime, CookingRecipeSerializer<?> serializer, String prefix = "") {
|
||||||
CookingRecipeJsonFactory.create(createIngredient(input), output, experience, cookingTime, serializer)
|
CookingRecipeJsonBuilder.create(createIngredient(input), output, experience, cookingTime, serializer)
|
||||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||||
.offerTo(this.exporter, prefix + getInputPath(output) + "_from_" + getInputPath(input))
|
.offerTo(this.exporter, prefix + getInputPath(output) + "_from_" + getInputPath(input))
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
|
|
||||||
package techreborn.datagen.tags
|
package techreborn.datagen.tags
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.tag.TagFactory
|
import net.minecraft.tag.TagKey
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
|
import net.minecraft.util.registry.Registry
|
||||||
|
|
||||||
class CommonTags {
|
class CommonTags {
|
||||||
static class Items {
|
static class Items {
|
||||||
|
@ -42,7 +43,7 @@ class CommonTags {
|
||||||
public static ironPlates = create("iron_plates")
|
public static ironPlates = create("iron_plates")
|
||||||
|
|
||||||
private static def create(String path) {
|
private static def create(String path) {
|
||||||
return TagFactory.ITEM.create(new Identifier("c", path))
|
return TagKey.of(Registry.ITEM_KEY, new Identifier("c", path))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,31 +22,31 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package techreborn.utils;
|
package techreborn.datagen.tags
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
||||||
import net.minecraft.item.Item;
|
import net.fabricmc.fabric.api.mininglevel.v1.FabricMineableTags
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.BlockTags
|
||||||
import net.minecraft.tag.TagGroup;
|
import techreborn.items.tool.DrillItem
|
||||||
import net.minecraft.util.registry.Registry;
|
import techreborn.items.tool.industrial.OmniToolItem
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class TagUtils {
|
class TRBlockTagProvider extends FabricTagProvider.BlockTagProvider {
|
||||||
|
|
||||||
public static <T> boolean hasTag(T type, Tag<T> tag) {
|
TRBlockTagProvider(FabricDataGenerator dataGenerator) {
|
||||||
return tag.contains(type);
|
super(dataGenerator)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TagGroup<Block> getAllBlockTags(World world) {
|
@Override
|
||||||
return world.getTagManager().getOrCreateTagGroup(Registry.BLOCK_KEY);
|
protected void generateTags() {
|
||||||
}
|
getOrCreateTagBuilder(DrillItem.DRILL_MINEABLE)
|
||||||
|
.addOptionalTag(BlockTags.PICKAXE_MINEABLE.id())
|
||||||
|
.addOptionalTag(BlockTags.SHOVEL_MINEABLE.id())
|
||||||
|
|
||||||
public static TagGroup<Item> getAllItemTags(World world) {
|
getOrCreateTagBuilder(OmniToolItem.OMNI_TOOL_MINEABLE)
|
||||||
return world.getTagManager().getOrCreateTagGroup(Registry.ITEM_KEY);
|
.addOptionalTag(DrillItem.DRILL_MINEABLE.id())
|
||||||
}
|
.addOptionalTag(BlockTags.AXE_MINEABLE.id())
|
||||||
|
.addOptionalTag(FabricMineableTags.SHEARS_MINEABLE.id())
|
||||||
public static TagGroup<Fluid> getAllFluidTags(World world) {
|
.addOptionalTag(FabricMineableTags.SWORD_MINEABLE.id())
|
||||||
return world.getTagManager().getOrCreateTagGroup(Registry.FLUID_KEY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,7 +26,6 @@ package techreborn.init;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.tag.TagFactory;
|
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -35,9 +34,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.Tag;
|
||||||
|
import net.minecraft.tag.TagKey;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Pair;
|
import net.minecraft.util.Pair;
|
||||||
import net.minecraft.util.math.intprovider.UniformIntProvider;
|
import net.minecraft.util.math.intprovider.UniformIntProvider;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.api.blockentity.IUpgrade;
|
import reborncore.api.blockentity.IUpgrade;
|
||||||
|
@ -397,7 +398,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> ORES_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "ores"));
|
public static final TagKey<Item> ORES_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "ores"));
|
||||||
|
|
||||||
private final static Map<Ores, Ores> deepslateMap = new HashMap<>();
|
private final static Map<Ores, Ores> deepslateMap = new HashMap<>();
|
||||||
|
|
||||||
|
@ -437,7 +438,7 @@ public class TRContent {
|
||||||
public final String name;
|
public final String name;
|
||||||
public final Block block;
|
public final Block block;
|
||||||
public final OreDistribution distribution;
|
public final OreDistribution distribution;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
Ores(OreDistribution distribution, UniformIntProvider experienceDroppedFallback) {
|
Ores(OreDistribution distribution, UniformIntProvider experienceDroppedFallback) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
@ -449,7 +450,7 @@ public class TRContent {
|
||||||
distribution != null ? distribution.experienceDropped : experienceDroppedFallback
|
distribution != null ? distribution.experienceDropped : experienceDroppedFallback
|
||||||
);
|
);
|
||||||
InitUtils.setup(block, name + "_ore");
|
InitUtils.setup(block, name + "_ore");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c",
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c",
|
||||||
(name.startsWith("deepslate_") ? name.substring(name.indexOf('_')+1): name) + "_ores"));
|
(name.startsWith("deepslate_") ? name.substring(name.indexOf('_')+1): name) + "_ores"));
|
||||||
this.distribution = distribution;
|
this.distribution = distribution;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +471,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +496,7 @@ public class TRContent {
|
||||||
*/
|
*/
|
||||||
public static final String CHROME_TAG_NAME_BASE = "chromium";
|
public static final String CHROME_TAG_NAME_BASE = "chromium";
|
||||||
|
|
||||||
public static final Tag.Identified<Item> STORAGE_BLOCK_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "storage_blocks"));
|
public static final TagKey<Item> STORAGE_BLOCK_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "storage_blocks"));
|
||||||
|
|
||||||
public enum StorageBlocks implements ItemConvertible, TagConvertible<Item> {
|
public enum StorageBlocks implements ItemConvertible, TagConvertible<Item> {
|
||||||
ADVANCED_ALLOY(5f, 6f),
|
ADVANCED_ALLOY(5f, 6f),
|
||||||
|
@ -536,13 +537,13 @@ public class TRContent {
|
||||||
private final StairsBlock stairsBlock;
|
private final StairsBlock stairsBlock;
|
||||||
private final SlabBlock slabBlock;
|
private final SlabBlock slabBlock;
|
||||||
private final WallBlock wallBlock;
|
private final WallBlock wallBlock;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
StorageBlocks(boolean isHot, float hardness, float resistance, String tagNameBase) {
|
StorageBlocks(boolean isHot, float hardness, float resistance, String tagNameBase) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
block = new BlockStorage(isHot, hardness, resistance);
|
block = new BlockStorage(isHot, hardness, resistance);
|
||||||
InitUtils.setup(block, name + "_storage_block");
|
InitUtils.setup(block, name + "_storage_block");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
|
||||||
|
|
||||||
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block));
|
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block));
|
||||||
InitUtils.setup(stairsBlock, name + "_storage_block_stairs");
|
InitUtils.setup(stairsBlock, name + "_storage_block_stairs");
|
||||||
|
@ -572,7 +573,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +719,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> DUSTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "dusts"));
|
public static final TagKey<Item> DUSTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "dusts"));
|
||||||
|
|
||||||
public enum Dusts implements ItemConvertible, TagConvertible<Item> {
|
public enum Dusts implements ItemConvertible, TagConvertible<Item> {
|
||||||
ALMANDINE, ALUMINUM, AMETHYST, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
|
ALMANDINE, ALUMINUM, AMETHYST, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
|
||||||
|
@ -729,13 +730,13 @@ public class TRContent {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
Dusts(String tagNameBase) {
|
Dusts(String tagNameBase) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||||
InitUtils.setup(item, name + "_dust");
|
InitUtils.setup(item, name + "_dust");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Dusts() {
|
Dusts() {
|
||||||
|
@ -756,12 +757,12 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> RAW_METALS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "raw_metals"));
|
public static final TagKey<Item> RAW_METALS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "raw_metals"));
|
||||||
|
|
||||||
public enum RawMetals implements ItemConvertible, TagConvertible<Item> {
|
public enum RawMetals implements ItemConvertible, TagConvertible<Item> {
|
||||||
IRIDIUM, LEAD, SILVER, TIN, TUNGSTEN;
|
IRIDIUM, LEAD, SILVER, TIN, TUNGSTEN;
|
||||||
|
@ -769,7 +770,7 @@ public class TRContent {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final ItemConvertible storageBlock;
|
private final ItemConvertible storageBlock;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
RawMetals() {
|
RawMetals() {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
@ -783,7 +784,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
storageBlock = blockVariant;
|
storageBlock = blockVariant;
|
||||||
InitUtils.setup(item, "raw_" + name);
|
InitUtils.setup(item, "raw_" + name);
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", "raw_" + name + "_ores"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", "raw_" + name + "_ores"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -792,7 +793,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +814,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> SMALL_DUSTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "small_dusts"));
|
public static final TagKey<Item> SMALL_DUSTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "small_dusts"));
|
||||||
|
|
||||||
public enum SmallDusts implements ItemConvertible, TagConvertible<Item> {
|
public enum SmallDusts implements ItemConvertible, TagConvertible<Item> {
|
||||||
ALMANDINE, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
|
ALMANDINE, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
|
||||||
|
@ -826,7 +827,7 @@ public class TRContent {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final ItemConvertible dust;
|
private final ItemConvertible dust;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
SmallDusts(String tagNameBase, ItemConvertible dustVariant) {
|
SmallDusts(String tagNameBase, ItemConvertible dustVariant) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
@ -840,7 +841,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
dust = dustVariant;
|
dust = dustVariant;
|
||||||
InitUtils.setup(item, name + "_small_dust");
|
InitUtils.setup(item, name + "_small_dust");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallDusts(String tagNameBase) {
|
SmallDusts(String tagNameBase) {
|
||||||
|
@ -869,7 +870,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +894,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> GEMS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "gems"));
|
public static final TagKey<Item> GEMS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "gems"));
|
||||||
|
|
||||||
public enum Gems implements ItemConvertible, TagConvertible<Item> {
|
public enum Gems implements ItemConvertible, TagConvertible<Item> {
|
||||||
PERIDOT, RED_GARNET, RUBY("rubies"), SAPPHIRE("sapphires"), YELLOW_GARNET;
|
PERIDOT, RED_GARNET, RUBY("rubies"), SAPPHIRE("sapphires"), YELLOW_GARNET;
|
||||||
|
@ -901,7 +902,7 @@ public class TRContent {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final ItemConvertible storageBlock;
|
private final ItemConvertible storageBlock;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
Gems(String tagPlural) {
|
Gems(String tagPlural) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
@ -915,7 +916,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
storageBlock = blockVariant;
|
storageBlock = blockVariant;
|
||||||
InitUtils.setup(item, name + "_gem");
|
InitUtils.setup(item, name + "_gem");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", tagPlural == null ? name + "_gems" : tagPlural));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", tagPlural == null ? name + "_gems" : tagPlural));
|
||||||
}
|
}
|
||||||
|
|
||||||
Gems() {
|
Gems() {
|
||||||
|
@ -936,7 +937,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,7 +958,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> INGOTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "ingots"));
|
public static final TagKey<Item> INGOTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "ingots"));
|
||||||
|
|
||||||
public enum Ingots implements ItemConvertible, TagConvertible<Item> {
|
public enum Ingots implements ItemConvertible, TagConvertible<Item> {
|
||||||
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), ELECTRUM, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM_ALLOY, IRIDIUM,
|
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), ELECTRUM, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM_ALLOY, IRIDIUM,
|
||||||
|
@ -966,7 +967,7 @@ public class TRContent {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final ItemConvertible storageBlock;
|
private final ItemConvertible storageBlock;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
Ingots(String tagNameBase) {
|
Ingots(String tagNameBase) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
@ -980,7 +981,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
storageBlock = blockVariant;
|
storageBlock = blockVariant;
|
||||||
InitUtils.setup(item, name + "_ingot");
|
InitUtils.setup(item, name + "_ingot");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ingots() {
|
Ingots() {
|
||||||
|
@ -1001,7 +1002,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1023,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> NUGGETS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "nuggets"));
|
public static final TagKey<Item> NUGGETS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "nuggets"));
|
||||||
|
|
||||||
public enum Nuggets implements ItemConvertible, TagConvertible<Item> {
|
public enum Nuggets implements ItemConvertible, TagConvertible<Item> {
|
||||||
ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), COPPER(Items.COPPER_INGOT, false), DIAMOND(Items.DIAMOND, true),
|
ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), COPPER(Items.COPPER_INGOT, false), DIAMOND(Items.DIAMOND, true),
|
||||||
|
@ -1033,7 +1034,7 @@ public class TRContent {
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final ItemConvertible ingot;
|
private final ItemConvertible ingot;
|
||||||
private final boolean ofGem;
|
private final boolean ofGem;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
Nuggets(String tagNameBase, ItemConvertible ingotVariant, boolean ofGem) {
|
Nuggets(String tagNameBase, ItemConvertible ingotVariant, boolean ofGem) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
|
@ -1048,7 +1049,7 @@ public class TRContent {
|
||||||
ingot = ingotVariant;
|
ingot = ingotVariant;
|
||||||
this.ofGem = ofGem;
|
this.ofGem = ofGem;
|
||||||
InitUtils.setup(item, name + "_nugget");
|
InitUtils.setup(item, name + "_nugget");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Nuggets(ItemConvertible ingotVariant, boolean ofGem) {
|
Nuggets(ItemConvertible ingotVariant, boolean ofGem) {
|
||||||
|
@ -1077,7 +1078,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1179,7 +1180,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tag.Identified<Item> PLATES_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "plates"));
|
public static final TagKey<Item> PLATES_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "plates"));
|
||||||
|
|
||||||
public enum Plates implements ItemConvertible, TagConvertible<Item> {
|
public enum Plates implements ItemConvertible, TagConvertible<Item> {
|
||||||
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CARBON, CHROME(CHROME_TAG_NAME_BASE), COAL, COPPER, DIAMOND, ELECTRUM, EMERALD, GOLD, INVAR,
|
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CARBON, CHROME(CHROME_TAG_NAME_BASE), COAL, COPPER, DIAMOND, ELECTRUM, EMERALD, GOLD, INVAR,
|
||||||
|
@ -1189,13 +1190,13 @@ public class TRContent {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Item item;
|
private final Item item;
|
||||||
private final Tag.Identified<Item> tag;
|
private final TagKey<Item> tag;
|
||||||
|
|
||||||
Plates(String tagNameBase) {
|
Plates(String tagNameBase) {
|
||||||
name = this.toString().toLowerCase(Locale.ROOT);
|
name = this.toString().toLowerCase(Locale.ROOT);
|
||||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||||
InitUtils.setup(item, name + "_plate");
|
InitUtils.setup(item, name + "_plate");
|
||||||
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
|
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Plates() {
|
Plates() {
|
||||||
|
@ -1216,7 +1217,7 @@ public class TRContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag.Identified<Item> asTag() {
|
public TagKey<Item> asTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,16 +24,17 @@
|
||||||
|
|
||||||
package techreborn.items.tool;
|
package techreborn.items.tool;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
|
import net.minecraft.block.Block;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.TagKey;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.common.powerSystem.RcEnergyItem;
|
import reborncore.common.powerSystem.RcEnergyItem;
|
||||||
import reborncore.common.powerSystem.RcEnergyTier;
|
import reborncore.common.powerSystem.RcEnergyTier;
|
||||||
|
@ -41,7 +42,8 @@ import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
public class DrillItem extends PickaxeItem implements RcEnergyItem, DynamicAttributeTool {
|
public class DrillItem extends MiningToolItem implements RcEnergyItem {
|
||||||
|
public static final TagKey<Block> DRILL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/drill"));
|
||||||
|
|
||||||
public final int maxCharge;
|
public final int maxCharge;
|
||||||
public final int cost;
|
public final int cost;
|
||||||
|
@ -52,7 +54,7 @@ public class DrillItem extends PickaxeItem implements RcEnergyItem, DynamicAttri
|
||||||
|
|
||||||
public DrillItem(ToolMaterial material, int energyCapacity, RcEnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, MiningLevel miningLevel) {
|
public DrillItem(ToolMaterial material, int energyCapacity, RcEnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, MiningLevel miningLevel) {
|
||||||
// combat stats same as for diamond pickaxe. Fix for #2468
|
// combat stats same as for diamond pickaxe. Fix for #2468
|
||||||
super(material, 1, -2.8F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
super(1, -2.8F, material, DRILL_MINEABLE, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.maxCharge = energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
this.poweredSpeed = poweredSpeed;
|
this.poweredSpeed = poweredSpeed;
|
||||||
|
@ -161,13 +163,4 @@ public class DrillItem extends PickaxeItem implements RcEnergyItem, DynamicAttri
|
||||||
public long getEnergyMaxOutput() {
|
public long getEnergyMaxOutput() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DynamicAttributeTool
|
|
||||||
@Override
|
|
||||||
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
|
||||||
if (tag.equals(FabricToolTags.PICKAXES) || tag.equals(FabricToolTags.SHOVELS)) {
|
|
||||||
return miningLevel;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,31 +24,25 @@
|
||||||
|
|
||||||
package techreborn.items.tool;
|
package techreborn.items.tool;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
|
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.tag.Tag;
|
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
|
||||||
import reborncore.common.powerSystem.RcEnergyItem;
|
import reborncore.common.powerSystem.RcEnergyItem;
|
||||||
import reborncore.common.powerSystem.RcEnergyTier;
|
import reborncore.common.powerSystem.RcEnergyTier;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.init.TRToolMaterials;
|
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
import techreborn.utils.ToolsUtil;
|
import techreborn.utils.ToolsUtil;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class JackhammerItem extends PickaxeItem implements RcEnergyItem, DynamicAttributeTool {
|
public class JackhammerItem extends PickaxeItem implements RcEnergyItem {
|
||||||
|
|
||||||
public final int maxCharge;
|
public final int maxCharge;
|
||||||
public final RcEnergyTier tier;
|
public final RcEnergyTier tier;
|
||||||
public final int cost;
|
public final int cost;
|
||||||
|
@ -158,13 +152,4 @@ public class JackhammerItem extends PickaxeItem implements RcEnergyItem, Dynamic
|
||||||
public int getItemBarColor(ItemStack stack) {
|
public int getItemBarColor(ItemStack stack) {
|
||||||
return ItemUtils.getColorForDurabilityBar(stack);
|
return ItemUtils.getColorForDurabilityBar(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DynamicAttributeTool
|
|
||||||
@Override
|
|
||||||
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
|
||||||
if (tag.equals(FabricToolTags.PICKAXES)) {
|
|
||||||
return MiningLevel.IRON.intLevel;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.item.ToolMaterials;
|
|
||||||
import net.minecraft.tag.BlockTags;
|
import net.minecraft.tag.BlockTags;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
@ -48,7 +47,6 @@ import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.init.TRToolMaterials;
|
import techreborn.init.TRToolMaterials;
|
||||||
import techreborn.items.tool.ChainsawItem;
|
import techreborn.items.tool.ChainsawItem;
|
||||||
import techreborn.utils.MessageIDs;
|
import techreborn.utils.MessageIDs;
|
||||||
import techreborn.utils.TagUtils;
|
|
||||||
import techreborn.utils.ToolsUtil;
|
import techreborn.utils.ToolsUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -75,10 +73,11 @@ public class IndustrialChainsawItem extends ChainsawItem {
|
||||||
BlockPos checkPos = pos.offset(facing);
|
BlockPos checkPos = pos.offset(facing);
|
||||||
if (!wood.contains(checkPos) && !leaves.contains(checkPos)) {
|
if (!wood.contains(checkPos) && !leaves.contains(checkPos)) {
|
||||||
BlockState state = world.getBlockState(checkPos);
|
BlockState state = world.getBlockState(checkPos);
|
||||||
if (TagUtils.hasTag(state.getBlock(), BlockTags.LOGS)) {
|
|
||||||
|
if (state.isIn(BlockTags.LOGS)) {
|
||||||
wood.add(checkPos);
|
wood.add(checkPos);
|
||||||
findWood(world, checkPos, wood, leaves);
|
findWood(world, checkPos, wood, leaves);
|
||||||
} else if (TagUtils.hasTag(state.getBlock(), BlockTags.LEAVES)) {
|
} else if (state.isIn(BlockTags.LEAVES)) {
|
||||||
leaves.add(checkPos);
|
leaves.add(checkPos);
|
||||||
findWood(world, checkPos, wood, leaves);
|
findWood(world, checkPos, wood, leaves);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,7 @@ package techreborn.items.tool.industrial;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
|
import net.minecraft.block.Block;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
|
@ -35,20 +34,21 @@ import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.tag.Tag;
|
import net.minecraft.tag.TagKey;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
|
||||||
import reborncore.common.powerSystem.RcEnergyItem;
|
import reborncore.common.powerSystem.RcEnergyItem;
|
||||||
|
import reborncore.common.powerSystem.RcEnergyTier;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import reborncore.common.util.TorchHelper;
|
import reborncore.common.util.TorchHelper;
|
||||||
import reborncore.common.powerSystem.RcEnergyTier;
|
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.config.TechRebornConfig;
|
import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
@ -58,7 +58,8 @@ import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OmniToolItem extends PickaxeItem implements RcEnergyItem, DynamicAttributeTool {
|
public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
|
||||||
|
public static final TagKey<Block> OMNI_TOOL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/omni_tool"));
|
||||||
|
|
||||||
public final int maxCharge = TechRebornConfig.omniToolCharge;
|
public final int maxCharge = TechRebornConfig.omniToolCharge;
|
||||||
public int cost = TechRebornConfig.omniToolCost;
|
public int cost = TechRebornConfig.omniToolCost;
|
||||||
|
@ -67,7 +68,7 @@ public class OmniToolItem extends PickaxeItem implements RcEnergyItem, DynamicAt
|
||||||
|
|
||||||
// 4M FE max charge with 1k charge rate
|
// 4M FE max charge with 1k charge rate
|
||||||
public OmniToolItem() {
|
public OmniToolItem() {
|
||||||
super(TRToolMaterials.OMNI_TOOL, 3, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
super(3, 1, TRToolMaterials.OMNI_TOOL, OMNI_TOOL_MINEABLE, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.miningLevel = MiningLevel.DIAMOND.intLevel;
|
this.miningLevel = MiningLevel.DIAMOND.intLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,13 +170,4 @@ public class OmniToolItem extends PickaxeItem implements RcEnergyItem, DynamicAt
|
||||||
public RcEnergyTier getTier() {
|
public RcEnergyTier getTier() {
|
||||||
return RcEnergyTier.EXTREME;
|
return RcEnergyTier.EXTREME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DynamicAttributeTool
|
|
||||||
@Override
|
|
||||||
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
|
||||||
if (tag.equals(FabricToolTags.PICKAXES) || tag.equals(FabricToolTags.SHOVELS) || tag.equals(FabricToolTags.AXES) || tag.equals(FabricToolTags.SHEARS) || tag.equals(FabricToolTags.SWORDS)) {
|
|
||||||
return miningLevel;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,11 @@ import net.minecraft.structure.rule.RuleTest;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.BuiltinRegistries;
|
import net.minecraft.util.registry.BuiltinRegistries;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryEntry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
import net.minecraft.world.gen.YOffset;
|
import net.minecraft.world.gen.YOffset;
|
||||||
import net.minecraft.world.gen.decorator.*;
|
|
||||||
import net.minecraft.world.gen.feature.*;
|
import net.minecraft.world.gen.feature.*;
|
||||||
|
import net.minecraft.world.gen.placementmodifier.*;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -59,7 +60,7 @@ public class OreFeature {
|
||||||
case END -> createSimpleFeatureConfig(new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState()));
|
case END -> createSimpleFeatureConfig(new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState()));
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfiguredFeature<?, ?> configuredFeature = Feature.ORE.configure(oreFeatureConfig);
|
ConfiguredFeature<?, ?> configuredFeature = new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig);
|
||||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, getId(), configuredFeature);
|
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, getId(), configuredFeature);
|
||||||
return configuredFeature;
|
return configuredFeature;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,7 @@ public class OreFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlacedFeature configureAndRegisterPlacedFeature() {
|
private PlacedFeature configureAndRegisterPlacedFeature() {
|
||||||
PlacedFeature placedFeature = configuredFeature.withPlacement(getPlacementModifiers());
|
PlacedFeature placedFeature = new PlacedFeature(WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, configuredFeature), getPlacementModifiers());
|
||||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, getId(), placedFeature);
|
Registry.register(BuiltinRegistries.PLACED_FEATURE, getId(), placedFeature);
|
||||||
return placedFeature;
|
return placedFeature;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,9 @@
|
||||||
package techreborn.world;
|
package techreborn.world;
|
||||||
|
|
||||||
import net.minecraft.block.sapling.SaplingGenerator;
|
import net.minecraft.block.sapling.SaplingGenerator;
|
||||||
|
import net.minecraft.util.registry.BuiltinRegistries;
|
||||||
|
import net.minecraft.util.registry.RegistryEntry;
|
||||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||||
import net.minecraft.world.gen.feature.TreeFeatureConfig;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -34,7 +35,7 @@ import java.util.Random;
|
||||||
public class RubberSaplingGenerator extends SaplingGenerator {
|
public class RubberSaplingGenerator extends SaplingGenerator {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected ConfiguredFeature<TreeFeatureConfig, ?> getTreeFeature(Random random, boolean bl) {
|
protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(Random random, boolean bees) {
|
||||||
return WorldGenerator.RUBBER_TREE_FEATURE;
|
return WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, WorldGenerator.RUBBER_TREE_FEATURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,16 @@ import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.intprovider.ConstantIntProvider;
|
import net.minecraft.util.math.intprovider.ConstantIntProvider;
|
||||||
import net.minecraft.util.registry.BuiltinRegistries;
|
import net.minecraft.util.registry.BuiltinRegistries;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryEntry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.gen.GenerationStep;
|
import net.minecraft.world.gen.GenerationStep;
|
||||||
import net.minecraft.world.gen.decorator.BiomePlacementModifier;
|
|
||||||
import net.minecraft.world.gen.decorator.RarityFilterPlacementModifier;
|
|
||||||
import net.minecraft.world.gen.decorator.SquarePlacementModifier;
|
|
||||||
import net.minecraft.world.gen.feature.*;
|
import net.minecraft.world.gen.feature.*;
|
||||||
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
|
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
|
||||||
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
|
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
|
||||||
|
import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier;
|
||||||
|
import net.minecraft.world.gen.placementmodifier.RarityFilterPlacementModifier;
|
||||||
|
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
|
||||||
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
|
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
|
||||||
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
|
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
|
||||||
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;
|
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;
|
||||||
|
@ -100,25 +101,29 @@ public class WorldGenerator {
|
||||||
Identifier patchId = new Identifier("techreborn", "rubber_tree_patch");
|
Identifier patchId = new Identifier("techreborn", "rubber_tree_patch");
|
||||||
|
|
||||||
RUBBER_TREE_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, treeId,
|
RUBBER_TREE_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, treeId,
|
||||||
Feature.TREE.configure(rubber().build())
|
new ConfiguredFeature<>(Feature.TREE, rubber().build())
|
||||||
);
|
);
|
||||||
RUBBER_TREE_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, treeId,
|
RUBBER_TREE_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, treeId,
|
||||||
RUBBER_TREE_FEATURE.withWouldSurviveFilter(TRContent.RUBBER_SAPLING)
|
new PlacedFeature(getEntry(BuiltinRegistries.CONFIGURED_FEATURE, RUBBER_TREE_FEATURE), List.of(
|
||||||
|
PlacedFeatures.wouldSurvive(TRContent.RUBBER_SAPLING)
|
||||||
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
RUBBER_TREE_PATCH_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, patchId,
|
RUBBER_TREE_PATCH_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, patchId,
|
||||||
Feature.RANDOM_PATCH.configure(
|
new ConfiguredFeature<>(Feature.RANDOM_PATCH,
|
||||||
ConfiguredFeatures.createRandomPatchFeatureConfig(6, RUBBER_TREE_PLACED_FEATURE)
|
ConfiguredFeatures.createRandomPatchFeatureConfig(
|
||||||
|
6, getEntry(BuiltinRegistries.PLACED_FEATURE, RUBBER_TREE_PLACED_FEATURE)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
RUBBER_TREE_PATCH_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, patchId,
|
RUBBER_TREE_PATCH_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, patchId,
|
||||||
RUBBER_TREE_PATCH_FEATURE.withPlacement(
|
new PlacedFeature(getEntry(BuiltinRegistries.CONFIGURED_FEATURE, RUBBER_TREE_PATCH_FEATURE), List.of(
|
||||||
RarityFilterPlacementModifier.of(3),
|
RarityFilterPlacementModifier.of(3),
|
||||||
SquarePlacementModifier.of(),
|
SquarePlacementModifier.of(),
|
||||||
PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP,
|
PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP,
|
||||||
BiomePlacementModifier.of()
|
BiomePlacementModifier.of())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,4 +168,8 @@ public class WorldGenerator {
|
||||||
new RubberTreeSpikeDecorator(4, BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()))
|
new RubberTreeSpikeDecorator(4, BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> RegistryEntry<T> getEntry(Registry<T> registry, T value) {
|
||||||
|
return registry.getEntry(registry.getKey(value).orElseThrow()).orElseThrow();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,9 +3,6 @@
|
||||||
"power": 2,
|
"power": 2,
|
||||||
"time": 25,
|
"time": 25,
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
{
|
|
||||||
"item": "minecraft:air"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,11 +33,12 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.12.12",
|
"fabricloader": ">=0.13.3",
|
||||||
"fabric": ">=0.46.1",
|
"fabric": ">=0.46.1",
|
||||||
"reborncore": "*",
|
"reborncore": "*",
|
||||||
"team_reborn_energy": ">=2.2.0",
|
"team_reborn_energy": ">=2.2.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0"
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
|
"minecraft": "~1.18.2-beta.1"
|
||||||
},
|
},
|
||||||
"accessWidener": "techreborn.accesswidener",
|
"accessWidener": "techreborn.accesswidener",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
Loading…
Reference in a new issue