Skip to content

Commit

Permalink
bio reactor && mixer screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Thepigcat76 committed Jan 4, 2025
1 parent c30335e commit 622c741
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/portingdeadmods/nautec/NautecClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private void registerMenus(RegisterMenuScreensEvent event) {
event.register(NTMenuTypes.INCUBATOR.get(), IncubatorScreen::new);
event.register(NTMenuTypes.MUTATOR.get(), MutatorScreen::new);
event.register(NTMenuTypes.BIO_REACTOR.get(), BioReactorScreen::new);
event.register(NTMenuTypes.MIXER.get(), MixerScreen::new);
event.register(NTMenuTypes.BACTERIAL_ANALYZER.get(), BacterialAnalyzerScreen::new);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class BioReactorScreen extends NTAbstractContainerScreen<BioReactorBlockE
public BioReactorScreen(NTAbstractContainerMenu<BioReactorBlockEntity> menu, Inventory playerInventory, Component title) {
super(menu, playerInventory, title);
this.titleLabelY = 4;
this.imageHeight = 174;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
package com.portingdeadmods.nautec.client.screen;

public class MixerScreen {
import com.portingdeadmods.nautec.Nautec;
import com.portingdeadmods.nautec.api.client.screen.NTAbstractContainerScreen;
import com.portingdeadmods.nautec.api.menu.NTAbstractContainerMenu;
import com.portingdeadmods.nautec.content.blockentities.MixerBlockEntity;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import org.jetbrains.annotations.NotNull;

public class MixerScreen extends NTAbstractContainerScreen<MixerBlockEntity> {
public static final ResourceLocation TEXTURE = Nautec.rl("textures/gui/mixer.png");

public MixerScreen(NTAbstractContainerMenu<MixerBlockEntity> menu, Inventory playerInventory, Component title) {
super(menu, playerInventory, title);
this.titleLabelY = 4;
this.imageHeight = 174;
}

@Override
public @NotNull ResourceLocation getBackgroundTexture() {
return TEXTURE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.portingdeadmods.nautec.NTConfig;
import com.portingdeadmods.nautec.api.blockentities.LaserBlockEntity;
import com.portingdeadmods.nautec.capabilities.IOActions;
import com.portingdeadmods.nautec.content.menus.MixerMenu;
import com.portingdeadmods.nautec.content.recipes.MixingRecipe;
import com.portingdeadmods.nautec.content.recipes.inputs.MixingRecipeInput;
import com.portingdeadmods.nautec.content.recipes.utils.IngredientWithCount;
Expand All @@ -13,6 +14,11 @@
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeHolder;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -27,7 +33,7 @@

import java.util.*;

public class MixerBlockEntity extends LaserBlockEntity {
public class MixerBlockEntity extends LaserBlockEntity implements MenuProvider {
public static final int OUTPUT_SLOT = 4;
private boolean running;

Expand Down Expand Up @@ -251,4 +257,13 @@ public int getMaxDuration() {
}


@Override
public Component getDisplayName() {
return Component.literal("Mixer");
}

@Override
public @Nullable AbstractContainerMenu createMenu(int containerId, Inventory playerInventory, Player player) {
return new MixerMenu(containerId, playerInventory, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class BioReactorBlockEntity extends LaserBlockEntity implements MenuProvi

public BioReactorBlockEntity(BlockPos blockPos, BlockState blockState) {
super(NTBlockEntityTypes.BIO_REACTOR.get(), blockPos, blockState);
addItemHandler(2);
addItemHandler(3);
addBacteriaStorage(3);
this.multiblockData = MultiblockData.EMPTY;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected MapCodec<? extends BaseEntityBlock> codec() {

@Override
protected @NotNull ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
if (level.getBlockEntity(pos) instanceof MixerBlockEntity mixerBE) {
/*if (level.getBlockEntity(pos) instanceof MixerBlockEntity mixerBE) {
IItemHandler itemHandler = mixerBE.getItemHandler();
IFluidHandler fluidHandler = mixerBE.getFluidHandler();
IFluidHandler secondaryFluidHandler = mixerBE.getSecondaryFluidHandler();
Expand All @@ -98,7 +98,7 @@ protected MapCodec<? extends BaseEntityBlock> codec() {
} else {
return insertItemsSided(stack, player, hand, itemHandler, clickedFace);
}
}
}*/
return super.useItemOn(stack, state, level, pos, player, hand, hitResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public BioReactorMenu(int containerId, Inventory inv, FriendlyByteBuf extraData)
public BioReactorMenu(int containerId, @NotNull Inventory inv, @NotNull BioReactorBlockEntity blockEntity) {
super(NTMenuTypes.BIO_REACTOR.get(), containerId, inv, blockEntity);

addPlayerInventory(inv, 92);
addPlayerHotbar(inv, 150);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public MixerMenu(int containerId, Inventory inv, FriendlyByteBuf extraData) {

public MixerMenu(int containerId, @NotNull Inventory inv, @NotNull MixerBlockEntity blockEntity) {
super(NTMenuTypes.MIXER.get(), containerId, inv, blockEntity);

addPlayerInventory(inv, 92);
addPlayerHotbar(inv, 150);
}

@Override
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 622c741

Please sign in to comment.