Skip to content

Commit

Permalink
Big 2.0 release time soon™?
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed May 13, 2023
1 parent 7eb00c5 commit 9e3b75a
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 44 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ jobs:
uses: actions/download-artifact@v2
with:
name: Artifacts
- name: Read mod version
id: mod_version
uses: christian-draeger/[email protected]
with:
path: gradle.properties
property: mod_version
- name: Read minecraft version
id: minecraft_version
uses: christian-draeger/[email protected]
with:
path: gradle.properties
property: minecraft_version
- name: Update GitHub Release
uses: tubone24/[email protected]
env:
Expand All @@ -82,11 +70,6 @@ jobs:
- name: publish mod
uses: Kir-Antipov/[email protected]
with:

name: ${{ github.event.release.name }}
version: '${{ steps.mod_version.outputs.value }}+${{ steps.minecraft_version.outputs.value }}'
version-type: release

game-versions: |
${{ steps.minecraft_version.outputs.value }}
java: |
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
- Updated to 1.19.4.
- Added Whoppers, a wooden hopper variant that's way slower and more limited, but also way cheaper to craft. Includes an omni variant.
- Overhauled Fluid Hoppers into Floppers, they can now oxidize like any other copper block.
- Added Lidless Chests, a block that instantly drops any inserted items on the floor, can be placed in any direction.
- Majorly overhauled internals to be mildly less cursed.
41 changes: 30 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
# Omni-Hopper
# Omni-Hopper <img src="src/main/resources/assets/omnihopper/icon.png" align="right" width="50">

[![GitHub license](https://img.shields.io/github/license/enjarai/moderate-loading-screen?style=flat-square)](https://github.com/enjarai/moderate-loading-screen/blob/1.17/LICENSE)
![Environment: Both](https://img.shields.io/badge/environment-both-4caf50?style=flat-square)
[![Mod loader: Fabric]][fabric]

[fabric]: https://fabricmc.net
[Mod loader: Fabric]: https://img.shields.io/badge/modloader-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Gikl+OotaKRwAAAABJRU5ErkJggg==

Downloads:<br>
[Modrinth](https://modrinth.com/mod/omnihopper) | [Curseforge](https://www.curseforge.com/minecraft/mc-mods/omni-hopper)

Have you ever thought about why hoppers can only suck from above?
> Have you ever thought about why hoppers can only suck from above?
You could say it makes sense from a realism perspective,
or mention it encourages creativity through limitations.

These are all valid arguments of course.
>
> These are all valid arguments of course.
But who cares about reason when you have to get an item
from one machine to another in some awkward configuration,
and you have to decipher some obscure pipe mod to insert it from below,
or spend ages working your way up a tech tree to craft some other kind of transport method?

Don't you wish the humble 5 iron ingot hopper would help you out in these situations?
>
> Don't you wish the humble 5 iron ingot hopper would help you out in these situations?
But alas, it was not meant to be.
It seemed we would be forever shackled in chains laid upon us by lord Jeb himself.

Until one day, the young Omni-Hopper was born.
>
> Until one day, the young Omni-Hopper was born.
With a small offering of one copper ingot,
one everyday hopper can be freed from its constraints,
and be placed in any possible orientation!
Surely this will change the fate of Modded Minecraftia forevermore,
no longer shall players have to suffer under the rule of realism.
Freedom is within our grasp!
>
> Add Omni-Hopper to your modpack today and free your hoppers!
Add Omni-Hopper to your modpack today and free your hoppers!
## Features

[fabric]: https://fabricmc.net
[Mod loader: Fabric]: https://img.shields.io/badge/modloader-Fabric-1976d2?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE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3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHN0RXZ0OndoZW49IjIwMTgtMTItMTZUMTY6NTQ6MTctMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4/HiGMAAAAtUlEQVRYw+XXrQqAMBQF4D2P2eBL+QIG8RnEJFaNBjEum+0+zMQLtwwv+wV3ZzhhMDgfJ0wUSinxZUQWgKos1JP/AbD4OneIDyQPwCFniA+EJ4CaXm4TxAXCC0BNHgLhAdAnx9hC8PwGSRtAFVMQjF7cNTWED8B1cgwW20yfJgAvrssAsZ1cB3g/xckAxr6FmCDU5N6f488BrpCQ4rQBJkiMYh4ACmLzwOQF0CExinkCsvw7vgGikl+OotaKRwAAAABJRU5ErkJggg==
- Omni-Hoppers that can be placed in any orientation, sucking from and inserting into any side.
![](img/omnihopper.png)
- Fluid Hoppers (Floppers) to transport fluids instead of items. They oxidize!
![](img/flopper.png)
- Wooden Hoppers (Whoppers) as a cheaper, slower and more limited alternative to regular hoppers.
![](img/whopper.png)
- Omni variants of the above.
![](img/variants.png)
- Lidless Chests that instantly drop any inserted items on the ground.
![](img/lidless.png)

## Examples

### Basic upside-down sorter

![](img/sorter.png)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ yarn_mappings=1.19.4+build.1
loader_version=0.14.17

# Mod Properties
mod_version = 1.2.0
mod_version = 2.0.0
maven_group = nl.enjarai
archives_base_name = omnihopper
modid = omnihopper
Expand Down
Binary file added img/flopper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/lidless.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/omnihopper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sorter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/variants.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/whopper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19.4 2023-05-12T12:56:56.7499076 Omni-Hopper/Model Definitions
// 1.19.4 2023-05-13T15:45:29.3495627 Omni-Hopper/Model Definitions
95f93723e1cb32f615234c52d121c3216e6836f7 assets\omnihopper\blockstates\exposed_fluid_hopper.json
0dad0f40b8c90d882230d431cdd522f6abfaf090 assets\omnihopper\models\block\waxed_oxidized_fluid_hopper_east.json
5757f300faf72762c4f41c8715bca1c267b6b8a5 assets\omnihopper\models\block\exposed_fluid_omnihopper_west.json
Expand All @@ -14,9 +14,9 @@ fac91b9c3369074c1dc59cdb3a0ec477d8afc28f assets\omnihopper\models\block\weathere
ad5bad4abff393f59c2e94c085b43d5ee963a16e assets\omnihopper\models\block\waxed_oxidized_fluid_omnihopper_up.json
36c1e0a18411e90239e994141da7145ba778bf11 assets\omnihopper\models\block\waxed_weathered_fluid_hopper_south.json
ad5bad4abff393f59c2e94c085b43d5ee963a16e assets\omnihopper\models\block\oxidized_fluid_hopper_up.json
912e0a19beec715d0bb52e01d149046bc84ecd38 assets\omnihopper\models\block\omnihopper_down.json
5757f300faf72762c4f41c8715bca1c267b6b8a5 assets\omnihopper\models\block\waxed_exposed_fluid_hopper_west.json
fac91b9c3369074c1dc59cdb3a0ec477d8afc28f assets\omnihopper\models\block\weathered_fluid_omnihopper_down.json
5757f300faf72762c4f41c8715bca1c267b6b8a5 assets\omnihopper\models\block\waxed_exposed_fluid_hopper_west.json
912e0a19beec715d0bb52e01d149046bc84ecd38 assets\omnihopper\models\block\omnihopper_down.json
f87817bfe593be9cf4873e7ca26d99aef284948c assets\omnihopper\models\block\oxidized_fluid_omnihopper_north.json
1f7f59f6e29fcd4a4aed7a4dd05e7c3da0c0ca67 assets\omnihopper\models\item\waxed_oxidized_fluid_hopper.json
036756e95e1aa09cc5c4e1133acdc06c14f16f7b assets\omnihopper\models\block\waxed_exposed_fluid_hopper_north.json
Expand Down Expand Up @@ -87,8 +87,8 @@ d3a9ee28f7b69327e867c9f1834e8fc74eb1412b assets\omnihopper\models\block\waxed_fl
f156ff47769487617520d3a24134e8e40804fa62 assets\omnihopper\blockstates\oxidized_fluid_hopper.json
704d08e81496cc39145807c93f6261d142b469f9 assets\omnihopper\models\block\wooden_omnihopper_east.json
6a9c29f72582051ec7ec4a550b736aa94204e721 assets\omnihopper\models\block\waxed_fluid_omnihopper_down.json
0fae4612c17b86ba19c6df9f54a501ca7f9cd49e assets\omnihopper\blockstates\waxed_weathered_fluid_hopper.json
a518b959fe177b4149daba17136dfdb5cc39c42e assets\omnihopper\blockstates\fluid_omnihopper.json
0fae4612c17b86ba19c6df9f54a501ca7f9cd49e assets\omnihopper\blockstates\waxed_weathered_fluid_hopper.json
db3953011021d444ab7d1f165911a99ef4c3eee0 assets\omnihopper\blockstates\fluid_hopper.json
faf2923502921a28898c8b9393cc4b3a3d4504b5 assets\omnihopper\models\block\fluid_omnihopper_south.json
0dad0f40b8c90d882230d431cdd522f6abfaf090 assets\omnihopper\models\block\oxidized_fluid_hopper_east.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.19.4 2023-05-12T12:56:56.7459099 Omni-Hopper/Tags for minecraft:block
// 1.19.4 2023-05-13T15:45:29.3455678 Omni-Hopper/Tags for minecraft:block
ff81d82d656cfc039ebfcb6aecc7664c6ecf13e3 data\minecraft\tags\blocks\mineable\axe.json
30c02540c68c2f27f8b13a1aa9db5b33cfecc0b3 data\minecraft\tags\blocks\mineable\pickaxe.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19.4 2023-05-12T12:56:56.747908 Omni-Hopper/Block Loot Tables
// 1.19.4 2023-05-13T15:45:29.3475642 Omni-Hopper/Block Loot Tables
5e1b7414e97ffd18526b521b2f668f2ff33a0081 data\omnihopper\loot_tables\blocks\weathered_fluid_omnihopper.json
4699e00ce71ee93c705d090c8214db233522dbd3 data\omnihopper\loot_tables\blocks\waxed_weathered_fluid_hopper.json
5309be1241244c97d8cbe053a55a08e8344e870d data\omnihopper\loot_tables\blocks\oxidized_fluid_omnihopper.json
Expand All @@ -12,8 +12,8 @@ ce8250bce00f7d67677acb9d791d49e70f718dc5 data\omnihopper\loot_tables\blocks\waxe
72943de07ec3981059e2c5b1260a045b8803c7ed data\omnihopper\loot_tables\blocks\wooden_hopper.json
ec2b08bfbeef21b6d6badc7d3d10666ecb270b69 data\omnihopper\loot_tables\blocks\fluid_omnihopper.json
c6cf591117007d2f45b7d2e92f6c9a6a1de457d9 data\omnihopper\loot_tables\blocks\wooden_omnihopper.json
50edaef16d70ae3d76ac7f0b89e0dcdf163a5699 data\omnihopper\loot_tables\blocks\waxed_weathered_fluid_omnihopper.json
12a451e76494d88f7319518d985b82e3205915c4 data\omnihopper\loot_tables\blocks\fluid_hopper.json
50edaef16d70ae3d76ac7f0b89e0dcdf163a5699 data\omnihopper\loot_tables\blocks\waxed_weathered_fluid_omnihopper.json
325289d7835add3651e8c2f684d0dee8bbc0e099 data\omnihopper\loot_tables\blocks\open_box.json
9d3834381270a159809226214f72cecc2c57aae2 data\omnihopper\loot_tables\blocks\exposed_fluid_omnihopper.json
0a3df091eb6c4de43fa28e23d98715deecd040c7 data\omnihopper\loot_tables\blocks\oxidized_fluid_hopper.json
Expand Down
42 changes: 38 additions & 4 deletions src/main/java/nl/enjarai/omnihopper/blocks/OpenBoxBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,32 @@

import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.enums.SlabType;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import nl.enjarai.omnihopper.blocks.entity.OpenBoxBlockEntity;
import nl.enjarai.omnihopper.util.DatagenBlock;

import nl.enjarai.omnihopper.util.HasTooltip;
import org.jetbrains.annotations.Nullable;

@SuppressWarnings("deprecation")
public class OpenBoxBlock extends BlockWithEntity implements DatagenBlock, HasTooltip {
public class OpenBoxBlock extends BlockWithEntity implements DatagenBlock, HasTooltip, Waterloggable {
public static final DirectionProperty FACING = Properties.FACING;
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public static final VoxelShape[] SHAPES = new VoxelShape[6];

static {
Expand All @@ -46,12 +53,12 @@ public class OpenBoxBlock extends BlockWithEntity implements DatagenBlock, HasTo

public OpenBoxBlock(Settings settings) {
super(settings);
setDefaultState(getStateManager().getDefaultState().with(FACING, Direction.UP));
setDefaultState(getStateManager().getDefaultState().with(FACING, Direction.UP).with(WATERLOGGED, false));
}

@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(FACING));
super.appendProperties(builder.add(FACING, WATERLOGGED));
}

@Override
Expand All @@ -62,7 +69,8 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return getDefaultState().with(FACING, ctx.getSide());
var fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos());
return getDefaultState().with(FACING, ctx.getSide()).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
}

@Override
Expand All @@ -80,4 +88,30 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
public Set<TagKey<Block>> getConfiguredTags() {
return Set.of(BlockTags.AXE_MINEABLE);
}

@Override
public FluidState getFluidState(BlockState state) {
if (state.get(WATERLOGGED)) {
return Fluids.WATER.getStill(false);
}
return super.getFluidState(state);
}

@Override
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
return Waterloggable.super.tryFillWithFluid(world, pos, state, fluidState);
}

@Override
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
return Waterloggable.super.canFillWithFluid(world, pos, state, fluid);
}

@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (state.get(WATERLOGGED)) {
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
}
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public int getInventorySize() {

@Override
public int getCooldown() {
return 32;
return 16;
}

@Override
Expand Down
10 changes: 8 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "${version}",

"name": "Omni-Hopper",
"description": "Break free from the constraints of normal hoppers. Experience true item transportation freedom.",
"description": "Break free from the constraints of normal hoppers. Experience true item and fluid transportation freedom.",
"authors": [
"enjarai"
],
Expand Down Expand Up @@ -33,11 +33,17 @@
"accessWidener" : "omnihopper.accesswidener",
"depends": {
"cooldown-coordinator": "^0.4.3",
"cicada": "*",
"fabric": "*",
"minecraft": ">=1.19.3- <1.19.5-",
"minecraft": ">=1.19.4- <1.19.5-",
"java": ">=17"
},
"custom": {
"modmenu": {
"links": {
"modmenu.discord": "https://discord.gg/WcYsDDQtyR"
}
},
"projects": {
"modrinth": "i2u9r3li",
"curseforge": 610606
Expand Down

0 comments on commit 9e3b75a

Please sign in to comment.