Compare commits

..

No commits in common. "35001cb9e82fadd6fa8936c77b244c2cb52d36ce" and "95977167e38fa0605afc900b78f8fa552fde8ada" have entirely different histories.

35 changed files with 316 additions and 271 deletions

View file

@ -1,11 +1,3 @@
# 1.3.11+mc1.21.1
* Fixed Farmer not playing well with non-vanilla farmland.
* Added the ability to change the farmers work area with a compass.
* Make blocks still drop items even when broken incorrectly.
* Add AIOT to the necessary tool related item tags (swords, pickaxes, axes, shovels)
* Fix the Engineer Goggles not rendering correctly
* Added the ability for fluid collectors to collect water and lava from filled cauldrons.
# 1.3.10+mc1.21.1
* Fixed Fluid placer not being harvestable.
* PR #1438, Added config to disable energy overlay.

View file

@ -4,7 +4,7 @@ org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=false
mod_version=1.3.11
mod_version=1.3.10
# Forge
game_version=1.21.1

View file

@ -1,4 +1,4 @@
// 1.21.1 2024-11-16T23:02:28.9307514 Tags for minecraft:item mod id actuallyadditions
// 1.21.1 2024-10-31T20:14:02.6354984 Tags for minecraft:item mod id actuallyadditions
87327118c2f16da245b76de4fdcaab149456d9b8 data/actuallyadditions/tags/item/coffee_beans.json
f3ee78cd8c9563bd1828de2b4b336735f289f9f2 data/actuallyadditions/tags/item/crystals.json
441008b49b4bab00125100fc969cb6582eff7271 data/actuallyadditions/tags/item/crystal_blocks.json
@ -38,11 +38,6 @@ fb95ac8041521e1d2879f6fcb652266dcd9e0fb1 data/c/tags/item/storage_blocks/empower
148cd937543fd58b196403c18839b2698bf87fdf data/c/tags/item/storage_blocks/palis_crystal.json
b9aa28a54d47054ba5653bec2f20e0a675ab5120 data/c/tags/item/storage_blocks/restonia_crystal.json
fb4f349bc6fd89f26ef2ba72a9236f05eefd8ea2 data/c/tags/item/storage_blocks/void_crystal.json
67af57742b08793269bb4a594e224a05f55b83e5 data/minecraft/tags/item/axes.json
67af57742b08793269bb4a594e224a05f55b83e5 data/minecraft/tags/item/cluster_max_harvestables.json
67af57742b08793269bb4a594e224a05f55b83e5 data/minecraft/tags/item/pickaxes.json
67af57742b08793269bb4a594e224a05f55b83e5 data/minecraft/tags/item/shovels.json
51d50547b5f031f4fa6e62189af06059a407c009 data/minecraft/tags/item/slabs.json
a60870f29ca48ea0d55ac32620ff5b4bb2f2f62e data/minecraft/tags/item/stairs.json
67af57742b08793269bb4a594e224a05f55b83e5 data/minecraft/tags/item/swords.json
f74407e86c92d0d9435d62ff0f95999f3a84c674 data/minecraft/tags/item/walls.json

View file

@ -1,10 +0,0 @@
{
"values": [
"actuallyadditions:wooden_aiot",
"actuallyadditions:stone_aiot",
"actuallyadditions:iron_aiot",
"actuallyadditions:gold_aiot",
"actuallyadditions:diamond_aiot",
"actuallyadditions:netherite_aiot"
]
}

View file

@ -1,10 +0,0 @@
{
"values": [
"actuallyadditions:wooden_aiot",
"actuallyadditions:stone_aiot",
"actuallyadditions:iron_aiot",
"actuallyadditions:gold_aiot",
"actuallyadditions:diamond_aiot",
"actuallyadditions:netherite_aiot"
]
}

View file

@ -1,10 +0,0 @@
{
"values": [
"actuallyadditions:wooden_aiot",
"actuallyadditions:stone_aiot",
"actuallyadditions:iron_aiot",
"actuallyadditions:gold_aiot",
"actuallyadditions:diamond_aiot",
"actuallyadditions:netherite_aiot"
]
}

View file

@ -1,10 +0,0 @@
{
"values": [
"actuallyadditions:wooden_aiot",
"actuallyadditions:stone_aiot",
"actuallyadditions:iron_aiot",
"actuallyadditions:gold_aiot",
"actuallyadditions:diamond_aiot",
"actuallyadditions:netherite_aiot"
]
}

View file

@ -1,10 +0,0 @@
{
"values": [
"actuallyadditions:wooden_aiot",
"actuallyadditions:stone_aiot",
"actuallyadditions:iron_aiot",
"actuallyadditions:gold_aiot",
"actuallyadditions:diamond_aiot",
"actuallyadditions:netherite_aiot"
]
}

View file

@ -15,7 +15,6 @@ import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.fluids.FluidStack;
import javax.annotation.Nonnull;
@ -39,10 +38,9 @@ public class FuelRecipeGenerator extends RecipeProvider {
addSolid(recipeOutput, "stick", Items.STICK, 2000, 100);
addSolid(recipeOutput, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
addSolid(recipeOutput, "charcoal", Items.CHARCOAL, 32000, 1600);
addSolid(recipeOutput, "coal-block", Tags.Items.STORAGE_BLOCKS_COAL, 320000, 16000);
addSolid(recipeOutput, "coal-block", Items.COAL_BLOCK, 320000, 16000);
addSolid(recipeOutput, "lava", Items.LAVA_BUCKET, 400000, 20000);
recipeOutput.accept(ActuallyAdditions.modLoc("liquid_fuel/canola_oil"), new LiquidFuelRecipe(
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100), null);

View file

@ -120,46 +120,5 @@ public class ItemTagsGenerator extends ItemTagsProvider {
);
tag(ActuallyTags.Items.CURIOS_CHARM).add(ActuallyItems.CRAFTER_ON_A_STICK.get());
tag(ItemTags.SWORDS).add(
ActuallyItems.WOODEN_AIOT.get(),
ActuallyItems.STONE_AIOT.get(),
ActuallyItems.IRON_AIOT.get(),
ActuallyItems.GOLD_AIOT.get(),
ActuallyItems.DIAMOND_AIOT.get(),
ActuallyItems.NETHERITE_AIOT.get()
);
tag(ItemTags.AXES).add(
ActuallyItems.WOODEN_AIOT.get(),
ActuallyItems.STONE_AIOT.get(),
ActuallyItems.IRON_AIOT.get(),
ActuallyItems.GOLD_AIOT.get(),
ActuallyItems.DIAMOND_AIOT.get(),
ActuallyItems.NETHERITE_AIOT.get()
);
tag(ItemTags.PICKAXES).add(
ActuallyItems.WOODEN_AIOT.get(),
ActuallyItems.STONE_AIOT.get(),
ActuallyItems.IRON_AIOT.get(),
ActuallyItems.GOLD_AIOT.get(),
ActuallyItems.DIAMOND_AIOT.get(),
ActuallyItems.NETHERITE_AIOT.get()
);
tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(
ActuallyItems.WOODEN_AIOT.get(),
ActuallyItems.STONE_AIOT.get(),
ActuallyItems.IRON_AIOT.get(),
ActuallyItems.GOLD_AIOT.get(),
ActuallyItems.DIAMOND_AIOT.get(),
ActuallyItems.NETHERITE_AIOT.get()
);
tag(ItemTags.SHOVELS).add(
ActuallyItems.WOODEN_AIOT.get(),
ActuallyItems.STONE_AIOT.get(),
ActuallyItems.IRON_AIOT.get(),
ActuallyItems.GOLD_AIOT.get(),
ActuallyItems.DIAMOND_AIOT.get(),
ActuallyItems.NETHERITE_AIOT.get()
);
}
}

View file

@ -40,6 +40,7 @@ import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
@ -138,12 +139,10 @@ public class ActuallyAdditions {
private void onConfigReload(ModConfigEvent event) {
if (event.getConfig().getType() == ModConfig.Type.COMMON) {
CommonConfig.Other.redstoneConfigureItem =
BuiltInRegistries.ITEM.getOptional(ResourceLocation.tryParse(CommonConfig.Other.REDSTONECONFIGURATOR.get())).orElse(Items.AIR);
CommonConfig.Other.relayConfigureItem =
BuiltInRegistries.ITEM.getOptional(ResourceLocation.tryParse(CommonConfig.Other.RELAYCONFIGURATOR.get())).orElse(Items.AIR);
CommonConfig.Other.farmerConfigureItem =
BuiltInRegistries.ITEM.getOptional(ResourceLocation.tryParse(CommonConfig.Other.FARMERCONFIG.get())).orElse(Items.AIR);
Item item1 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
Item item2 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.RELAYCONFIGURATOR.get()));
CommonConfig.Other.redstoneConfigureItem = item1 != null ? item1 : Items.AIR;
CommonConfig.Other.relayConfigureItem = item2 != null ? item2 : Items.AIR;
}
}

View file

@ -322,15 +322,15 @@ public final class ActuallyBlocks {
(b) -> new AABlockItem(b, defaultBlockItemProperties));
public static BlockBehaviour.Properties miscBlockProperties() {
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).strength(1.5f, 10f);
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().strength(1.5f, 10f);
}
public static BlockBehaviour.Properties defaultPickProps(float hardness, float resistance) {
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).strength(hardness, resistance).sound(SoundType.STONE);
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().strength(hardness, resistance).sound(SoundType.STONE);
}
public static BlockBehaviour.Properties defaultPickProps() {
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).strength(1.5F, 10.0F).sound(SoundType.STONE);
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().strength(1.5F, 10.0F).sound(SoundType.STONE);
}
public static BlockBehaviour.Properties defaultCropProps() {

View file

@ -90,6 +90,24 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
return ItemInteractionResult.CONSUME;
}
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_U;
case DOWN:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_D;
case EAST:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_E;
case SOUTH:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_S;
case WEST:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_W;
default:
return VoxelShapes.AtomicReconstructorShapes.SHAPE_N;
}
}*/
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
@ -121,7 +139,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
@Override
public void appendHoverText(@Nonnull ItemStack pStack, @Nonnull TooltipContext context, @Nonnull List<Component> pTooltip, @Nonnull TooltipFlag pFlag) {
public void appendHoverText(@Nonnull ItemStack pStack, @Nullable TooltipContext context, @Nonnull List<Component> pTooltip, @Nonnull TooltipFlag pFlag) {
super.appendHoverText(pStack, context, pTooltip, pFlag);
long sysTime = System.currentTimeMillis();
@ -151,7 +169,11 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
@Override
protected boolean updateCustomBlockEntityTag(BlockPos pPos, Level pLevel, @Nullable Player pPlayer, ItemStack pStack, BlockState pState) {
return super.updateCustomBlockEntityTag(pPos, pLevel, pPlayer, pStack, pState);
boolean ret = super.updateCustomBlockEntityTag(pPos, pLevel, pPlayer, pStack, pState);
return ret;
}
}

View file

@ -55,7 +55,7 @@ public class BlockColoredLamp extends BlockBase {
private static final BooleanProperty LIT = BlockStateProperties.LIT;
public BlockColoredLamp() {
super(Properties.of().mapColor(MapColor.NONE).instrument(NoteBlockInstrument.HAT).strength(0.5F, 3.0F));
super(Properties.of().mapColor(MapColor.NONE).instrument(NoteBlockInstrument.HAT).strength(0.5F, 3.0F).requiresCorrectToolForDrops());
this.registerDefaultState(this.stateDefinition.any().setValue(LIT, false));
}

View file

@ -100,4 +100,18 @@ public class BlockCrusher extends BlockContainerBase {
? 12
: 0;
}
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(HORIZONTAL_FACING)) {
case EAST:
return VoxelShapes.GrinderShapes.SHAPE_E;
case SOUTH:
return VoxelShapes.GrinderShapes.SHAPE_S;
case WEST:
return VoxelShapes.GrinderShapes.SHAPE_W;
default:
return VoxelShapes.GrinderShapes.SHAPE_N;
}
}*/
}

View file

@ -50,4 +50,22 @@ public class BlockDropper extends FullyDirectionalBlock.Container {
return this.openGui(world, player, pos, TileEntityDropper.class);
}
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
return VoxelShapes.BlockBreakerShapes.SHAPE_U;
case DOWN:
return VoxelShapes.BlockBreakerShapes.SHAPE_D;
case EAST:
return VoxelShapes.BlockBreakerShapes.SHAPE_E;
case SOUTH:
return VoxelShapes.BlockBreakerShapes.SHAPE_S;
case WEST:
return VoxelShapes.BlockBreakerShapes.SHAPE_W;
default:
return VoxelShapes.BlockBreakerShapes.SHAPE_N;
}
}*/
}

View file

@ -58,4 +58,12 @@ public class BlockEnergizer extends BlockContainerBase {
return this.openGui(world, player, pos, TileEntityEnervator.class);
}
}
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
if (this.isEnergizer) {
return VoxelShapes.ENERGIZER_SHAPE;
}
return VoxelShapes.ENERVATOR_SHAPE;
}*/
}

View file

@ -11,16 +11,10 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.blocks.blockhuds.FarmerHud;
import de.ellpeck.actuallyadditions.mod.blocks.blockhuds.IBlockHud;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import net.minecraft.core.BlockPos;
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;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -31,8 +25,7 @@ import net.minecraft.world.phys.BlockHitResult;
import javax.annotation.Nullable;
public class BlockFarmer extends DirectionalBlock.Container implements IHudDisplay {
private static final IBlockHud HUD = new FarmerHud();
public class BlockFarmer extends DirectionalBlock.Container {
public BlockFarmer() {
super(ActuallyBlocks.defaultPickProps().sound(SoundType.METAL));
@ -55,20 +48,17 @@ public class BlockFarmer extends DirectionalBlock.Container implements IHudDispl
return this.openGui(world, player, pos, TileEntityFarmer.class);
}
@Override
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
ItemStack heldItem = player.getItemInHand(hand);
BlockEntity tile = level.getBlockEntity(pos);
if (heldItem.getItem() == CommonConfig.Other.farmerConfigureItem && tile instanceof TileEntityFarmer farmer) {
farmer.cycleArea();
return ItemInteractionResult.SUCCESS;
}
return super.useItemOn(stack, state, level, pos, player, hand, hitResult);
}
@Override
public IBlockHud getHud() {
return HUD;
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
return VoxelShapes.FarmerShapes.SHAPE_E;
case SOUTH:
return VoxelShapes.FarmerShapes.SHAPE_S;
case WEST:
return VoxelShapes.FarmerShapes.SHAPE_W;
default:
return VoxelShapes.FarmerShapes.SHAPE_N;
}
}*/
}

View file

@ -46,4 +46,9 @@ public class BlockFeeder extends BlockContainerBase {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityFeeder.class);
}
/* @Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return VoxelShapes.FEEDER_SHAPE;
}*/
}

View file

@ -39,7 +39,7 @@ import javax.annotation.Nullable;
public class BlockFermentingBarrel extends BlockContainerBase {
public BlockFermentingBarrel() {
super(Properties.of().mapColor(MapColor.WOOD).ignitedByLava().instrument(NoteBlockInstrument.BASS).strength(0.5F, 5.0F).sound(SoundType.WOOD));
super(Properties.of().mapColor(MapColor.WOOD).ignitedByLava().instrument(NoteBlockInstrument.BASS).requiresCorrectToolForDrops().strength(0.5F, 5.0F).sound(SoundType.WOOD));
}
@Nullable

View file

@ -69,4 +69,23 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container {
return this.openGui2(world, player, pos, TileEntityFluidCollector.class);
}
/* @Nonnull
@Override
public VoxelShape getShape(BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull CollisionContext context) {
switch (state.getValue(FACING)) {
case UP:
return VoxelShapes.FluidCollectorShapes.SHAPE_U;
case DOWN:
return VoxelShapes.FluidCollectorShapes.SHAPE_D;
case EAST:
return VoxelShapes.FluidCollectorShapes.SHAPE_E;
case SOUTH:
return VoxelShapes.FluidCollectorShapes.SHAPE_S;
case WEST:
return VoxelShapes.FluidCollectorShapes.SHAPE_W;
default:
return VoxelShapes.FluidCollectorShapes.SHAPE_N;
}
}*/
}

View file

@ -26,7 +26,7 @@ import javax.annotation.Nullable;
public class BlockLeafGenerator extends DirectionalBlock.Container {
public BlockLeafGenerator() {
super(Properties.of().mapColor(MapColor.METAL).strength(5.0F, 10.0F).strength(5.0F, 10.0F).sound(SoundType.METAL));
super(Properties.of().mapColor(MapColor.METAL).strength(5.0F, 10.0F).requiresCorrectToolForDrops().strength(5.0F, 10.0F).sound(SoundType.METAL));
}
@Nullable

View file

@ -0,0 +1,108 @@
///*
// * This file ("BlockMisc.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.blocks;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
//import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
//import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.block.Block;
//import net.minecraft.block.material.Material;
//import net.minecraft.block.properties.PropertyEnum;
//import net.minecraft.block.state.BlockStateContainer;
//import net.minecraft.creativetab.CreativeTabs;
//import net.minecraft.item.EnumRarity;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.NonNullList;
//
//public class BlockMisc extends BlockBase {
//
// public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
// public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
//
// public BlockMisc() {
// super(Material.ROCK);
// this.setHardness(1.5F);
// this.setResistance(10.0F);
// this.setHarvestLevel("pickaxe", 1);
// }
//
// @Override
// public int damageDropped(BlockState state) {
// return this.getMetaFromState(state);
// }
//
// @Override
// public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
// for (int j = 0; j < ALL_MISC_BLOCKS.length; j++) {
// list.add(new ItemStack(this, 1, j));
// }
// }
//
// @Override
// protected ItemBlockBase getItemBlock() {
// return new TheItemBlock(this);
// }
//
// @Override
// public void registerRendering() {
// for (int i = 0; i < ALL_MISC_BLOCKS.length; i++) {
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this, 1, i), this.getRegistryName(), TYPE.getName() + "=" + ALL_MISC_BLOCKS[i].name);
// }
// }
//
// @Override
// public EnumRarity getRarity(ItemStack stack) {
// return stack.getItemDamage() >= ALL_MISC_BLOCKS.length
// ? EnumRarity.COMMON
// : ALL_MISC_BLOCKS[stack.getItemDamage()].rarity;
// }
//
// @Override
// public BlockState getStateFromMeta(int meta) {
// return this.getDefaultState().withProperty(TYPE, TheMiscBlocks.values()[meta]);
// }
//
// @Override
// public int getMetaFromState(BlockState state) {
// return state.getValue(TYPE).ordinal();
// }
//
// @Override
// protected BlockStateContainer createBlockState() {
// return new BlockStateContainer(this, TYPE);
// }
//
// public static class TheItemBlock extends ItemBlockBase {
//
// public TheItemBlock(Block block) {
// super(block);
// this.setHasSubtypes(true);
// this.setMaxDamage(0);
// }
//
// @Override
// public String getTranslationKey(ItemStack stack) {
// return stack.getItemDamage() >= ALL_MISC_BLOCKS.length
// ? StringUtil.BUGGED_ITEM_NAME
// : this.getTranslationKey() + "_" + ALL_MISC_BLOCKS[stack.getItemDamage()].name;
// }
//
// @Override
// public int getItemBurnTime(ItemStack stack) {
// if (stack.getMetadata() == TheMiscBlocks.CHARCOAL_BLOCK.ordinal()) {
// return 16000;
// }
// return super.getItemBurnTime(stack);
// }
// }
//}

View file

@ -22,6 +22,7 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -37,6 +38,7 @@ import net.neoforged.neoforge.fluids.FluidUtil;
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class BlockContainerBase extends Block implements EntityBlock {
public BlockContainerBase(Properties properties) {
@ -140,7 +142,7 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
}
@Override
public void onNeighborChange(@Nonnull BlockState state, @Nonnull LevelReader world, @Nonnull BlockPos pos, @Nonnull BlockPos neighbor) {
public void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor) {
super.onNeighborChange(state, world, pos, neighbor);
if (world instanceof Level) { //TODO what?
this.neighborsChangedCustom((Level) world, pos);
@ -179,9 +181,19 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
this.updateRedstoneState(worldIn, pos);
}
@Nonnull
@Override
public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull Player player) {
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
// if (stack.hasTag()) {
// BlockEntity tile = world.getBlockEntity(pos);
// if (tile instanceof TileEntityBase base) {
// CompoundTag compound = stack.get(DataComponents.BLOCK_ENTITY_DATA).getCompound("Data");
// base.readSyncableNBT(compound, world.registryAccess(), TileEntityBase.NBTType.SAVE_BLOCK); TODO: Check if this is still required
// }
// }
}
@Override
public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
BlockState theState = super.playerWillDestroy(world, pos, state, player);
if (!player.isCreative() && world.getBlockEntity(pos) instanceof TileEntityBase tileBase && tileBase.stopFromDropping) {
if (!world.isClientSide)
@ -192,12 +204,12 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
}
@Override
public boolean hasAnalogOutputSignal(@Nonnull BlockState state) {
public boolean hasAnalogOutputSignal(BlockState state) {
return true;
}
@Override
public int getAnalogOutputSignal(@Nonnull BlockState state, Level world, @Nonnull BlockPos pos) {
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileEntityBase) {
return ((TileEntityBase) tile).getComparatorStrength();
@ -205,14 +217,62 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
return 0;
}
@Nonnull
// TODO: [port]: come back and fix this
// @Override
// public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
// TileEntity tile = world.getTileEntity(pos);
// if (tile instanceof TileEntityBase) {
// TileEntityBase base = (TileEntityBase) tile;
// if (!base.stopFromDropping) {
// CompoundNBT data = new CompoundNBT();
// base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
//
// //Remove unnecessarily saved default values to avoid unstackability
// List<String> keysToRemove = new ArrayList<>();
// for (String key : data.getKeySet()) {
// NBTBase tag = data.getTag(key);
// //Remove only ints because they are the most common ones
// //Add else if below here to remove more types
// if (tag instanceof NBTTagInt) {
// if (((NBTTagInt) tag).getInt() == 0) {
// keysToRemove.add(key);
// }
// }
// }
// for (String key : keysToRemove) {
// data.removeTag(key);
// }
//
// ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
// if (!data.isEmpty()) {
// stack.setTagCompound(new CompoundNBT());
// stack.getTagCompound().setTag("Data", data);
// }
//
// drops.add(stack);
// }
// } else {
// super.getDrops(drops, world, pos, state, fortune);
// }
// }
// TODO: [port]: eval
// @Override
// public EnumBlockRenderType getRenderType(BlockState state) {
// return EnumBlockRenderType.MODEL;
// }
@Override
public RenderShape getRenderShape(@Nonnull BlockState pState) {
public RenderShape getRenderShape(BlockState pState) {
return RenderShape.MODEL;
}
@Override
public void onRemove(BlockState state, @Nonnull Level world, @Nonnull BlockPos pos, BlockState newState, boolean isMoving) {
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
if (this.shouldDropInventory(world, pos)) {
this.dropInventory(world, pos);

View file

@ -1,37 +0,0 @@
package de.ellpeck.actuallyadditions.mod.blocks.blockhuds;
import com.mojang.blaze3d.platform.Window;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
public class FarmerHud implements IBlockHud {
@Override
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult) || minecraft.level == null) {
return;
}
BlockEntity tile = minecraft.level.getBlockEntity(((BlockHitResult) rayCast).getBlockPos());
if (tile instanceof TileEntityFarmer farmer) {
guiGraphics.drawString(minecraft.font, Component.translatable("info.actuallyadditions.farmer.area", farmer.getArea(), farmer.getArea()), (int) (resolution.getGuiScaledWidth() / 2.0f + 5), (int) (resolution.getGuiScaledHeight() / 2.0f - 0), 0xFFFFFF);
Component message;
if (!stack.isEmpty() && stack.getItem() == CommonConfig.Other.farmerConfigureItem) {
message = Component.translatable("info.actuallyadditions.farmer.validItem").withStyle(ChatFormatting.GREEN);
} else {
message = Component.translatable("info.actuallyadditions.farmer.invalidItem", Component.translatable(CommonConfig.Other.farmerConfigureItem.asItem().getDescriptionId()).getString()).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
}
guiGraphics.drawString(minecraft.font, message, (int) (minecraft.getWindow().getGuiScaledWidth() / 2f + 5), (int) (minecraft.getWindow().getGuiScaledHeight() / 2f + 15), 0xFFFFFF);
}
}
}

View file

@ -24,8 +24,8 @@ public class ReconstructorHud implements IBlockHud {
}
BlockEntity tile = minecraft.level.getBlockEntity(((BlockHitResult) rayCast).getBlockPos());
if (tile instanceof TileEntityAtomicReconstructor laser) {
ItemStack slot = laser.inv.getStackInSlot(0);
if (tile instanceof TileEntityAtomicReconstructor) {
ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0);
Component lens_name;
if (slot.isEmpty()) {
lens_name = Component.translatable("info.actuallyadditions.nolens");

View file

@ -107,10 +107,8 @@ public class CommonConfig {
public static ModConfigSpec.BooleanValue MOST_BLAND_PERSON_EVER;
public static ModConfigSpec.ConfigValue<String> REDSTONECONFIGURATOR;
public static ModConfigSpec.ConfigValue<String> RELAYCONFIGURATOR;
public static ModConfigSpec.ConfigValue<String> FARMERCONFIG;
public static Item redstoneConfigureItem = Items.AIR;
public static Item relayConfigureItem = Items.AIR;
public static Item farmerConfigureItem = Items.AIR;
public static void build() {
@ -166,7 +164,6 @@ public class CommonConfig {
REDSTONECONFIGURATOR = BUILDER.comment("define the item used to configure Redstone Mode").define("redstoneConfigurator", "minecraft:redstone_torch");
RELAYCONFIGURATOR = BUILDER.comment("define the item used to configure Direction in laser relays").define("relayConfigurator", "minecraft:compass");
FARMERCONFIG = BUILDER.comment("define the item used to configure the area in a farmer").define("farmerConfigurator", "minecraft:compass");
BUILDER.pop();
}

View file

@ -14,13 +14,11 @@ import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.SingleRecipeInput;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
public class SolidFuelRecipe implements Recipe<SingleRecipeInput> {
public static String NAME = "solid_fuel";
private final Ingredient itemIngredient;
private final int burnTime;
private final int totalEnergy;
private Ingredient itemIngredient;
private int burnTime;
private int totalEnergy;
public SolidFuelRecipe(Ingredient itemIngredient, int totalEnergy, int burnTime) {
this.itemIngredient = itemIngredient;
@ -37,7 +35,7 @@ public class SolidFuelRecipe implements Recipe<SingleRecipeInput> {
}
@Override
public boolean matches(SingleRecipeInput pInv, @Nonnull Level pLevel) {
public boolean matches(SingleRecipeInput pInv, Level pLevel) {
return itemIngredient.test(pInv.getItem(0));
}
@ -50,9 +48,8 @@ public class SolidFuelRecipe implements Recipe<SingleRecipeInput> {
return true;
}
@Nonnull
@Override
public ItemStack assemble(@Nonnull SingleRecipeInput pInv, @Nonnull HolderLookup.Provider registries) {
public ItemStack assemble(SingleRecipeInput pInv, HolderLookup.Provider registries) {
return ItemStack.EMPTY;
}
@ -61,19 +58,16 @@ public class SolidFuelRecipe implements Recipe<SingleRecipeInput> {
return false;
}
@Nonnull
@Override
public ItemStack getResultItem(@Nonnull HolderLookup.Provider provider) {
public ItemStack getResultItem(HolderLookup.Provider provider) {
return ItemStack.EMPTY;
}
@Nonnull
@Override
public RecipeSerializer<?> getSerializer() {
return ActuallyRecipes.SOLID_FUEL_RECIPE.get();
}
@Nonnull
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.SOLID_FUEL.get();
@ -92,13 +86,11 @@ public class SolidFuelRecipe implements Recipe<SingleRecipeInput> {
SolidFuelRecipe.Serializer::toNetwork, SolidFuelRecipe.Serializer::fromNetwork
);
@Nonnull
@Override
public MapCodec<SolidFuelRecipe> codec() {
return CODEC;
}
@Nonnull
@Override
public StreamCodec<RegistryFriendlyByteBuf, SolidFuelRecipe> streamCodec() {
return STREAM_CODEC;

View file

@ -46,7 +46,8 @@ public class ArmorMaterials {
SoundEvents.ARMOR_EQUIP_GENERIC,
() -> Ingredient.EMPTY,
List.of(
new ArmorMaterial.Layer(ActuallyAdditions.modLoc("goggles"), "", true)
new ArmorMaterial.Layer(ActuallyAdditions.modLoc("goggles"), "", true),
new ArmorMaterial.Layer(ActuallyAdditions.modLoc("goggles"), "_overlay", false)
),
0.0F,
0.0F

View file

@ -26,7 +26,10 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CropBlock;
import net.minecraft.world.level.block.StemBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.storage.loot.LootParams;
@ -44,8 +47,8 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
public static boolean defaultPlant(Level world, BlockPos pos, BlockState toPlant, IFarmer farmer, int use) {
if (toPlant != null) {
BlockPos farmland = pos.below();
BlockState targetBlockstate = world.getBlockState(farmland);
if (!(targetBlockstate.getBlock() instanceof FarmBlock) && (targetBlockstate.is(BlockTags.DIRT) || targetBlockstate.is(Blocks.GRASS_BLOCK))) {
BlockState farmlandState = world.getBlockState(farmland);
if (farmlandState.is(BlockTags.DIRT) || farmlandState.is(Blocks.GRASS_BLOCK)) {
world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
useHoeAt(world, farmland);
world.playSound(null, farmland, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F);
@ -180,7 +183,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior {
ItemStack itemstack = getHoeStack();
if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) { //TODO this does nothing. -Flanks
if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) {
return InteractionResult.FAIL;
} else {
// UseOnContext dummyContext = new UseOnContext(world, player, InteractionHand.MAIN_HAND, itemstack, new BlockHitResult(new Vec3(0.5, 0.5, 0.5), Direction.UP, pos, false));

View file

@ -56,8 +56,6 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
private int lastEnergy;
private int area;
public TileEntityFarmer(BlockPos pos, BlockState state) {
super(ActuallyBlocks.FARMER.getTileEntityType(), pos, state, 12);
}
@ -71,7 +69,6 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
compound.putInt("CheckX", this.checkX);
compound.putInt("CheckY", this.checkY);
}
compound.putInt("Area", this.area);
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, lookupProvider, type);
}
@ -85,7 +82,6 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
this.checkX = compound.getInt("CheckX");
this.checkY = compound.getInt("CheckY");
}
this.area = compound.contains("Area") ?compound.getInt("Area"):CommonConfig.Machines.FARMER_AREA.get();
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, lookupProvider, type);
}
@ -101,15 +97,15 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
tile.serverTick();
if (!tile.isRedstonePowered && tile.storage.getEnergyStored() > 0) {
int localArea = Math.min(tile.area, CommonConfig.Machines.FARMER_AREA.get());
if (tile.waitTime > 0) {
tile.waitTime--;
if (tile.waitTime <= 0) {
if (localArea % 2 == 0) {
localArea++;
int area = CommonConfig.Machines.FARMER_AREA.get();
if (area % 2 == 0) {
area++;
}
int radius = localArea / 2;
int radius = area / 2;
BlockPos center = pos.relative(state.getValue(BlockStateProperties.HORIZONTAL_FACING), radius + 1);
@ -198,26 +194,6 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
return this.worldPosition;
}
public int getArea() {
return this.area;
}
public void setArea(int area) {
this.area = Math.min(area, CommonConfig.Machines.FARMER_AREA.get());
}
public int cycleArea() {
if (this.area >= CommonConfig.Machines.FARMER_AREA.get())
this.area = 1;
else
this.area+= 2;
this.checkY = 0; // Reset the current position so we dont go off the rails and plant behind the machine when spamming area changes.
this.checkX = 0;
return this.area;
}
@Override
public int getX() {
return this.worldPosition.getX();

View file

@ -31,11 +31,12 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.FluidType;
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
@ -103,28 +104,6 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing
BlockPos coordsBlock = this.worldPosition.relative(sideToManipulate);
BlockState stateToBreak = this.level.getBlockState(coordsBlock);
// Try cauldron
if(stateToBreak.getBlock() instanceof AbstractCauldronBlock cauldron) {
if (cauldron.isFull(stateToBreak)) {
if (stateToBreak.getBlock() == Blocks.WATER_CAULDRON) {
if (this.tank.fillInternal(new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE) >= FluidType.BUCKET_VOLUME) {
this.tank.fillInternal(new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
level.setBlockAndUpdate(coordsBlock, Blocks.CAULDRON.defaultBlockState());
level.playSound(null, coordsBlock, SoundEvents.BUCKET_FILL, SoundSource.BLOCKS, 1.0F, 1.0F);
return;
}
} else if (stateToBreak.getBlock() == Blocks.LAVA_CAULDRON) {
if (this.tank.fillInternal(new FluidStack(Fluids.LAVA, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE) >= FluidType.BUCKET_VOLUME) {
this.tank.fillInternal(new FluidStack(Fluids.LAVA, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
level.setBlockAndUpdate(coordsBlock, Blocks.CAULDRON.defaultBlockState());
level.playSound(null, coordsBlock, SoundEvents.BUCKET_FILL_LAVA, SoundSource.BLOCKS, 1.0F, 1.0F);
return;
}
}
}
}
Block blockToBreak = stateToBreak.getBlock();
if (!this.isPlacer && FluidType.BUCKET_VOLUME <= this.tank.getCapacity() - this.tank.getFluidAmount()) {
if (blockToBreak instanceof LiquidBlock liquidBlock && liquidBlock.fluid != null && stateToBreak.getFluidState().isSource() ) {

View file

@ -507,9 +507,6 @@
"info.actuallyadditions.redstoneMode.deactivation": "Deactivation",
"info.actuallyadditions.redstoneMode.invalidItem": "Hold a %s to toggle!",
"info.actuallyadditions.redstoneMode.validItem": "Right-Click to toggle!",
"info.actuallyadditions.farmer.validItem": "Right-Click to change area!",
"info.actuallyadditions.farmer.invalidItem": "Hold a %s to modify farming area!",
"info.actuallyadditions.farmer.area": "Area: %dx%d",
"info.actuallyadditions.laserRelay.item.extra": "Priority",
"info.actuallyadditions.laserRelay.item.display.1": "Right-Click to increase!",
"info.actuallyadditions.laserRelay.item.display.2": "Sneak-Right-Click to decrease!",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB