Update libzontreck, update recipes, add directional flag to machines

This commit is contained in:
zontreck 2024-01-11 02:02:28 -07:00
parent f5ba08ab2d
commit 1ff8c7d398
15 changed files with 152 additions and 32 deletions

View file

@ -3,7 +3,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
libzontreck=1.10.010224.1940
libzontreck=1.10.011024.0312
## Environment Properties
@ -49,7 +49,7 @@ mod_name=OTEMod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPLv3
# The mod version. See https://semver.org/
mod_version=1.4.010324.0510
mod_version=1.4.011124.0201
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -9,25 +9,31 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks;
import org.jetbrains.annotations.Nullable;
public class CompressionChamberBlock extends BaseEntityBlock
public class CompressionChamberBlock extends HorizontalDirectionalBlock implements EntityBlock
{
public CompressionChamberBlock(Properties pProperties) {
super(pProperties);
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder);
pBuilder.add(FACING);
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
@ -80,4 +86,15 @@ public class CompressionChamberBlock extends BaseEntityBlock
return createTickerHelper(pBlockEntityType, ModEntities.COMPRESSION_CHAMBER.get(), CompressionChamberBlockEntity::tick);
}
protected static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> pServerType, BlockEntityType<E> pClientType, BlockEntityTicker<? super E> pTicker) {
return pClientType == pServerType ? (BlockEntityTicker<A>) pTicker : null;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
return defaultBlockState().setValue(FACING, pContext.getHorizontalDirection());
}
}

View file

@ -5,29 +5,37 @@ import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.networking.ModMessages;
import dev.zontreck.otemod.networking.packets.EnergySyncS2CPacket;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks;
import javax.annotation.Nullable;
public class ItemScrubberBlock extends BaseEntityBlock
public class ItemScrubberBlock extends HorizontalDirectionalBlock implements EntityBlock
{
public ItemScrubberBlock(Properties p_54120_) {
super(p_54120_);
//registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder);
pBuilder.add(FACING);
}
@Override
public RenderShape getRenderShape(BlockState state)
@ -82,5 +90,13 @@ public class ItemScrubberBlock extends BaseEntityBlock
{
return createTickerHelper(type, ModEntities.ITEM_SCRUBBER.get(), ItemScrubberBlockEntity::tick);
}
protected static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> pServerType, BlockEntityType<E> pClientType, BlockEntityTicker<? super E> pTicker) {
return pClientType == pServerType ? (BlockEntityTicker<A>) pTicker : null;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
return defaultBlockState().setValue(FACING, pContext.getHorizontalDirection().getOpposite());
}
}

View file

@ -9,25 +9,31 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks;
import javax.annotation.Nullable;
public class MagicalScrubberBlock extends BaseEntityBlock
public class MagicalScrubberBlock extends HorizontalDirectionalBlock implements EntityBlock
{
public MagicalScrubberBlock(Properties p_54120_) {
super(p_54120_);
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder);
pBuilder.add(FACING);
}
@Override
public RenderShape getRenderShape(BlockState state)
@ -81,5 +87,16 @@ public class MagicalScrubberBlock extends BaseEntityBlock
{
return createTickerHelper(type, ModEntities.MAGICAL_SCRUBBER.get(), MagicalScrubberBlockEntity::tick);
}
protected static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> pServerType, BlockEntityType<E> pClientType, BlockEntityTicker<? super E> pTicker) {
return pClientType == pServerType ? (BlockEntityTicker<A>) pTicker : null;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
return defaultBlockState().setValue(FACING, pContext.getHorizontalDirection().getOpposite());
}
}

View file

@ -69,7 +69,7 @@ public class CompressionChamberBlockEntity extends BlockEntity implements MenuPr
protected final ContainerData data;
protected int progress=0;
public static final int MAXIMUM_PROCESSING_TICKS = 750;
public static int PROCESSING_TICKS = 80;
protected final ItemStackHandler itemsHandler = new ItemStackHandler(1){
@Override
@ -99,7 +99,7 @@ public class CompressionChamberBlockEntity extends BlockEntity implements MenuPr
};
private static final int ENERGY_REQUIREMENT = 7500;
private static int ENERGY_REQUIREMENT = 750;
private LazyOptional<IEnergyStorage> lazyEnergyHandler = LazyOptional.empty();
@ -207,7 +207,7 @@ public class CompressionChamberBlockEntity extends BlockEntity implements MenuPr
setChanged(lvl, pos, state);
drain(entity);
if(entity.progress >= CompressionChamberBlockEntity.MAXIMUM_PROCESSING_TICKS)
if(entity.progress >= CompressionChamberBlockEntity.PROCESSING_TICKS)
{
craftItem(entity);
}
@ -275,7 +275,14 @@ public class CompressionChamberBlockEntity extends BlockEntity implements MenuPr
Optional<CompressionChamberRecipe> recipe = entity.level.getRecipeManager().getRecipeFor(CompressionChamberRecipe.Type.INSTANCE, inventory, entity.level);
return recipe.isPresent() && canInsertIntoOutput(output, recipe.get().getResultItem(entity.level.registryAccess()));
boolean ret = recipe.isPresent() && canInsertIntoOutput(output, recipe.get().getResultItem(entity.level.registryAccess()));
if(ret)
{
PROCESSING_TICKS = recipe.get().getTime();
}
return ret;
}
private static boolean canInsertIntoOutput(SimpleContainer inventory, ItemStack result) {

View file

@ -60,7 +60,7 @@ public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
};
private static final int ENERGY_REQ = 15000;
private static final int ENERGY_REQ = 1500;
private LazyOptional<IEnergyStorage> lazyEnergyHandler = LazyOptional.empty();
private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty();
@ -100,7 +100,7 @@ public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
protected final ContainerData data;
private int progress = 0;
public static final int MAXIMUM_PROCESSING_TICKS = 750;
public static final int MAXIMUM_PROCESSING_TICKS = 250;
@Override

View file

@ -66,7 +66,7 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
};
private static final int ENERGY_REQ = 10000;
private static final int ENERGY_REQ = 1000;
private LazyOptional<IEnergyStorage> lazyEnergyHandler = LazyOptional.empty();
private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty();
@ -106,7 +106,7 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
protected final ContainerData data;
private int progress = 0;
public static final int MAXIMUM_PROCESSING_TICKS = 1750;
public static final int MAXIMUM_PROCESSING_TICKS = 175;
@Override

View file

@ -16,12 +16,14 @@ public class CompressionChamberRecipe implements Recipe<SimpleContainer> {
private final ResourceLocation id;
private final ItemStack output;
private final Ingredient input;
private final int seconds;
public CompressionChamberRecipe(ResourceLocation id, ItemStack output, Ingredient input)
public CompressionChamberRecipe(ResourceLocation id, ItemStack output, Ingredient input, int seconds)
{
this.id=id;
this.output=output;
this.input=input;
this.seconds=seconds;
}
@Override
@ -61,6 +63,10 @@ public class CompressionChamberRecipe implements Recipe<SimpleContainer> {
return Type.INSTANCE;
}
public int getTime() {
return seconds*20;
}
public static class Type implements RecipeType<CompressionChamberRecipe> {
private Type(){}
@ -79,7 +85,9 @@ public class CompressionChamberRecipe implements Recipe<SimpleContainer> {
Ingredient input = Ingredient.fromJson(GsonHelper.getAsJsonObject(jsonObject, "input"));
return new CompressionChamberRecipe(resourceLocation, output, input);
int seconds = GsonHelper.getAsInt(jsonObject, "time");
return new CompressionChamberRecipe(resourceLocation, output, input, seconds);
}
@Override
@ -87,13 +95,16 @@ public class CompressionChamberRecipe implements Recipe<SimpleContainer> {
ItemStack output = friendlyByteBuf.readItem();
Ingredient input = Ingredient.fromNetwork(friendlyByteBuf);
return new CompressionChamberRecipe(resourceLocation, output, input);
int seconds = friendlyByteBuf.readInt();
return new CompressionChamberRecipe(resourceLocation, output, input, seconds);
}
@Override
public void toNetwork(FriendlyByteBuf friendlyByteBuf, CompressionChamberRecipe compressionChamberRecipe) {
friendlyByteBuf.writeItem(compressionChamberRecipe.output);
compressionChamberRecipe.input.toNetwork(friendlyByteBuf);
friendlyByteBuf.writeInt(compressionChamberRecipe.seconds);
}
}
}

View file

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "otemod:block/compression_chamber"
},
"facing=east": {
"model": "otemod:block/compression_chamber",
"y": 90
},
"facing=south": {
"model": "otemod:block/compression_chamber",
"y": 180
},
"facing=west": {
"model": "otemod:block/compression_chamber",
"y": 270
}
}
}

View file

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "otemod:block/item_scrubber"
},
"facing=east": {
"model": "otemod:block/item_scrubber",
"y": 90
},
"facing=south": {
"model": "otemod:block/item_scrubber",
"y": 180
},
"facing=west": {
"model": "otemod:block/item_scrubber",
"y": 270
}
}
}

View file

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "otemod:block/magical_scrubber"
},
"facing=east": {
"model": "otemod:block/magical_scrubber",
"y": 90
},
"facing=south": {
"model": "otemod:block/magical_scrubber",
"y": 180
},
"facing=west": {
"model": "otemod:block/magical_scrubber",
"y": 270
}
}
}

View file

@ -4,6 +4,8 @@
"item": "minecraft:obsidian"
},
"output": {
"item": "otemod:compressed_obsidian_sheet"
}
"item": "otemod:compressed_obsidian_sheet",
"count": 2
},
"time": 10
}

View file

@ -1,9 +1,11 @@
{
"type": "otemod:compressing",
"output": {
"item": "otemod:layered_compressed_obsidian_sheet"
"item": "otemod:layered_compressed_obsidian_sheet",
"count": 2
},
"input": {
"item": "otemod:compressed_obsidian_block"
}
},
"time": 20
}

View file

@ -5,5 +5,6 @@
},
"input": {
"item": "otemod:layered_compressed_obsidian_block"
}
},
"time": 60
}

View file

@ -0,0 +1,11 @@
{
"type": "minecraft:smelting",
"ingredient": [
{
"item": "minecraft:rotten_flesh"
}
],
"result": "minecraft:leather",
"experience": 3,
"cookingtime": 7
}