Compare commits

..

No commits in common. "3f356896b74dd085a66a8465991ce572df35efa2" and "817797ad3af9216e98212ea104937879d8e32e21" have entirely different histories.

19 changed files with 113 additions and 115 deletions

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-03-09T11:39:13.7182875 Recipes // 1.20.4 2024-03-08T16:41:19.1669609 Recipes
4d3128b37a7153882a9324cda49b5069207561c5 data/actuallyadditions/recipes/atomic_reconstructor.json 4d3128b37a7153882a9324cda49b5069207561c5 data/actuallyadditions/recipes/atomic_reconstructor.json
b0367f5012651764931e8b8fd0c5bcca4e8614c0 data/actuallyadditions/recipes/battery_box.json b0367f5012651764931e8b8fd0c5bcca4e8614c0 data/actuallyadditions/recipes/battery_box.json
fe704716268e01ca8aeeb92196d9f660b9e08640 data/actuallyadditions/recipes/black_quartz_brick_slab.json fe704716268e01ca8aeeb92196d9f660b9e08640 data/actuallyadditions/recipes/black_quartz_brick_slab.json
@ -32,7 +32,6 @@ e2f9ec08306500d981cad22bc2cf7925712d08de data/actuallyadditions/recipes/fermenti
9c1e45adf3ad5ef64044ac111ef1ac2a57a498d0 data/actuallyadditions/recipes/firework_box.json 9c1e45adf3ad5ef64044ac111ef1ac2a57a498d0 data/actuallyadditions/recipes/firework_box.json
2391a543a2e43ff5b87234a71d9bd339f9fa3e9c data/actuallyadditions/recipes/fluid_collector.json 2391a543a2e43ff5b87234a71d9bd339f9fa3e9c data/actuallyadditions/recipes/fluid_collector.json
2614b2743071b86fd6d2cb92063c3e95a959e52c data/actuallyadditions/recipes/fluid_placer.json 2614b2743071b86fd6d2cb92063c3e95a959e52c data/actuallyadditions/recipes/fluid_placer.json
f9fe1f2a3e4a73f9cfd4cda43a19f4730f3f6963 data/actuallyadditions/recipes/greenhouse_glass.json
ff81da8a0f6632779414c0512100696a11771814 data/actuallyadditions/recipes/hopping_item_interface.json ff81da8a0f6632779414c0512100696a11771814 data/actuallyadditions/recipes/hopping_item_interface.json
48d208a519aaa44547dbca19a57cc66e4e0ab46c data/actuallyadditions/recipes/iron_casing.json 48d208a519aaa44547dbca19a57cc66e4e0ab46c data/actuallyadditions/recipes/iron_casing.json
5d0c6fc708579565c21e0992796ba6f403473ed7 data/actuallyadditions/recipes/item_interface.json 5d0c6fc708579565c21e0992796ba6f403473ed7 data/actuallyadditions/recipes/item_interface.json

View file

@ -1,24 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"E": {
"item": "actuallyadditions:empowered_palis_crystal"
},
"G": {
"tag": "forge:glass"
},
"S": {
"tag": "minecraft:saplings"
}
},
"pattern": [
"GSG",
"SES",
"GSG"
],
"result": {
"count": 2,
"item": "actuallyadditions:greenhouse_glass"
}
}

View file

@ -314,13 +314,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
.define('I', ActuallyBlocks.IRON_CASING.getItem()) .define('I', ActuallyBlocks.IRON_CASING.getItem())
.save(recipeOutput); .save(recipeOutput);
// Greenhouse glass
Recipe.shaped(ActuallyBlocks.GREENHOUSE_GLASS.getItem(), 2)
.pattern("GSG", "SES", "GSG")
.define('G', Tags.Items.GLASS)
.define('S', ItemTags.SAPLINGS)
.define('E', ActuallyItems.EMPOWERED_PALIS_CRYSTAL)
.save(recipeOutput);
} }
public static class Recipe { public static class Recipe {

View file

@ -35,17 +35,16 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
@Override @Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (world.isClientSide) { if (!world.isClientSide) {
return InteractionResult.SUCCESS;
} else {
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos); TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos);
if (tile != null) { if (tile != null) {
if (!this.tryUseItemOnTank(player, hand, tile.tank)) { if (!this.tryUseItemOnTank(player, hand, tile.tank)) {
player.openMenu(tile, pos); player.openMenu(tile, pos);
} }
} }
return InteractionResult.CONSUME; return InteractionResult.PASS;
} }
return super.use(state, world, pos, player, hand, hit);
} }
@Nullable @Nullable

View file

@ -45,6 +45,7 @@ import static net.minecraft.world.level.block.state.properties.BlockStatePropert
public class BlockPoweredFurnace extends DirectionalBlock.Container { public class BlockPoweredFurnace extends DirectionalBlock.Container {
public BlockPoweredFurnace() { public BlockPoweredFurnace() {
// TODO: [port] confirm this is correct for light level... Might not be reactive.
super(ActuallyBlocks.defaultPickProps().randomTicks().lightLevel(state -> state.getValue(LIT) super(ActuallyBlocks.defaultPickProps().randomTicks().lightLevel(state -> state.getValue(LIT)
? 12 ? 12
: 0)); : 0));

View file

@ -165,7 +165,7 @@ public class ClientEvents {
@SubscribeEvent @SubscribeEvent
public void onGameOverlay(RenderGuiOverlayEvent.Post event) { public void onGameOverlay(RenderGuiOverlayEvent.Post event) {
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
if (event.getOverlay() == GuiOverlayManager.findOverlay(new ResourceLocation("portal")) && minecraft.screen == null) { //ALL if (event.getOverlay() == GuiOverlayManager.findOverlay(new ResourceLocation("crosshair")) && minecraft.screen == null) { //ALL
GuiGraphics guiGraphics = event.getGuiGraphics(); GuiGraphics guiGraphics = event.getGuiGraphics();
Player player = minecraft.player; Player player = minecraft.player;
if (player == null) { if (player == null) {
@ -202,7 +202,7 @@ public class ClientEvents {
if (!stack.isEmpty() && stack.getItem() == CommonConfig.Other.redstoneConfigureItem) { if (!stack.isEmpty() && stack.getItem() == CommonConfig.Other.redstoneConfigureItem) {
expl = ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem"); expl = ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem");
} else { } else {
expl = ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", I18n.get(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId())); expl = ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", I18n.get(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId()));
} }
guiGraphics.drawString(font, expl, (int) (event.getWindow().getGuiScaledWidth() / 2f + 5), (int) (event.getWindow().getGuiScaledHeight() / 2f + 15), 0xFFFFFF); guiGraphics.drawString(font, expl, (int) (event.getWindow().getGuiScaledWidth() / 2f + 5), (int) (event.getWindow().getGuiScaledHeight() / 2f + 15), 0xFFFFFF);
} }

View file

@ -81,7 +81,7 @@ public class ContainerCoffeeMachine extends AbstractContainerMenu {
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
else if (slot >= inventoryStart) { else if (slot >= inventoryStart) {
//Shift from Inventory //Shift from Inventory
if (newStack.getItem() == ActuallyItems.EMPTY_CUP.get()) { if (newStack.getItem() == ActuallyItems.COFFEE_CUP.get()) {
if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }

View file

@ -71,7 +71,7 @@ public class EnergyDisplay {
} }
if (this.drawTextNextTo) { if (this.drawTextNextTo) {
guiGraphics.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, 0xFFFFFF); //this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
} }
} }
@ -80,8 +80,8 @@ public class EnergyDisplay {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
List<Component> text = new ArrayList<>(); List<Component> text = new ArrayList<>();
text.add(this.getOverlayText()); text.add(Component.literal(this.getOverlayText()));
guiGraphics.renderComponentTooltip(mc.font, text, mouseX, mouseY); guiGraphics.renderComponentTooltip(mc.font, text, mouseX, mouseY); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText
} }
} }
@ -93,10 +93,11 @@ public class EnergyDisplay {
: 85); : 85);
} }
private Component getOverlayText() { private String getOverlayText() {
NumberFormat format = NumberFormat.getInstance(); NumberFormat format = NumberFormat.getInstance();
return Component.translatable("misc.actuallyadditions.power_long", return Component.translatable("misc.actuallyadditions.power_long",
format.format(this.rfReference.getEnergyStored()), format.format(this.rfReference.getEnergyStored()),
format.format(this.rfReference.getMaxEnergyStored())); format.format(this.rfReference.getMaxEnergyStored()))
.getString();
} }
} }

View file

@ -10,13 +10,12 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiGraphics;
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.util.FastColor;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.api.distmarker.OnlyIn;
@ -89,35 +88,29 @@ public class FluidDisplay {
FluidStack stack = this.fluidReference.getFluid(); FluidStack stack = this.fluidReference.getFluid();
Fluid fluid = stack.getFluid(); Fluid fluid = stack.getFluid();
if (stack != null && !stack.isEmpty() && fluid != null) { if (this.resLoc == null || this.oldFluid != stack.getFluid()) {
IClientFluidTypeExtensions fluidTypeExtension = IClientFluidTypeExtensions.of(fluid); this.oldFluid = stack.getFluid();
int color = fluidTypeExtension.getTintColor(stack);
float red = (float)(FastColor.ARGB32.red(color) / 255.0);
float green = (float)(FastColor.ARGB32.green(color) / 255.0);
float blue = (float)(FastColor.ARGB32.blue(color) / 255.0);
float alpha = (float)(FastColor.ARGB32.alpha(color) / 255.0);
if (this.resLoc == null || this.oldFluid != stack.getFluid()) { if (fluid != null && IClientFluidTypeExtensions.of(fluid).getStillTexture() != null) {
this.oldFluid = stack.getFluid(); this.resLoc = new ResourceLocation(IClientFluidTypeExtensions.of(fluid).getStillTexture().getNamespace(), "textures/" + IClientFluidTypeExtensions.of(fluid).getStillTexture().getPath() + ".png");
if (fluidTypeExtension.getStillTexture() != null) {
this.resLoc = new ResourceLocation(fluidTypeExtension.getStillTexture().getNamespace(), "textures/" + IClientFluidTypeExtensions.of(fluid).getStillTexture().getPath() + ".png");
}
} }
}
if (this.resLoc != null) { if (stack != null && fluid != null && this.resLoc != null) {
RenderSystem.setShaderColor(red, green, blue, alpha); // GlStateManager._pushMatrix();
RenderSystem.enableBlend(); GlStateManager._enableBlend();
RenderSystem.blendFuncSeparate(770, 771, 1, 0); // GlStateManager._disableAlphaTest();
int i = this.fluidReference.getFluid().getAmount() * 83 / this.fluidReference.getCapacity(); GlStateManager._blendFuncSeparate(770, 771, 1, 0);
guiGraphics.blit(this.resLoc, barX + 1, barY + 84 - i, 0, 0, 16, i, 16, 512); int i = this.fluidReference.getFluid().getAmount() * 83 / this.fluidReference.getCapacity();
RenderSystem.disableBlend(); guiGraphics.blit(this.resLoc, barX + 1, barY + 84 - i, 0, 0, 16, i, 16, 512);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); //drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512);
} GlStateManager._disableBlend();
// GlStateManager._enableAlphaTest();
// GlStateManager._popMatrix();
}
if (this.drawTextNextTo) { if (this.drawTextNextTo) {
guiGraphics.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, 0xFFFFFF, false); guiGraphics.drawString(mc.font, Component.literal(this.getOverlayText()), barX + 25, barY + 78, 0xFFFFFF, false);
}
} }
} }
@ -128,17 +121,17 @@ public class FluidDisplay {
? 93 ? 93
: 85)) { : 85)) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
guiGraphics.renderComponentTooltip(mc.font, Collections.singletonList(this.getOverlayText()), mouseX, mouseY); guiGraphics.renderComponentTooltip(mc.font, Collections.singletonList(Component.literal(this.getOverlayText())), mouseX, mouseY); //TODO: Check if this is correct, used to call GuiUtils.drawHoveringText
} }
} }
private Component getOverlayText() { private String getOverlayText() {
NumberFormat format = NumberFormat.getInstance(); NumberFormat format = NumberFormat.getInstance();
FluidStack stack = this.fluidReference.getFluid(); FluidStack stack = this.fluidReference.getFluid();
String cap = format.format(this.fluidReference.getCapacity()); String cap = format.format(this.fluidReference.getCapacity());
return stack.isEmpty() return stack.isEmpty()
? Component.literal("0/" + cap + " mB") ? "0/" + cap + " mB"
: Component.literal(format.format(this.fluidReference.getFluidAmount()) + (drawCapacityInTooltip?"/" + cap + " mB ":" mB ")).append(stack.getDisplayName()); : format.format(this.fluidReference.getFluidAmount()) + (drawCapacityInTooltip?"/" + cap + " mB ":" mB ") + stack.getDisplayName().getString();
} }
public static class DummyTank implements IFluidTank { public static class DummyTank implements IFluidTank {

View file

@ -61,7 +61,7 @@ public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
super.init(); super.init();
this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage); this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage);
this.buttonAutoSplit = Button.builder(Component.literal("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0)) this.buttonAutoSplit = Button.builder(Component.literal("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0))
.bounds(this.getGuiLeft(), 30, 16, 16).build(); .bounds(this.leftPos + 27, this.topPos + 5, 16, 16).build();
buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? ChatFormatting.DARK_GREEN.getColor() : ChatFormatting.RED.getColor()); buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? ChatFormatting.DARK_GREEN.getColor() : ChatFormatting.RED.getColor());
this.addRenderableWidget(this.buttonAutoSplit); this.addRenderableWidget(this.buttonAutoSplit);
} }

View file

@ -105,7 +105,7 @@ public class ItemCoffee extends ItemBase {
if (effects != null) { if (effects != null) {
for (MobEffectInstance effect : effects) { for (MobEffectInstance effect : effects) {
tooltip.add(Component.translatable(effect.getDescriptionId()) tooltip.add(Component.translatable(effect.getDescriptionId())
.append(" " + (effect.getAmplifier() + 1) + ", " + StringUtil.formatTickDuration(effect.getDuration(), 1)) .append(" " + (effect.getAmplifier() + 1) + ", " + StringUtil.formatTickDuration(effect.getDuration(), 20))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} }
} else { } else {

View file

@ -6,8 +6,6 @@ import net.minecraft.world.item.Item;
* I'm using a custom class here as I'm sure we'll need a unified way of declaring rules * I'm using a custom class here as I'm sure we'll need a unified way of declaring rules
* but also so we can always know if something is ours in the simplest form. * but also so we can always know if something is ours in the simplest form.
*/ */
// Superseded by ItemBase
@Deprecated
public abstract class ActuallyItem extends Item implements IActuallyItem { public abstract class ActuallyItem extends Item implements IActuallyItem {
public ActuallyItem(Properties properties) { public ActuallyItem(Properties properties) {
super(properties); super(properties);

View file

@ -3,8 +3,6 @@ package de.ellpeck.actuallyadditions.mod.items.misc;
import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem; import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem;
// Superseded by ItemDrillUpgrade
@Deprecated
public class DrillAugmentItem extends ActuallyItem { public class DrillAugmentItem extends ActuallyItem {
private final AugmentType type; private final AugmentType type;

View file

@ -0,0 +1,59 @@
package de.ellpeck.actuallyadditions.mod.items.misc;
import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
public class YummyItem extends ActuallyItem {
private final Foods food;
public YummyItem(Foods food) {
super(baseProps().food(food.food));
this.food = food;
}
public enum Foods {
CHEESE(new FoodProperties.Builder().nutrition(1).saturationMod(0.05F), 3),
PUMPKIN_STEW(new FoodProperties.Builder().nutrition(6).saturationMod(0.3F), 30, true, new ItemStack(Items.BOWL)),
CARROT_JUICE(new FoodProperties.Builder().nutrition(4).saturationMod(0.2F), 20, true, new ItemStack(Items.GLASS_BOTTLE)),
FRENCH_FRY(new FoodProperties.Builder().nutrition(2).saturationMod(0.025F), 3),
SPAGHETTI(new FoodProperties.Builder().nutrition(7).saturationMod(0.4F), 38, new ItemStack(Items.BOWL)),
NOODLE(new FoodProperties.Builder().nutrition(1).saturationMod(0.01F), 3),
CHOCOLATE_CAKE(new FoodProperties.Builder().nutrition(16).saturationMod(0.8F), 45),
CHOCOLATE(new FoodProperties.Builder().nutrition(3).saturationMod(0.3F), 15),
TOAST(new FoodProperties.Builder().nutrition(3).saturationMod(0.08F), 25),
SUBMARINE_SANDWICH(new FoodProperties.Builder().nutrition(9).saturationMod(0.4F), 40),
BIG_COOKIE(new FoodProperties.Builder().nutrition(4).saturationMod(0.25F), 20),
HAMBURGER(new FoodProperties.Builder().nutrition(13).saturationMod(0.65F), 40),
PIZZA(new FoodProperties.Builder().nutrition(16).saturationMod(0.8F), 45),
BAGUETTE(new FoodProperties.Builder().nutrition(6).saturationMod(0.5F), 25),
RICE(new FoodProperties.Builder().nutrition(2).saturationMod(0.05F), 10),
RICE_BREAD(new FoodProperties.Builder().nutrition(6).saturationMod(0.5F), 25),
DOUGHNUT(new FoodProperties.Builder().nutrition(2).saturationMod(0.1F), 10),
CHOCOLATE_TOAST(new FoodProperties.Builder().nutrition(5).saturationMod(0.2F), 40),
BACON(new FoodProperties.Builder().nutrition(4).saturationMod(0.1F), 30);
FoodProperties food;
int useDuration;
boolean isDrunken;
ItemStack returnItem;
Foods(FoodProperties.Builder food, int useDuration, boolean isDrunken, ItemStack returnItem) {
this.food = food.build();
this.useDuration = useDuration;
this.isDrunken = isDrunken;
this.returnItem = returnItem;
}
Foods(FoodProperties.Builder food, int useDuration) {
this(food, useDuration, false, ItemStack.EMPTY);
}
Foods(FoodProperties.Builder food, int useDuration, ItemStack returnItem) {
this(food, useDuration, false, returnItem);
}
}
}

View file

@ -17,8 +17,6 @@ import de.ellpeck.actuallyadditions.mod.crafting.CoffeeIngredientRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe; import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineCategory; import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineCategory;
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory; import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory;
@ -29,7 +27,6 @@ import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.RecipeTypes; import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.helpers.IJeiHelpers;
import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration; import mezz.jei.api.registration.IRecipeRegistration;
@ -91,13 +88,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
//registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES, CrusherRecipeCategory.NAME); //registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES, CrusherRecipeCategory.NAME);
} }
@Override // @Override
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
registration.addRecipeClickArea(GuiCoffeeMachine.class, 53, 42, 22, 16, COFFEE_MACHINE);
registration.addRecipeClickArea(GuiFurnaceDouble.class, 51, 40, 74, 22, RecipeTypes.SMELTING);
}
// @Override
// public void register(IModRegistry registry) { // public void register(IModRegistry registry) {
// IJeiHelpers helpers = registry.getJeiHelpers(); // IJeiHelpers helpers = registry.getJeiHelpers();
// //

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay; import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
import de.ellpeck.actuallyadditions.mod.crafting.CoffeeIngredientRecipe; import de.ellpeck.actuallyadditions.mod.crafting.CoffeeIngredientRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe; import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
@ -25,10 +24,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i; import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -127,7 +123,7 @@ public class MethodHandler implements IMethodHandler {
int prevCounter = tag.getInt("Counter"); int prevCounter = tag.getInt("Counter");
CompoundTag compound = new CompoundTag(); CompoundTag compound = new CompoundTag();
compound.putString("ID", BuiltInRegistries.MOB_EFFECT.getKey(effect.getEffect()).toString()); //compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect())); //TODO ?!
compound.putInt("Duration", effect.getDuration()); compound.putInt("Duration", effect.getDuration());
compound.putInt("Amplifier", effect.getAmplifier()); compound.putInt("Amplifier", effect.getAmplifier());
@ -144,20 +140,13 @@ public class MethodHandler implements IMethodHandler {
CompoundTag tag = stack.getOrCreateTag(); CompoundTag tag = stack.getOrCreateTag();
int counter = tag.getInt("Counter"); int counter = tag.getInt("Counter");
while (counter > 0) { while (counter > 0) {
CompoundTag compound = tag.getCompound(counter + ""); CompoundTag compound = (CompoundTag) tag.get(counter + "");
String id = compound.getString("ID"); MobEffectInstance effect = new MobEffectInstance(BuiltInRegistries.MOB_EFFECT.byId(compound.getInt("ID")), compound.getInt("Duration"), compound.getByte("Amplifier"));
ResourceLocation effectID = id.isEmpty() ? new ResourceLocation("speed") : ResourceLocation.tryParse(id); effects.add(effect);
MobEffect effect = BuiltInRegistries.MOB_EFFECT.get(effectID);
if (effect == null) {
ActuallyAdditions.LOGGER.error("Unable to find effect with ID: {}, defaulting to speed", effectID);
effect = MobEffects.MOVEMENT_SPEED;
}
MobEffectInstance effectInstance = new MobEffectInstance(effect, compound.getInt("Duration"), compound.getByte("Amplifier"));
effects.add(effectInstance);
counter--; counter--;
} }
return !effects.isEmpty() return effects.size() > 0
? effects.toArray(new MobEffectInstance[0]) ? effects.toArray(new MobEffectInstance[effects.size()])
: null; : null;
} }

View file

@ -183,7 +183,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
} }
ItemStack input = this.inv.getStackInSlot(SLOT_INPUT); ItemStack input = this.inv.getStackInSlot(SLOT_INPUT);
if (!input.isEmpty() && input.is(ActuallyItems.EMPTY_CUP) && this.inv.getStackInSlot(SLOT_OUTPUT).isEmpty() && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid().getFluid() == Fluids.WATER && this.tank.getFluidAmount() >= WATER_USE) { if (StackUtil.isValid(input) && input.getItem() == ActuallyItems.COFFEE_CUP.get() && !StackUtil.isValid(this.inv.getStackInSlot(SLOT_OUTPUT)) && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid().getFluid() == Fluids.WATER && this.tank.getFluidAmount() >= WATER_USE) {
if (this.storage.getEnergyStored() >= ENERGY_USED) { if (this.storage.getEnergyStored() >= ENERGY_USED) {
if (this.brewTime % 30 == 0) { if (this.brewTime % 30 == 0) {
this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), AASounds.COFFEE_MACHINE.get(), SoundSource.BLOCKS, 0.1F, 1.0F); this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), AASounds.COFFEE_MACHINE.get(), SoundSource.BLOCKS, 0.1F, 1.0F);
@ -193,7 +193,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
this.storage.extractEnergyInternal(ENERGY_USED, false); this.storage.extractEnergyInternal(ENERGY_USED, false);
if (this.brewTime >= TIME_USED) { if (this.brewTime >= TIME_USED) {
this.brewTime = 0; this.brewTime = 0;
ItemStack output = new ItemStack(ActuallyItems.COFFEE_CUP.get()); ItemStack output = new ItemStack(ActuallyItems.COFFEE_BEANS.get());
for (int i = 3; i < this.inv.getSlots(); i++) { for (int i = 3; i < this.inv.getSlots(); i++) {
if (StackUtil.isValid(this.inv.getStackInSlot(i))) { if (StackUtil.isValid(this.inv.getStackInSlot(i))) {
RecipeHolder<CoffeeIngredientRecipe> recipeHolder = ItemCoffee.getIngredientRecipeFromStack(this.inv.getStackInSlot(i)); RecipeHolder<CoffeeIngredientRecipe> recipeHolder = ItemCoffee.getIngredientRecipeFromStack(this.inv.getStackInSlot(i));

View file

@ -174,7 +174,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
} }
if (changeTo != current) { if (changeTo != current) {
level.setBlock(pos, state.setValue(BlockStateProperties.LIT, changeTo), Block.UPDATE_ALL); tile.level.setBlock(tile.worldPosition, state.setValue(BlockStateProperties.LIT, changeTo), Block.UPDATE_ALL);
} }
tile.lastSmelted = smelted; tile.lastSmelted = smelted;

View file

@ -108,7 +108,7 @@
"block.actuallyadditions.feeder": "Automatic Feeder (wip)", "block.actuallyadditions.feeder": "Automatic Feeder (wip)",
"block.actuallyadditions.crusher": "Crusher (wip)", "block.actuallyadditions.crusher": "Crusher (wip)",
"block.actuallyadditions.crusher_double": "Double Crusher (wip)", "block.actuallyadditions.crusher_double": "Double Crusher (wip)",
"block.actuallyadditions.powered_furnace": "Powered Furnace", "block.actuallyadditions.powered_furnace": "Powered Furnace (wip)",
"block.actuallyadditions.fishing_net": "Fishing Net (wip)", "block.actuallyadditions.fishing_net": "Fishing Net (wip)",
"block.actuallyadditions.heat_collector": "Heat Collector (wip)", "block.actuallyadditions.heat_collector": "Heat Collector (wip)",
"block.actuallyadditions.item_repairer": "Item Repairer (wip)", "block.actuallyadditions.item_repairer": "Item Repairer (wip)",
@ -168,7 +168,7 @@
"block.actuallyadditions.dropper": "Automatic Precision Dropper", "block.actuallyadditions.dropper": "Automatic Precision Dropper",
"block.actuallyadditions.ender_casing": "Ender Casing", "block.actuallyadditions.ender_casing": "Ender Casing",
"block.actuallyadditions.flax": "Flax Plant", "block.actuallyadditions.flax": "Flax Plant",
"block.actuallyadditions.coffee_machine": "Coffee Maker", "block.actuallyadditions.coffee_machine": "Coffee Maker (wip)",
"block.actuallyadditions.xp_solidifier": "Experience Solidifier (wip)", "block.actuallyadditions.xp_solidifier": "Experience Solidifier (wip)",
"block.actuallyadditions.leaf_generator": "Leaf-Eating Generator (wip)", "block.actuallyadditions.leaf_generator": "Leaf-Eating Generator (wip)",
"block.actuallyadditions.long_range_breaker": "Long-Range Breaker (wip)", "block.actuallyadditions.long_range_breaker": "Long-Range Breaker (wip)",
@ -301,7 +301,7 @@
"item.actuallyadditions.netherite_aiot": "Netherite AIOT (wip)", "item.actuallyadditions.netherite_aiot": "Netherite AIOT (wip)",
"item.actuallyadditions.phantom_connector": "Phantom Connector (wip)", "item.actuallyadditions.phantom_connector": "Phantom Connector (wip)",
"item.actuallyadditions.empty_cup": "Empty Cup", "item.actuallyadditions.empty_cup": "Empty Cup",
"item.actuallyadditions.coffee_cup": "Cup with Coffee", "item.actuallyadditions.coffee_cup": "Cup with Coffee (wip)",
"item.actuallyadditions.coffee_seeds": "Coffee Seeds", "item.actuallyadditions.coffee_seeds": "Coffee Seeds",
"item.actuallyadditions.coffee_beans": "Coffee Beans (wip)", "item.actuallyadditions.coffee_beans": "Coffee Beans (wip)",
"item.actuallyadditions.canola_seeds": "Canola Seeds", "item.actuallyadditions.canola_seeds": "Canola Seeds",