diff --git a/CHANGELOG.md b/CHANGELOG.md index 9816f9d..2640e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,9 +130,24 @@ Initial 1.16.3 release - Recipe advancements. ## [3.0.4] - 2021-03-30 + ### Fixed + - Server not starting due to particle client code loading. ## [3.0.5] - 2021-04-26 + ### Fixed -- Updated architectury api to fix texture stitch bug \ No newline at end of file + +- Updated architectury api to fix texture stitch bug. + +## [3.0.6] - 2021-05-21 + +### Fixed + +- Fabric crazed floating (#72) +- JEI Warning when trying to hide an empty list of items + +### Added + +- LitOnBrazier JEI Category \ No newline at end of file diff --git a/common/src/main/java/com/possible_triangle/brazier/Brazier.java b/common/src/main/java/com/possible_triangle/brazier/Brazier.java index 076b2c0..7b3cecf 100644 --- a/common/src/main/java/com/possible_triangle/brazier/Brazier.java +++ b/common/src/main/java/com/possible_triangle/brazier/Brazier.java @@ -45,7 +45,8 @@ public static void init() { ); if (Boolean.parseBoolean(System.getenv("MC_TESTING"))) { - LifecycleEvent.SERVER_STARTED.register(server -> server.halt(false)); + LOGGER.info("Detected testing environment, stopping server"); + LifecycleEvent.SERVER_STARTED.register(server -> server.halt(true)); } } diff --git a/common/src/main/java/com/possible_triangle/brazier/Content.java b/common/src/main/java/com/possible_triangle/brazier/Content.java index 491240c..cfdf325 100644 --- a/common/src/main/java/com/possible_triangle/brazier/Content.java +++ b/common/src/main/java/com/possible_triangle/brazier/Content.java @@ -11,6 +11,7 @@ import com.possible_triangle.brazier.entity.EntityUtil; import com.possible_triangle.brazier.entity.render.CrazedFlameRenderer; import com.possible_triangle.brazier.entity.render.CrazedRender; +import com.possible_triangle.brazier.item.HiddenItem; import com.possible_triangle.brazier.item.LazySpawnEgg; import com.possible_triangle.brazier.item.LivingTorch; import com.possible_triangle.brazier.particle.FlameParticle; @@ -87,7 +88,10 @@ public class Content { public static final RegistrySupplier SPAWN_POWDER = registerBlock("spawn_powder", SpawnPowder::new, p -> p.tab(CreativeModeTab.TAB_MATERIALS)); public static final RegistrySupplier> CRAZED = ENTITIES.register("crazed", - () -> EntityUtil.buildType(MobCategory.MONSTER, Crazed::new).fireImmune().build("crazed") + () -> EntityUtil.buildType(MobCategory.MONSTER, Crazed::new) + .size(2F, 0.5F) + .fireImmune() + .build("crazed") ); public static final RegistrySupplier CRAZED_SPAWN_EGG = ITEMS.register("crazed_spawn_egg", () -> new LazySpawnEgg( @@ -101,9 +105,11 @@ public class Content { .size(0.6F, 0.6F) .fireImmune() .clientHandler(CrazedFlame::new) - .build("crazed_flame") + .build("crazed_flame") ); + public static final RegistrySupplier ICON = ITEMS.register("icon", HiddenItem::new); + public static RegistrySupplier registerBlock(String name, Supplier supplier, Function props) { RegistrySupplier block = BLOCKS.register(name, supplier); ITEMS.register(name, () -> new BlockItem(block.get(), props.apply(new Item.Properties()))); diff --git a/common/src/main/java/com/possible_triangle/brazier/item/HiddenItem.java b/common/src/main/java/com/possible_triangle/brazier/item/HiddenItem.java new file mode 100644 index 0000000..fab315c --- /dev/null +++ b/common/src/main/java/com/possible_triangle/brazier/item/HiddenItem.java @@ -0,0 +1,12 @@ +package com.possible_triangle.brazier.item; + +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; + +public class HiddenItem extends Item { + + public HiddenItem() { + super(new Properties().tab(CreativeModeTab.TAB_SEARCH)); + } + +} diff --git a/common/src/main/resources/assets/brazier/models/item/icon.json b/common/src/main/resources/assets/brazier/models/item/icon.json new file mode 100644 index 0000000..c92c088 --- /dev/null +++ b/common/src/main/resources/assets/brazier/models/item/icon.json @@ -0,0 +1,3 @@ +{ + "parent": "brazier:block/brazier_lit" +} \ No newline at end of file diff --git a/fabric/src/main/java/com/possible_triangle/brazier/entity/fabric/EntityUtilImpl.java b/fabric/src/main/java/com/possible_triangle/brazier/entity/fabric/EntityUtilImpl.java index 97bbe38..6ab241f 100644 --- a/fabric/src/main/java/com/possible_triangle/brazier/entity/fabric/EntityUtilImpl.java +++ b/fabric/src/main/java/com/possible_triangle/brazier/entity/fabric/EntityUtilImpl.java @@ -14,7 +14,6 @@ public class EntityUtilImpl { - public static Packet createSpawnPacket(Entity entity, String name) { CustomEntityNetworking.notifyClients(entity, name); diff --git a/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/JeiPlugin.java b/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/JeiPlugin.java index f121ca7..d328b1c 100644 --- a/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/JeiPlugin.java +++ b/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/JeiPlugin.java @@ -12,9 +12,12 @@ import mezz.jei.api.runtime.IJeiRuntime; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import java.util.Collections; import java.util.List; import java.util.Optional; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -37,10 +40,10 @@ public void registerRecipes(IRecipeRegistration registration) { .map(ItemStack::new) .forEach(item -> registration.addIngredientInfo(item, items, "description.brazier.brazier-1", "description.brazier.brazier-2")); - // Content.LIVING_TORCH.toOptional() - // .map(item -> new LightOnBrazier.Recipe(Ingredient.of(Content.TORCHES), item)) - // .map(Collections::singleton) - // .ifPresent(recipes -> registration.addRecipes(recipes, LightOnBrazier.UID)); + Content.LIVING_TORCH.toOptional() + .map(item -> new LightOnBrazier.Recipe(Ingredient.of(Content.TORCHES), item)) + .map(Collections::singleton) + .ifPresent(recipes -> registration.addRecipes(recipes, LightOnBrazier.UID)); } @@ -49,16 +52,24 @@ public void onRuntimeAvailable(IJeiRuntime jei) { IIngredientManager ingredientManager = jei.getIngredientManager(); IIngredientType items = ingredientManager.getIngredientType(ItemStack.class); - List hidden = Conditional.disabled() - .map(ItemStack::new) - .collect(Collectors.toList()); + List hidden = Stream.of( + + Conditional.disabled() + .map(ItemStack::new), + + Stream.of(Content.ICON) + .filter(RegistrySupplier::isPresent) + .map(RegistrySupplier::get) + .map(ItemStack::new) + + ).flatMap(Function.identity()).collect(Collectors.toList()); - ingredientManager.removeIngredientsAtRuntime(items, hidden); + if (!hidden.isEmpty()) ingredientManager.removeIngredientsAtRuntime(items, hidden); } @Override public void registerCategories(IRecipeCategoryRegistration registration) { - //registration.addRecipeCategories(new LightOnBrazier(registration.getJeiHelpers().getGuiHelper())); + registration.addRecipeCategories(new LightOnBrazier(registration.getJeiHelpers().getGuiHelper())); } } diff --git a/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/LightOnBrazier.java b/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/LightOnBrazier.java index bb0ffb0..8fbdae2 100644 --- a/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/LightOnBrazier.java +++ b/forge/src/main/java/com/possible_triangle/brazier/forge/compat/jei/LightOnBrazier.java @@ -1,8 +1,6 @@ package com.possible_triangle.brazier.forge.compat.jei; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; import com.possible_triangle.brazier.Brazier; import com.possible_triangle.brazier.Content; import mezz.jei.api.constants.VanillaTypes; @@ -11,26 +9,27 @@ import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.language.I18n; -import net.minecraft.client.resources.model.BakedModel; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; public class LightOnBrazier implements IRecipeCategory { public static final ResourceLocation UID = new ResourceLocation(Brazier.MOD_ID, "light_on_brazier"); + private static List BRAZIER_LIST = null; + + public static List getBrazier() { + if (BRAZIER_LIST == null) BRAZIER_LIST = Collections.singletonList(new ItemStack(Content.BRAZIER.get())); + return BRAZIER_LIST; + } private static final int HEIGHT = 32; private static final int WIDTH = 96; @@ -41,16 +40,10 @@ public class LightOnBrazier implements IRecipeCategory { public LightOnBrazier(IGuiHelper guiHelper) { this.background = guiHelper.createBlankDrawable(WIDTH, HEIGHT); - this.icon = guiHelper.createDrawableIngredient(new ItemStack(getBrazierBlock())); + this.icon = guiHelper.createDrawableIngredient(new ItemStack(Content.ICON.get())); this.display = I18n.get("category." + UID.getNamespace() + "." + UID.getPath()); } - private Block getBrazierBlock() { - return Content.BRAZIER.toOptional() - .map(b -> (Block) b) - .orElse(Blocks.SOUL_CAMPFIRE); - } - @Override public ResourceLocation getUid() { return UID; @@ -79,21 +72,27 @@ public IDrawable getIcon() { @Override public void setIngredients(Recipe recipe, IIngredients ingredients) { List items = Arrays.asList(recipe.input.getItems()); - ingredients.setInputs(VanillaTypes.ITEM, items); + ingredients.setInputLists(VanillaTypes.ITEM, Stream.of(items, getBrazier()).collect(Collectors.toList())); ingredients.setOutput(VanillaTypes.ITEM, new ItemStack(recipe.output)); } @Override public void setRecipe(IRecipeLayout layout, Recipe recipe, IIngredients ingredients) { - layout.getItemStacks().init(0, true, 10, HEIGHT / 2 - 9); - layout.getItemStacks().set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0)); + List> inputs = ingredients.getInputs(VanillaTypes.ITEM); + + layout.getItemStacks().init(0, true, WIDTH / 2 - 9, HEIGHT / 2 - 9); + layout.getItemStacks().set(0, new ItemStack(Content.ICON.get())); + + layout.getItemStacks().init(1, true, 10, HEIGHT / 2 - 9); + layout.getItemStacks().set(1, inputs.get(0)); - layout.getItemStacks().init(1, false, WIDTH - 25, HEIGHT / 2 -9); - layout.getItemStacks().set(1, ingredients.getOutputs(VanillaTypes.ITEM).get(0)); + layout.getItemStacks().init(2, false, WIDTH - 25, HEIGHT / 2 - 9); + layout.getItemStacks().set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0)); } @Override public void draw(Recipe recipe, PoseStack matrizes, double mouseX, double mouseY) { + /* matrizes.pushPose(); matrizes.translate(WIDTH / 2F - 9, HEIGHT / 2F - 11, 0); @@ -111,6 +110,7 @@ public void draw(Recipe recipe, PoseStack matrizes, double mouseX, double mouseY renderer.getModelRenderer().renderModel(matrizes.last(), buffer, state, model, 1F, 1F, 1F, 15, 15); matrizes.popPose(); + */ } public static class Recipe { diff --git a/forge/src/main/java/com/possible_triangle/brazier/forge/data/providers/Items.java b/forge/src/main/java/com/possible_triangle/brazier/forge/data/providers/Items.java index 4e067b7..208eda4 100644 --- a/forge/src/main/java/com/possible_triangle/brazier/forge/data/providers/Items.java +++ b/forge/src/main/java/com/possible_triangle/brazier/forge/data/providers/Items.java @@ -37,11 +37,15 @@ protected void registerModels() { .map(ResourceLocation::getPath) .ifPresent(i -> singleTexture(i, mcLoc("item/generated"), "layer0", modLoc("block/" + i))); - Content.CRAZED_SPAWN_EGG.toOptional() .map(ForgeRegistryEntry::getRegistryName) .map(ResourceLocation::getPath) .ifPresent(i -> withExistingParent(i, mcLoc("item/template_spawn_egg"))); + Content.ICON.toOptional() + .map(ForgeRegistryEntry::getRegistryName) + .map(ResourceLocation::getPath) + .ifPresent(i -> withExistingParent(i, modLoc("block/brazier_lit"))); + } } diff --git a/gradle.properties b/gradle.properties index 2603e49..3128f89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ minecraft_version=1.16.5 # Mod archives_base_name=brazier -mod_version=3.0.5 +mod_version=3.0.6 maven_group=com.possible_triangle # Architectury