Skip to content

Commit

Permalink
feat: add initial implementation (not production ready) for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Aug 20, 2024
1 parent ff60029 commit 4963979
Show file tree
Hide file tree
Showing 21 changed files with 249 additions and 74 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/klikli_dev/theurgy/Theurgy.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.klikli_dev.theurgy.content.item.derivative.render.AlchemicalDerivativeBEWLR;
import com.klikli_dev.theurgy.content.item.wire.WireItem;
import com.klikli_dev.theurgy.content.render.*;
import com.klikli_dev.theurgy.content.render.itemhud.ApparatusInsertItemHUD;
import com.klikli_dev.theurgy.content.render.itemhud.ItemHUD;
import com.klikli_dev.theurgy.content.render.outliner.Outliner;
import com.klikli_dev.theurgy.datagen.TheurgyDataGenerators;
Expand Down Expand Up @@ -208,10 +209,9 @@ public static void onClientTick(ClientTickEvent.Post event) {
Player player = Minecraft.getInstance().player;

Outliner.get().tick();
BlockRegistry.CALORIC_FLUX_EMITTER.get().selectionBehaviour().tick(player);
BlockRegistry.SULFURIC_FLUX_EMITTER.get().selectionBehaviour().tick(player);


BlockRegistry.CALORIC_FLUX_EMITTER.get().selectionBehaviour().tick(Minecraft.getInstance().player);
BlockRegistry.SULFURIC_FLUX_EMITTER.get().selectionBehaviour().tick(Minecraft.getInstance().player);
ApparatusInsertItemHUD.get().tick(Minecraft.getInstance().player);
WireItem.onClientTick(player);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.klikli_dev.theurgy.content.apparatus.calcinationoven;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.TwoSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.recipe.input.ItemHandlerRecipeInput;
Expand Down Expand Up @@ -41,14 +42,14 @@
import org.jetbrains.annotations.Nullable;


public class CalcinationOvenBlock extends Block implements EntityBlock {
public class CalcinationOvenBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<TwoSlotItemHandlerBehaviour> {

public static final BooleanProperty LIT = BlockStateProperties.LIT;
public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
protected static final VoxelShape TOP = Block.box(0, 0, 0, 16, 5, 16);
protected static final VoxelShape BOTTOM = Shapes.block();

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected TwoSlotItemHandlerBehaviour itemHandlerBehaviour;

public CalcinationOvenBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -184,4 +185,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, Bloc
}
};
}

@Override
public TwoSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.klikli_dev.theurgy.content.behaviour.fluidhandler.OneTankFluidHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.interaction.InteractionBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.DynamicOneOutputSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.redstone.VatAnalogSignalOutputBehaviour;
import com.klikli_dev.theurgy.content.behaviour.redstone.VatRedstoneChangeOpenCloseLidBehaviour;
import com.klikli_dev.theurgy.content.behaviour.redstone.VatRedstoneHasOutputBehaviour;
Expand Down Expand Up @@ -44,11 +44,11 @@
import org.jetbrains.annotations.Nullable;


public class DigestionVatBlock extends Block implements EntityBlock {
public class DigestionVatBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<DynamicOneOutputSlotItemHandlerBehaviour> {
public static final BooleanProperty OPEN = BlockStateProperties.OPEN;
private static final VoxelShape BOUNDING_BOX = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
private static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
protected ItemHandlerBehaviour itemHandlerBehaviour;
protected DynamicOneOutputSlotItemHandlerBehaviour itemHandlerBehaviour;
protected FluidHandlerBehaviour fluidHandlerBehaviour;
protected InteractionBehaviour interactionBehaviour;
protected VatRedstoneChangeOpenCloseLidBehaviour<DigestionRecipe> redstoneInputBehaviour;
Expand Down Expand Up @@ -182,4 +182,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, @Not
}
};
}

@Override
public DynamicOneOutputSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.klikli_dev.theurgy.content.apparatus.distiller;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.TwoSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.recipe.input.ItemHandlerRecipeInput;
Expand Down Expand Up @@ -41,14 +42,14 @@
import org.jetbrains.annotations.Nullable;


public class DistillerBlock extends Block implements EntityBlock {
public class DistillerBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<TwoSlotItemHandlerBehaviour> {

public static final BooleanProperty LIT = BlockStateProperties.LIT;
public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
protected static final VoxelShape TOP = Block.box(0, 0, 0, 16, 16, 16);
protected static final VoxelShape BOTTOM = Shapes.block();

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected TwoSlotItemHandlerBehaviour itemHandlerBehaviour;

public DistillerBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -183,4 +184,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, Bloc
}
};
}

@Override
public TwoSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.klikli_dev.theurgy.content.behaviour.fluidhandler.OneTankFluidHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.interaction.InteractionBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.DynamicOneOutputSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.redstone.VatAnalogSignalOutputBehaviour;
import com.klikli_dev.theurgy.content.behaviour.redstone.VatRedstoneChangeOpenCloseLidBehaviour;
Expand Down Expand Up @@ -44,12 +45,12 @@
import org.jetbrains.annotations.Nullable;


public class FermentationVatBlock extends Block implements EntityBlock {
public class FermentationVatBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<DynamicOneOutputSlotItemHandlerBehaviour> {
public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final BooleanProperty OPEN = BlockStateProperties.OPEN;
public static final BooleanProperty HAS_OUTPUT = BooleanProperty.create("has_output");

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected DynamicOneOutputSlotItemHandlerBehaviour itemHandlerBehaviour;
protected FluidHandlerBehaviour fluidHandlerBehaviour;
protected InteractionBehaviour interactionBehaviour;

Expand Down Expand Up @@ -178,4 +179,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, @Not
}
};
}

@Override
public DynamicOneOutputSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.klikli_dev.theurgy.content.apparatus.incubator;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.OneSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.registry.BlockEntityRegistry;
Expand Down Expand Up @@ -43,7 +44,7 @@

import java.util.Map;

public class IncubatorBlock extends Block implements EntityBlock {
public class IncubatorBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<OneSlotItemHandlerBehaviour> {
public static final BooleanProperty NORTH = PipeBlock.NORTH;
public static final BooleanProperty EAST = PipeBlock.EAST;
public static final BooleanProperty SOUTH = PipeBlock.SOUTH;
Expand All @@ -63,7 +64,7 @@ public class IncubatorBlock extends Block implements EntityBlock {
Block.box(1, 10, 1, 15, 16, 15)
);

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected OneSlotItemHandlerBehaviour itemHandlerBehaviour;

public IncubatorBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -226,4 +227,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, Bloc
public boolean isVessel(BlockState pState) {
return pState.is(BlockTagRegistry.INCUBATOR_VESSELS);
}

@Override
public OneSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.klikli_dev.theurgy.content.apparatus.incubator;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.OneSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.registry.BlockEntityRegistry;
Expand All @@ -25,8 +26,8 @@
import net.neoforged.neoforge.items.wrapper.RecipeWrapper;
import org.jetbrains.annotations.Nullable;

public class IncubatorMercuryVesselBlock extends Block implements EntityBlock {
protected ItemHandlerBehaviour itemHandlerBehaviour;
public class IncubatorMercuryVesselBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<OneSlotItemHandlerBehaviour> {
protected OneSlotItemHandlerBehaviour itemHandlerBehaviour;

public IncubatorMercuryVesselBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -71,4 +72,9 @@ protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, L

return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}

@Override
public OneSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

package com.klikli_dev.theurgy.content.apparatus.incubator;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.OneSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.registry.BlockEntityRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand All @@ -21,13 +20,11 @@
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;

import net.neoforged.neoforge.items.wrapper.RecipeWrapper;
import org.jetbrains.annotations.Nullable;

public class IncubatorSaltVesselBlock extends Block implements EntityBlock {
public class IncubatorSaltVesselBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<OneSlotItemHandlerBehaviour> {

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected OneSlotItemHandlerBehaviour itemHandlerBehaviour;

public IncubatorSaltVesselBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -72,4 +69,9 @@ public RenderShape getRenderShape(BlockState pState) {
public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) {
return BlockEntityRegistry.INCUBATOR_SALT_VESSEL.get().create(pPos, pState);
}

@Override
public OneSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

package com.klikli_dev.theurgy.content.apparatus.incubator;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.OneSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.registry.BlockEntityRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand All @@ -21,12 +20,10 @@
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;

import net.neoforged.neoforge.items.wrapper.RecipeWrapper;
import org.jetbrains.annotations.Nullable;

public class IncubatorSulfurVesselBlock extends Block implements EntityBlock {
protected ItemHandlerBehaviour itemHandlerBehaviour;
public class IncubatorSulfurVesselBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<OneSlotItemHandlerBehaviour> {
protected OneSlotItemHandlerBehaviour itemHandlerBehaviour;

public IncubatorSulfurVesselBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -71,4 +68,9 @@ protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, L

return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}

@Override
public OneSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import com.klikli_dev.theurgy.content.behaviour.fluidhandler.FluidHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.fluidhandler.OneTankFluidHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.TwoSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.registry.BlockEntityRegistry;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -39,20 +39,18 @@
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

import net.neoforged.neoforge.items.wrapper.RecipeWrapper;
import org.jetbrains.annotations.Nullable;


public class LiquefactionCauldronBlock extends Block implements EntityBlock {
public class LiquefactionCauldronBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<TwoSlotItemHandlerBehaviour> {

public static final BooleanProperty LIT = BlockStateProperties.LIT;

public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
protected static final VoxelShape TOP = Block.box(1, 0, 1, 15, 6, 15);
protected static final VoxelShape BOTTOM = Shapes.block();

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected TwoSlotItemHandlerBehaviour itemHandlerBehaviour;
protected FluidHandlerBehaviour fluidHandlerBehaviour;

public LiquefactionCauldronBlock(Properties pProperties) {
Expand Down Expand Up @@ -193,4 +191,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, Bloc
}
};
}

@Override
public TwoSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package com.klikli_dev.theurgy.content.apparatus.mercurycatalyst;

import com.klikli_dev.theurgy.content.behaviour.itemhandler.ItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.HasItemHandlerBehaviour;
import com.klikli_dev.theurgy.content.behaviour.itemhandler.OneSlotItemHandlerBehaviour;
import com.klikli_dev.theurgy.registry.BlockEntityRegistry;
import com.klikli_dev.theurgy.registry.DataComponentRegistry;
Expand All @@ -29,11 +29,11 @@
import org.jetbrains.annotations.Nullable;


public class MercuryCatalystBlock extends Block implements EntityBlock {
public class MercuryCatalystBlock extends Block implements EntityBlock, HasItemHandlerBehaviour<OneSlotItemHandlerBehaviour> {

public static final BooleanProperty ENABLED = BlockStateProperties.ENABLED;

protected ItemHandlerBehaviour itemHandlerBehaviour;
protected OneSlotItemHandlerBehaviour itemHandlerBehaviour;

public MercuryCatalystBlock(Properties pProperties) {
super(pProperties);
Expand Down Expand Up @@ -149,4 +149,9 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, Bloc
}
};
}

@Override
public OneSlotItemHandlerBehaviour itemHandlerBehaviour() {
return this.itemHandlerBehaviour;
}
}
Loading

0 comments on commit 4963979

Please sign in to comment.