mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-27 13:38:34 +01:00
Compare commits
No commits in common. "f3e34143cf943a72bc150221f2a3c4208b55bcaa" and "b2e7a3f46763bd786610365712b37d9bf87fc6ec" have entirely different histories.
f3e34143cf
...
b2e7a3f467
20 changed files with 76 additions and 93 deletions
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.naturesaura;
|
package de.ellpeck.naturesaura;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||||
|
@ -127,7 +128,6 @@ public final class Helper {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
poseStack.translate(x, y, 0);
|
poseStack.translate(x, y, 0);
|
||||||
poseStack.scale(scale, scale, scale);
|
poseStack.scale(scale, scale, scale);
|
||||||
graphics.setColor(1, 1, 1, 1);
|
|
||||||
graphics.renderItem(stack, 0, 0);
|
graphics.renderItem(stack, 0, 0);
|
||||||
graphics.renderItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null);
|
graphics.renderItemDecorations(Minecraft.getInstance().font, stack, 0, 0, null);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
@ -373,5 +373,4 @@ public final class Helper {
|
||||||
player.level().playSound(null, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.65F, 1F);
|
player.level().playSound(null, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.65F, 1F);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,15 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||||
import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects;
|
import de.ellpeck.naturesaura.chunk.effect.DrainSpotEffects;
|
||||||
import de.ellpeck.naturesaura.compat.Compat;
|
import de.ellpeck.naturesaura.compat.Compat;
|
||||||
import de.ellpeck.naturesaura.events.CommonEvents;
|
import de.ellpeck.naturesaura.events.CommonEvents;
|
||||||
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.proxy.ClientProxy;
|
import de.ellpeck.naturesaura.proxy.ClientProxy;
|
||||||
import de.ellpeck.naturesaura.proxy.IProxy;
|
import de.ellpeck.naturesaura.proxy.IProxy;
|
||||||
import de.ellpeck.naturesaura.proxy.ServerProxy;
|
import de.ellpeck.naturesaura.proxy.ServerProxy;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
@ -29,6 +32,13 @@ public final class NaturesAura {
|
||||||
public static final String MOD_NAME = "Nature's Aura";
|
public static final String MOD_NAME = "Nature's Aura";
|
||||||
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger(NaturesAura.MOD_NAME);
|
public static final Logger LOGGER = LogManager.getLogger(NaturesAura.MOD_NAME);
|
||||||
|
// TODO creative tab
|
||||||
|
/* public static final CreativeModeTab CREATIVE_TAB = new CreativeModeTab(NaturesAura.MOD_ID) {
|
||||||
|
@Override
|
||||||
|
public ItemStack makeIcon() {
|
||||||
|
return new ItemStack(ModItems.GOLD_LEAF);
|
||||||
|
}
|
||||||
|
};*/
|
||||||
public static NaturesAura instance;
|
public static NaturesAura instance;
|
||||||
// this causes a classloading issue if it's not wrapped like this
|
// this causes a classloading issue if it's not wrapped like this
|
||||||
@SuppressWarnings("Convert2MethodRef")
|
@SuppressWarnings("Convert2MethodRef")
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
||||||
if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) {
|
if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) {
|
||||||
var saplingStack = new ItemStack(level.getBlockState(pos).getBlock());
|
var saplingStack = new ItemStack(level.getBlockState(pos).getBlock());
|
||||||
if (!saplingStack.isEmpty()) {
|
if (!saplingStack.isEmpty()) {
|
||||||
for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, (Level) level)) {
|
for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null)) {
|
||||||
if (recipe.saplingType.test(saplingStack)) {
|
if (recipe.saplingType.test(saplingStack)) {
|
||||||
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
|
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
|
||||||
var toPick = new MutableObject<BlockEntityWoodStand>();
|
var toPick = new MutableObject<BlockEntityWoodStand>();
|
||||||
|
@ -114,5 +114,4 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
||||||
public void registerTESR() {
|
public void registerTESR() {
|
||||||
BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new);
|
BlockEntityRenderers.register(ModBlockEntities.WOOD_STAND, RenderWoodStand::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class Multiblocks {
|
||||||
// try-catch to prevent blocks that need to have been placed crashing here
|
// try-catch to prevent blocks that need to have been placed crashing here
|
||||||
try {
|
try {
|
||||||
var stack = new ItemStack(state.getBlock());
|
var stack = new ItemStack(state.getBlock());
|
||||||
return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, level).stream().anyMatch(r -> r.saplingType.test(stack));
|
return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class BlockEntityAnimalSpawner extends BlockEntityImpl implements ITickab
|
||||||
var items = this.level.getEntitiesOfClass(ItemEntity.class,
|
var items = this.level.getEntitiesOfClass(ItemEntity.class,
|
||||||
new AABB(this.worldPosition).inflate(2));
|
new AABB(this.worldPosition).inflate(2));
|
||||||
|
|
||||||
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE, null, this.level)) {
|
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ANIMAL_SPAWNER_TYPE, null, null)) {
|
||||||
if (recipe.ingredients.length != items.size())
|
if (recipe.ingredients.length != items.size())
|
||||||
continue;
|
continue;
|
||||||
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
|
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
|
||||||
|
|
|
@ -198,7 +198,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
|
||||||
}
|
}
|
||||||
|
|
||||||
private AltarRecipe getRecipeForInput(ItemStack input) {
|
private AltarRecipe getRecipeForInput(ItemStack input) {
|
||||||
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ALTAR_TYPE, null, this.level)) {
|
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ALTAR_TYPE, null, null)) {
|
||||||
if (recipe.input.test(input)) {
|
if (recipe.input.test(input)) {
|
||||||
if (recipe.catalyst == Ingredient.EMPTY)
|
if (recipe.catalyst == Ingredient.EMPTY)
|
||||||
return recipe;
|
return recipe;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
|
||||||
}
|
}
|
||||||
|
|
||||||
private OfferingRecipe getRecipe(ItemStack input) {
|
private OfferingRecipe getRecipe(ItemStack input) {
|
||||||
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.OFFERING_TYPE, null, this.level))
|
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.OFFERING_TYPE, null, null))
|
||||||
if (recipe.input.test(input))
|
if (recipe.input.test(input))
|
||||||
return recipe;
|
return recipe;
|
||||||
return null;
|
return null;
|
||||||
|
@ -139,5 +139,4 @@ public class BlockEntityOfferingTable extends BlockEntityImpl implements ITickab
|
||||||
public IItemHandlerModifiable getItemHandler() {
|
public IItemHandlerModifiable getItemHandler() {
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class PatchouliCompat implements ICompat {
|
public class PatchouliCompat implements ICompat {
|
||||||
|
|
||||||
public static final ResourceLocation BOOK = new ResourceLocation(NaturesAura.MOD_ID, "book");
|
private static final ResourceLocation BOOK = new ResourceLocation(NaturesAura.MOD_ID, "book");
|
||||||
private static final Map<ResourceLocation, IMultiblock> MULTIBLOCKS = new HashMap<>();
|
private static final Map<ResourceLocation, IMultiblock> MULTIBLOCKS = new HashMap<>();
|
||||||
|
|
||||||
public static void addPatchouliMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers) {
|
public static void addPatchouliMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers) {
|
||||||
|
|
|
@ -269,7 +269,7 @@ public class ClientEvents {
|
||||||
stack.pushPose();
|
stack.pushPose();
|
||||||
|
|
||||||
var color = container.getAuraColor();
|
var color = container.getAuraColor();
|
||||||
graphics.setColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
||||||
if (width < 80)
|
if (width < 80)
|
||||||
graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
graphics.blit(ClientEvents.OVERLAYS, x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
|
@ -282,7 +282,7 @@ public class ClientEvents {
|
||||||
graphics.drawString(mc.font, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color, true);
|
graphics.drawString(mc.font, s, conf == 1 ? x / scale : (x + 80) / scale - mc.font.width(s), (y - 7) / scale, color, true);
|
||||||
stack.popPose();
|
stack.popPose();
|
||||||
|
|
||||||
graphics.setColor(1F, 1F, 1F, 1);
|
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
|
||||||
stack.pushPose();
|
stack.pushPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ public class ClientEvents {
|
||||||
int conf = ModConfig.instance.auraBarLocation.get();
|
int conf = ModConfig.instance.auraBarLocation.get();
|
||||||
if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) {
|
if (!mc.options.renderDebug && (conf != 2 || !(mc.screen instanceof ChatScreen))) {
|
||||||
var color = IAuraType.forLevel(mc.level).getColor();
|
var color = IAuraType.forLevel(mc.level).getColor();
|
||||||
graphics.setColor((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1);
|
RenderSystem.setShaderColor((color >> 16 & 0xFF) / 255F, (color >> 8 & 0xFF) / 255F, (color & 0xFF) / 255F, 1);
|
||||||
|
|
||||||
var totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.blockPosition(), 35);
|
var totalAmount = IAuraChunk.triangulateAuraInArea(mc.level, mc.player.blockPosition(), 35);
|
||||||
var totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
|
var totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
|
||||||
|
@ -417,7 +417,7 @@ public class ClientEvents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
graphics.setColor(1F, 1F, 1F, 1);
|
RenderSystem.setShaderColor(1F, 1F, 1F, 1);
|
||||||
stack.popPose();
|
stack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ public class ClientEvents {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawContainerInfo(GuiGraphics graphics, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) {
|
private void drawContainerInfo(GuiGraphics graphics, int stored, int max, int color, Minecraft mc, Window res, int yOffset, String name, String textBelow) {
|
||||||
graphics.setColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
RenderSystem.setShaderColor((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
||||||
|
|
||||||
var x = res.getGuiScaledWidth() / 2 - 40;
|
var x = res.getGuiScaledWidth() / 2 - 40;
|
||||||
var y = res.getGuiScaledHeight() / 2 + yOffset;
|
var y = res.getGuiScaledHeight() / 2 + yOffset;
|
||||||
|
@ -459,5 +459,4 @@ public class ClientEvents {
|
||||||
if (textBelow != null)
|
if (textBelow != null)
|
||||||
graphics.drawString(mc.font, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color, true);
|
graphics.drawString(mc.font, textBelow, x + 40 - mc.font.width(textBelow) / 2F, y + 7, color, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,17 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomCreativeTab;
|
|
||||||
import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
||||||
import net.minecraft.client.color.item.ItemColor;
|
import net.minecraft.client.color.item.ItemColor;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
|
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.ClipContext;
|
import net.minecraft.world.level.ClipContext;
|
||||||
|
@ -27,9 +28,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
import java.util.List;
|
public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICustomItemModel {
|
||||||
|
|
||||||
public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICustomItemModel, ICustomCreativeTab {
|
|
||||||
|
|
||||||
public ItemAuraBottle(Item emptyBottle) {
|
public ItemAuraBottle(Item emptyBottle) {
|
||||||
super("aura_bottle");
|
super("aura_bottle");
|
||||||
|
@ -53,10 +52,17 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICu
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO aura bottle creative
|
||||||
public List<ItemStack> getCreativeTabItems() {
|
/* @Override
|
||||||
return NaturesAuraAPI.AURA_TYPES.values().stream().map(t -> ItemAuraBottle.setType(new ItemStack(this), t)).toList();
|
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
|
||||||
}
|
if (this.allowedIn(tab)) {
|
||||||
|
for (var type : NaturesAuraAPI.AURA_TYPES.values()) {
|
||||||
|
var stack = new ItemStack(this);
|
||||||
|
ItemAuraBottle.setType(stack, type);
|
||||||
|
items.add(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getName(ItemStack stack) {
|
public Component getName(ItemStack stack) {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer;
|
import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer;
|
||||||
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
||||||
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomCreativeTab;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
|
@ -27,10 +26,8 @@ import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ItemAuraCache extends ItemImpl implements ITrinketItem, ICustomCreativeTab {
|
public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
||||||
|
|
||||||
private final int capacity;
|
private final int capacity;
|
||||||
|
|
||||||
|
@ -64,17 +61,19 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem, ICustomCrea
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO creative tabs for items with variations
|
||||||
public List<ItemStack> getCreativeTabItems() {
|
/* @Override
|
||||||
var ret = new ArrayList<ItemStack>();
|
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
|
||||||
ret.add(new ItemStack(this));
|
if (this.allowedIn(tab)) {
|
||||||
var full = new ItemStack(this);
|
items.add(new ItemStack(this));
|
||||||
full.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).ifPresent(container -> {
|
|
||||||
container.storeAura(container.getMaxAura(), false);
|
var stack = new ItemStack(this);
|
||||||
ret.add(full);
|
stack.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).ifPresent(container -> {
|
||||||
});
|
container.storeAura(container.getMaxAura(), false);
|
||||||
return ret;
|
items.add(stack);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBarVisible(ItemStack stack) {
|
public boolean isBarVisible(ItemStack stack) {
|
||||||
|
|
|
@ -3,19 +3,18 @@ package de.ellpeck.naturesaura.items;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
|
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
|
||||||
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomCreativeTab;
|
|
||||||
import net.minecraft.client.color.item.ItemColor;
|
import net.minecraft.client.color.item.ItemColor;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import java.util.List;
|
public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
|
||||||
|
|
||||||
public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem, ICustomCreativeTab {
|
|
||||||
|
|
||||||
public ItemEffectPowder() {
|
public ItemEffectPowder() {
|
||||||
super("effect_powder");
|
super("effect_powder");
|
||||||
|
@ -47,10 +46,17 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem, I
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO effect powder creative tab
|
||||||
public List<ItemStack> getCreativeTabItems() {
|
/* @Override
|
||||||
return NaturesAuraAPI.EFFECT_POWDERS.keySet().stream().map(e -> ItemEffectPowder.setEffect(new ItemStack(this), e)).toList();
|
public void fillItemCategory(CreativeModeTab tab, NonNullList<ItemStack> items) {
|
||||||
}
|
if (this.allowedIn(tab)) {
|
||||||
|
for (var effect : NaturesAuraAPI.EFFECT_POWDERS.keySet()) {
|
||||||
|
var stack = new ItemStack(this);
|
||||||
|
ItemEffectPowder.setEffect(stack, effect);
|
||||||
|
items.add(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getName(ItemStack stack) {
|
public Component getName(ItemStack stack) {
|
||||||
|
@ -62,5 +68,4 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem, I
|
||||||
public ItemColor getItemColor() {
|
public ItemColor getItemColor() {
|
||||||
return (stack, tintIndex) -> NaturesAuraAPI.EFFECT_POWDERS.getOrDefault(ItemEffectPowder.getEffect(stack), 0xFFFFFF);
|
return (stack, tintIndex) -> NaturesAuraAPI.EFFECT_POWDERS.getOrDefault(ItemEffectPowder.getEffect(stack), 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package de.ellpeck.naturesaura.reg;
|
|
||||||
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ICustomCreativeTab {
|
|
||||||
|
|
||||||
List<ItemStack> getCreativeTabItems();
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,10 +7,13 @@ import de.ellpeck.naturesaura.blocks.*;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAuraBloom;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityEnderCrate;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
||||||
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
|
|
||||||
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
|
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
|
||||||
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
||||||
import de.ellpeck.naturesaura.entities.*;
|
import de.ellpeck.naturesaura.entities.*;
|
||||||
|
import de.ellpeck.naturesaura.gen.LevelGenAncientTree;
|
||||||
|
import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
|
||||||
|
import de.ellpeck.naturesaura.gen.LevelGenNetherWartMushroom;
|
||||||
|
import de.ellpeck.naturesaura.gen.ModFeatures;
|
||||||
import de.ellpeck.naturesaura.gui.ContainerEnderCrate;
|
import de.ellpeck.naturesaura.gui.ContainerEnderCrate;
|
||||||
import de.ellpeck.naturesaura.gui.ModContainers;
|
import de.ellpeck.naturesaura.gui.ModContainers;
|
||||||
import de.ellpeck.naturesaura.items.*;
|
import de.ellpeck.naturesaura.items.*;
|
||||||
|
@ -19,13 +22,12 @@ import de.ellpeck.naturesaura.potion.ModPotions;
|
||||||
import de.ellpeck.naturesaura.potion.PotionBreathless;
|
import de.ellpeck.naturesaura.potion.PotionBreathless;
|
||||||
import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.MobCategory;
|
import net.minecraft.world.entity.MobCategory;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.ArmorItem;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
@ -39,16 +41,14 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegisterEvent;
|
import net.minecraftforge.registries.RegisterEvent;
|
||||||
import vazkii.patchouli.api.PatchouliAPI;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public final class ModRegistry {
|
public final class ModRegistry {
|
||||||
|
|
||||||
// we use a list so that the creative tab maintains addition order
|
public static final Set<IModItem> ALL_ITEMS = new HashSet<>();
|
||||||
public static final List<IModItem> ALL_ITEMS = new ArrayList<>();
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void register(RegisterEvent event) {
|
public static void register(RegisterEvent event) {
|
||||||
|
@ -276,7 +276,6 @@ public final class ModRegistry {
|
||||||
Helper.populateObjectHolders(ModEntities.class, event.getForgeRegistry());
|
Helper.populateObjectHolders(ModEntities.class, event.getForgeRegistry());
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
event.register(ForgeRegistries.Keys.FEATURES, h -> {
|
event.register(ForgeRegistries.Keys.FEATURES, h -> {
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_bloom"), new LevelGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false));
|
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_bloom"), new LevelGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false));
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_cactus"), new LevelGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false));
|
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_cactus"), new LevelGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false));
|
||||||
|
@ -287,7 +286,6 @@ public final class ModRegistry {
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom());
|
h.register(new ResourceLocation(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom());
|
||||||
Helper.populateObjectHolders(ModFeatures.class, event.getForgeRegistry());
|
Helper.populateObjectHolders(ModFeatures.class, event.getForgeRegistry());
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
event.register(ForgeRegistries.Keys.RECIPE_TYPES, h -> {
|
event.register(ForgeRegistries.Keys.RECIPE_TYPES, h -> {
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, "altar"), ModRecipes.ALTAR_TYPE);
|
h.register(new ResourceLocation(NaturesAura.MOD_ID, "altar"), ModRecipes.ALTAR_TYPE);
|
||||||
|
@ -303,25 +301,6 @@ public final class ModRegistry {
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"), ModRecipes.TREE_RITUAL_SERIALIZER);
|
h.register(new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"), ModRecipes.TREE_RITUAL_SERIALIZER);
|
||||||
CraftingHelper.register(new EnabledCondition.Serializer());
|
CraftingHelper.register(new EnabledCondition.Serializer());
|
||||||
});
|
});
|
||||||
|
|
||||||
event.register(BuiltInRegistries.CREATIVE_MODE_TAB.key(), h -> {
|
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, "tab"), CreativeModeTab.builder()
|
|
||||||
.title(Component.translatable("item_group." + NaturesAura.MOD_ID + ".tab"))
|
|
||||||
.icon(() -> new ItemStack(ModItems.GOLD_LEAF))
|
|
||||||
.displayItems((params, output) -> {
|
|
||||||
output.accept(PatchouliAPI.get().getBookStack(PatchouliCompat.BOOK));
|
|
||||||
ModRegistry.ALL_ITEMS.forEach(i -> {
|
|
||||||
if (i instanceof ICustomCreativeTab c) {
|
|
||||||
output.acceptAll(c.getCreativeTabItems());
|
|
||||||
} else if (i instanceof ItemLike l) {
|
|
||||||
if (l.asItem() != Items.AIR)
|
|
||||||
output.accept(l);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
@ -353,5 +332,4 @@ public final class ModRegistry {
|
||||||
for (var item : items)
|
for (var item : items)
|
||||||
helper.register(new ResourceLocation(NaturesAura.MOD_ID, ((IModItem) item).getBaseName()), item);
|
helper.register(new ResourceLocation(NaturesAura.MOD_ID, ((IModItem) item).getBaseName()), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"item_group.naturesaura.tab": "Nature's Aura",
|
"itemGroup.naturesaura": "Nature's Aura",
|
||||||
"block.naturesaura.ancient_log": "Ancient Log",
|
"block.naturesaura.ancient_log": "Ancient Log",
|
||||||
"block.naturesaura.ancient_bark": "Ancient Bark",
|
"block.naturesaura.ancient_bark": "Ancient Bark",
|
||||||
"block.naturesaura.ancient_leaves": "Ancient Leaves",
|
"block.naturesaura.ancient_leaves": "Ancient Leaves",
|
||||||
|
|
Loading…
Reference in a new issue