Compare commits

...

16 commits

Author SHA1 Message Date
Mrbysco
154add17bd Remove (wip) from drill core 2024-03-13 03:39:01 +01:00
Mrbysco
b94353019c Setup loot modifiers (Numbers need tweaking) 2024-03-13 03:38:20 +01:00
Mrbysco
f390ffd47f Add drill highlighting 2024-03-13 01:50:37 +01:00
Mrbysco
5a1eabeac4 Fix hopping item interface 2024-03-13 01:02:49 +01:00
Mrbysco
26758cb41b Update TileEntityBase.java 2024-03-13 00:30:34 +01:00
Mrbysco
bd392b0a5b Add back directionality to the hopping item interface 2024-03-13 00:28:41 +01:00
Flanks255
b8e284d947 Bandaid on hopping item interface.
Fixed phantomface capability invalidation.
2024-03-12 17:43:16 -05:00
Flanks255
f471f4f1fa Added Ancient debris to mining lens. 2024-03-12 17:15:56 -05:00
Mrbysco
f76db7ba65 Remove unused imports 2024-03-12 22:51:28 +01:00
Mrbysco
d64b530f8d Last I18n replacement 2024-03-12 22:39:01 +01:00
Mrbysco
b866f50e8f Add Mining Lens category 2024-03-12 22:21:17 +01:00
Mrbysco
87b4e29534 Merge branch '1.20.4' of https://github.com/Ellpeck/ActuallyAdditions into 1.20.4 2024-03-12 21:31:32 +01:00
Mrbysco
3a767e1894 Replace more calls to I18n with Component.translatable
Fix up the Relay item Whitelist GUI
2024-03-12 21:31:29 +01:00
Flanks255
e1cd1b42ad Added mining lens recipe for Black Quartz ore
Added mining lens recipes for some other mods ores.
2024-03-12 14:57:44 -05:00
Mrbysco
d1ceffcac9 Update BlockLaserRelay.java 2024-03-12 20:37:25 +01:00
Mrbysco
0226078aee Use Components for the Laser Relays instead of String using I18n 2024-03-12 20:37:07 +01:00
65 changed files with 1068 additions and 99 deletions

View file

@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Actually Additions
mod_version=1.2.5
mod_version=1.2.6
# Forge
game_version=1.20.4

View file

@ -0,0 +1,4 @@
// 1.20.4 2024-03-13T03:30:52.2359302 Global Loot Modifiers : actuallyadditions
c314f845c2f475a0e11bbbeaf9ce082f283e84ed data/actuallyadditions/loot_modifiers/bat_loot.json
f77519b3b0453bb66d43569f8c67e59de6e49a2f data/actuallyadditions/loot_modifiers/dungeon_loot.json
24211d6853742ccd8fc0116f93710ef5ee759c29 data/neoforge/loot_modifiers/global_loot_modifiers.json

View file

@ -1,6 +1,8 @@
// 1.20.4 2024-03-12T20:08:36.1633314 Mining Lens Recipes
// 1.20.4 2024-03-12T17:06:32.3158961 Mining Lens Recipes
7341f498818439ac0a9272a1beaa8f19389012ef data/actuallyadditions/recipes/mininglens/nether_ancient_debris.json
411b455c637359f1f46df6fced8cd7558436e938 data/actuallyadditions/recipes/mininglens/nether_nether_gold_ore.json
7227ee2a53f520facb7fe8f7b34a1a74c9a49e85 data/actuallyadditions/recipes/mininglens/nether_nether_quartz_ore.json
de47fcc5b2acc4f0511e95de63b9b084a2dfbaad data/actuallyadditions/recipes/mininglens/stone_black_quartz_ore.json
550a0fe3577fcdaf0e1af1b2e3a518256992e00b data/actuallyadditions/recipes/mininglens/stone_coal_ore.json
869a51e0fc919b7a4577bb7c466ca07a6ae0370b data/actuallyadditions/recipes/mininglens/stone_diamond_ore.json
f74f71eb82bc63538662217d9b0eb136bd262618 data/actuallyadditions/recipes/mininglens/stone_emerald_ore.json

View file

@ -0,0 +1,12 @@
{
"type": "actuallyadditions:bat_loot",
"conditions": [
{
"condition": "minecraft:killed_by_player"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:entities/bat"
}
]
}

View file

@ -0,0 +1,46 @@
{
"type": "actuallyadditions:dungeon_loot",
"conditions": [
{
"condition": "minecraft:any_of",
"terms": [
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/simple_dungeon"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/abandoned_mineshaft"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/village/village_weaponsmith"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/stronghold_library"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/igloo_chest"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/desert_pyramid"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/nether_bridge"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/end_city_treasure"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/woodland_mansion"
}
]
}
]
}

View file

@ -0,0 +1,10 @@
{
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:netherrack"
},
"result": {
"item": "minecraft:ancient_debris"
},
"weight": 1
}

View file

@ -0,0 +1,10 @@
{
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "actuallyadditions:black_quartz_ore"
},
"weight": 3000
}

View file

@ -0,0 +1,7 @@
{
"entries": [
"actuallyadditions:dungeon_loot",
"actuallyadditions:bat_loot"
],
"replace": false
}

View file

@ -66,6 +66,8 @@ public class ActuallyAdditionsData {
generator.addProvider(true, new PachouliGenerator(packOutput));
generator.addProvider(true, new GlobalLootModifierGenerator(packOutput));
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
packOutput, patchedProvider, Set.of(ActuallyAdditions.MODID)));
}

View file

@ -0,0 +1,42 @@
package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.lootmodifier.BatLootModifier;
import de.ellpeck.actuallyadditions.mod.lootmodifier.DungeonLootModifier;
import net.minecraft.data.PackOutput;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.predicates.AnyOfCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemKilledByPlayerCondition;
import net.neoforged.neoforge.common.data.GlobalLootModifierProvider;
import net.neoforged.neoforge.common.loot.LootTableIdCondition;
public class GlobalLootModifierGenerator extends GlobalLootModifierProvider {
public GlobalLootModifierGenerator(PackOutput packOutput) {
super(packOutput, ActuallyAdditions.MODID);
}
@Override
protected void start() {
this.add("bat_loot", new BatLootModifier(
new LootItemCondition[]{
LootItemKilledByPlayerCondition.killedByPlayer().build(),
LootTableIdCondition.builder(EntityType.BAT.getDefaultLootTable()).build()
}));
this.add("dungeon_loot", new DungeonLootModifier(
new LootItemCondition[]{
AnyOfCondition.anyOf(
LootTableIdCondition.builder(BuiltInLootTables.SIMPLE_DUNGEON),
LootTableIdCondition.builder(BuiltInLootTables.ABANDONED_MINESHAFT),
LootTableIdCondition.builder(BuiltInLootTables.VILLAGE_WEAPONSMITH),
LootTableIdCondition.builder(BuiltInLootTables.STRONGHOLD_LIBRARY),
LootTableIdCondition.builder(BuiltInLootTables.IGLOO_CHEST),
LootTableIdCondition.builder(BuiltInLootTables.DESERT_PYRAMID),
LootTableIdCondition.builder(BuiltInLootTables.NETHER_BRIDGE),
LootTableIdCondition.builder(BuiltInLootTables.END_CITY_TREASURE),
LootTableIdCondition.builder(BuiltInLootTables.WOODLAND_MANSION)
).build()
}));
}
}

View file

@ -1,6 +1,7 @@
package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.data.PackOutput;
@ -64,5 +65,7 @@ public class MiningLensGenerator extends RecipeProvider {
buildStoneOre(consumer, 200, Items.REDSTONE_ORE);
buildStoneOre(consumer, 30, Items.EMERALD_ORE);
buildNetherOre(consumer, 3000, Items.NETHER_QUARTZ_ORE);
buildStoneOre(consumer, 3000, ActuallyBlocks.BLACK_QUARTZ_ORE.getItem());
buildNetherOre(consumer, 1, Items.ANCIENT_DEBRIS);
}
}

View file

@ -35,6 +35,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.Worm;
import de.ellpeck.actuallyadditions.mod.lootmodifier.ActuallyLootModifiers;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
@ -116,6 +117,7 @@ public class ActuallyAdditions {
ActuallyVillagers.init(eventBus);
ActuallyPOITypes.init(eventBus);
ActuallyAttachments.init(eventBus);
ActuallyLootModifiers.init(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus);
CONDITION_CODECS.register(eventBus);

View file

@ -12,20 +12,30 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
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.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable;
public class BlockItemInterfaceHopping extends BlockItemInterface {
public static final DirectionProperty FACING = BlockStateProperties.FACING_HOPPER;
public BlockItemInterfaceHopping() {
super();
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.DOWN));
}
@Override
@ -44,4 +54,26 @@ public class BlockItemInterfaceHopping extends BlockItemInterface {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> entityType) {
return level.isClientSide? TileEntityItemInterfaceHopping::clientTick : TileEntityItemInterfaceHopping::serverTick;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
Direction direction = pContext.getClickedFace().getOpposite();
return this.defaultBlockState()
.setValue(FACING, direction.getAxis() == Direction.Axis.Y ? Direction.DOWN : direction);
}
@Override
public BlockState rotate(BlockState pState, Rotation pRotation) {
return pState.setValue(FACING, pRotation.rotate(pState.getValue(FACING)));
}
@Override
public BlockState mirror(BlockState pState, Mirror pMirror) {
return pState.rotate(pMirror.getRotation(pState.getValue(FACING)));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
pBuilder.add(FACING);
}
}

View file

@ -32,8 +32,8 @@ import io.netty.util.internal.ConcurrentSet;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
@ -208,20 +208,20 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
BlockPos pos = ((BlockHitResult) rayCast).getBlockPos();
if (minecraft.level != null) {
boolean wearing = ItemEngineerGoggles.isWearing(player);
if (wearing || StackUtil.isValid(stack)) {
if (wearing || !stack.isEmpty()) {
boolean compass = stack.getItem() == CommonConfig.Other.relayConfigureItem;
if (wearing || compass || stack.getItem() instanceof ItemLaserWrench) {
BlockEntity tile = minecraft.level.getBlockEntity(pos);
if (tile instanceof TileEntityLaserRelay relay) {
String strg = relay.getExtraDisplayString();
Component strg = relay.getExtraDisplayString();
guiGraphics.drawString(minecraft.font, strg, (int) (resolution.getGuiScaledWidth() / 2f + 5), (int) (resolution.getGuiScaledHeight() / 2f + 5), 0xFFFFFF);
String expl;
Component expl;
if (compass) {
expl = relay.getCompassDisplayString();
} else {
expl = ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", I18n.get(CommonConfig.Other.relayConfigureItem.getDescriptionId()));
expl = Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", Component.translatable(CommonConfig.Other.relayConfigureItem.getDescriptionId()).getString()).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
}
guiGraphics.drawString(minecraft.font, expl, (int) (resolution.getGuiScaledWidth() / 2f + 5), (int) (resolution.getGuiScaledHeight() / 2f + 15), 0xFFFFFF);

View file

@ -19,7 +19,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
@ -154,7 +153,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
BlockEntity tile = minecraft.level.getBlockEntity(pos);
if (tile != null) {
if (tile instanceof IPhantomTile phantom) {
guiGraphics.drawString(minecraft.font, ChatFormatting.GOLD + I18n.get("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, ChatFormatting.WHITE.getColor());
guiGraphics.drawString(minecraft.font, Component.translatable("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc").append(": " + phantom.getRange()).withStyle(ChatFormatting.GOLD), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, ChatFormatting.WHITE.getColor());
if (phantom.hasBoundPosition()) {
int distance = Mth.ceil(new Vec3(pos.getX(), pos.getY(), pos.getZ()).distanceTo(new Vec3(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ())));
BlockState state = minecraft.level.getBlockState(phantom.getBoundPosition());
@ -171,7 +170,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
}
} else {
guiGraphics.drawString(minecraft.font, ChatFormatting.RED + I18n.get("tooltip.actuallyadditions.phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, ChatFormatting.WHITE.getColor());
guiGraphics.drawString(minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.notConnected.desc").withStyle(ChatFormatting.RED), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, ChatFormatting.WHITE.getColor());
}
}
}

View file

@ -23,8 +23,8 @@ import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.neoforged.api.distmarker.Dist;
@ -58,7 +58,7 @@ public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBo
Font font = Minecraft.getInstance().font;
String energyTotal = Lang.cleanEnergyValues(cap, false);
String energyName = I18n.get("misc.actuallyadditions.power_name_long");
Component energyName = Component.translatable("misc.actuallyadditions.power_name_long");
float backgroundOpacity = Minecraft.getInstance().options.getBackgroundOpacity(0.25F);
int j = (int) (backgroundOpacity * 255.0F) << 24;

View file

@ -87,6 +87,7 @@ public class CommonConfig {
public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK;
public static ModConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
public static ModConfigSpec.BooleanValue DO_CAT_DROPS;
public static ModConfigSpec.BooleanValue DO_BAT_DROPS;
public static ModConfigSpec.IntValue FUR_CHANCE;
public static ModConfigSpec.BooleanValue WORMS;
public static ModConfigSpec.IntValue WORMS_DIE_TIME;
@ -121,6 +122,9 @@ public class CommonConfig {
DO_CAT_DROPS = BUILDER.comment("If true, Cats drop Hairy Balls Occasionally.")
.define("doCatDrops", true);
DO_BAT_DROPS = BUILDER.comment("Should Bat wings drop from Bats?")
.define("doBatDrops", true);
FUR_CHANCE = BUILDER.comment("The 1/n drop chance, per tick, for a fur ball to be dropped.")
.defineInRange("furDropChance", 5000, 1, Integer.MAX_VALUE);

View file

@ -12,35 +12,46 @@ package de.ellpeck.actuallyadditions.mod.event;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
import de.ellpeck.actuallyadditions.mod.items.DrillItem;
import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade;
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
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.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent;
import net.neoforged.neoforge.client.event.RenderHighlightEvent;
import net.neoforged.neoforge.client.gui.overlay.GuiOverlayManager;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;
import java.util.List;
@OnlyIn(Dist.CLIENT)
public class ClientEvents {
@ -193,16 +204,17 @@ public class ClientEvents {
if (tileHit instanceof TileEntityBase base) {
if (base.isRedstoneToggle()) {
String strg = String.format("%s: %s", I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode"), ChatFormatting.DARK_RED + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode
Component component = Component.translatable("info." + ActuallyAdditions.MODID + ".redstoneMode").append(": ")
.append(Component.translatable("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode
? "pulse"
: "deactivation")) + ChatFormatting.RESET);
guiGraphics.drawString(font, strg, (int) (event.getWindow().getGuiScaledWidth() / 2f + 5), (int) (event.getWindow().getGuiScaledHeight() / 2f + 5), 0xFFFFFF);
: "deactivation")).withStyle(ChatFormatting.DARK_RED));
guiGraphics.drawString(font, component, (int) (event.getWindow().getGuiScaledWidth() / 2f + 5), (int) (event.getWindow().getGuiScaledHeight() / 2f + 5), 0xFFFFFF);
String expl;
Component expl;
if (!stack.isEmpty() && stack.getItem() == CommonConfig.Other.redstoneConfigureItem) {
expl = ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem");
expl = Component.translatable("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem").withStyle(ChatFormatting.GREEN);
} else {
expl = ChatFormatting.GRAY.toString() + ChatFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", I18n.get(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId()));
expl = Component.translatable("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", Component.translatable(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId()).getString()).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
}
guiGraphics.drawString(font, expl, (int) (event.getWindow().getGuiScaledWidth() / 2f + 5), (int) (event.getWindow().getGuiScaledHeight() / 2f + 15), 0xFFFFFF);
}
@ -227,6 +239,46 @@ public class ClientEvents {
}
}
@SubscribeEvent
public void renderBlockHighlight(RenderHighlightEvent.Block event) {
Minecraft mc = Minecraft.getInstance();
Player player = mc.player;
if (mc.player == null)
return;
ItemStack stack = player.getMainHandItem();
if (stack.getItem() instanceof DrillItem drillItem) {
if (!player.isShiftKeyDown() && drillItem.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) {
Level level = player.level();
Vec3 vec3 = event.getCamera().getPosition();
double d0 = vec3.x();
double d1 = vec3.y();
double d2 = vec3.z();
BlockHitResult blockHitResult = event.getTarget();
BlockPos targetPos = blockHitResult.getBlockPos();
BlockState blockState = level.getBlockState(targetPos);
VertexConsumer lineConsumer = event.getMultiBufferSource().getBuffer(RenderType.lines());
if (stack.isCorrectToolForDrops(blockState)) {
int radius = 0;
if (drillItem.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)) {
radius = 2;
} else if (drillItem.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) {
radius = 1;
}
if (radius == 0) return; //No radius, no need to render extra hitboxes
List<BlockPos> coords = drillItem.gatherBreakingPositions(stack, radius, level, targetPos, blockHitResult.getDirection(), player);
for (BlockPos blockPos : coords) {
if (blockPos.equals(targetPos)) continue; //Let the original event draw this one!
AssetUtil.renderHitOutline(event.getPoseStack(), lineConsumer, player, d0, d1, d2, level, blockPos, level.getBlockState(blockPos));
}
}
}
}
}
/* @SubscribeEvent //TODO someday move the laser rendering to a new system
public void onRenderStage(final RenderLevelStageEvent event) {
if(event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS) {

View file

@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;

View file

@ -11,11 +11,9 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
@ -38,7 +36,7 @@ public class GuiDrill extends AAScreen<ContainerDrill> {
@Override
public void renderLabels(@Nonnull GuiGraphics guiGraphics, int x, int y) {
AssetUtil.displayNameString(guiGraphics, this.font, this.imageWidth, -10, I18n.get("container." + ActuallyAdditions.MODID + ".drill"));
AssetUtil.displayNameString(guiGraphics, this.font, this.imageWidth, -10, this.title.getString());
}
@Override

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;

View file

@ -11,11 +11,9 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
@ -37,7 +35,7 @@ public class GuiFilter extends AAScreen<ContainerFilter> {
@Override
public void renderLabels(@Nonnull GuiGraphics guiGraphics, int x, int y) {
AssetUtil.displayNameString(guiGraphics, this.font, this.imageWidth, -10, I18n.get("container." + ActuallyAdditions.MODID + ".filter"));
AssetUtil.displayNameString(guiGraphics, this.font, this.imageWidth, -10, this.title.getString());
}
@Override

View file

@ -13,23 +13,34 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.entity.player.Inventory;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.PacketDistributor;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
@OnlyIn(Dist.CLIENT)
public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItemWhitelist> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_laser_relay_item_whitelist");
private final Component inboundText = Component.translatable("info." + ActuallyAdditions.MODID + ".gui.inbound");
private final Component outboundText = Component.translatable("info." + ActuallyAdditions.MODID + ".gui.outbound");
private final TileEntityLaserRelayItemAdvanced tile;
private FilterSettingsGui leftFilter;
@ -57,43 +68,53 @@ public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItem
public void init() {
super.init();
// this.leftFilter = new FilterSettingsGui(this.tile.leftFilter, this.leftPos + 3, this.topPos + 6, this.buttonList);
// this.rightFilter = new FilterSettingsGui(this.tile.rightFilter, this.leftPos + 157, this.topPos + 6, this.buttonList);
//
// this.buttonSmartWhitelistLeft = new Buttons.SmallerButton(2, this.leftPos + 3, this.topPos + 79, "S");
// this.buttonSmartWhitelistRight = new Buttons.SmallerButton(3, this.leftPos + 157, this.topPos + 79, "S");
// this.addButton(this.buttonSmartWhitelistLeft);
// this.addButton(this.buttonSmartWhitelistRight);
this.leftFilter = new FilterSettingsGui(this.tile.leftFilter, this.leftPos + 3, this.topPos + 6, this::addRenderableWidget, this::buttonClicked, 0);
this.rightFilter = new FilterSettingsGui(this.tile.rightFilter, this.leftPos + 157, this.topPos + 6, this::addRenderableWidget, this::buttonClicked, 4);
this.buttonSmartWhitelistLeft = this.addRenderableWidget(Button.builder(
Component.literal("S"),
(button) -> {
PacketHandlerHelper.sendButtonPacket(this.tile, 2);
}).bounds(this.leftPos + 3, this.topPos + 79, 16, 16)
.build());
this.buttonSmartWhitelistRight = this.addRenderableWidget(Button.builder(
Component.literal("S"),
(button) -> {
PacketHandlerHelper.sendButtonPacket(this.tile, 3);
}).bounds(this.leftPos + 157, this.topPos + 79, 16, 16)
.build());
}
public void buttonClicked(int id) {
CompoundTag data = new CompoundTag();
data.putInt("ButtonID", id);
data.putInt("PlayerID", Minecraft.getInstance().player.getId());
data.putString("WorldID", Minecraft.getInstance().level.dimension().location().toString());
PacketDistributor.SERVER.noArg().send(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER));
}
//
// @Override
// public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.tile, button.id);
// }
@Override
public void render(@Nonnull GuiGraphics guiGraphics, int x, int y, float f) {
super.render(guiGraphics, x, y, f);
//
// if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
// List<String> list = new ArrayList<>();
// list.add(TextFormatting.BOLD + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smart"));
// list.addAll(this.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.smartInfo"), 200));
// this.drawHoveringText(list, x, y); //renderComponentTooltip
// }
public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
super.render(guiGraphics, mouseX, mouseY, partialTicks);
this.leftFilter.drawHover(guiGraphics, x, y);
this.rightFilter.drawHover(guiGraphics, x, y);
if (this.buttonSmartWhitelistLeft.isMouseOver(mouseX, mouseY) || this.buttonSmartWhitelistRight.isMouseOver(mouseX, mouseY)) {
List<FormattedCharSequence> list = new ArrayList<>();
list.add(Component.translatable("info." + ActuallyAdditions.MODID + ".gui.smart").withStyle(ChatFormatting.BOLD).getVisualOrderText());
list.addAll(this.font.split(Component.translatable("info." + ActuallyAdditions.MODID + ".gui.smartInfo"), 200));
guiGraphics.renderTooltip(this.font, list, mouseX, mouseY); //renderTooltip
}
this.leftFilter.drawHover(guiGraphics, mouseX, mouseY);
this.rightFilter.drawHover(guiGraphics, mouseX, mouseY);
}
@Override
public void renderLabels(@Nonnull GuiGraphics guiGraphics, int x, int y) {
AssetUtil.displayNameString(guiGraphics, this.font, this.imageWidth, -10, this.tile);
AssetUtil.displayNameString(guiGraphics, this.font, this.imageWidth, -10, this.title.getString());
String s1 = I18n.get("info." + ActuallyAdditions.MODID + ".gui.inbound");
String s2 = I18n.get("info." + ActuallyAdditions.MODID + ".gui.outbound");
guiGraphics.drawString(font, s1, 46 - this.font.width(s1) / 2, 80, 0x404040, false);
guiGraphics.drawString(font, s2, 131 - this.font.width(s2) / 2, 80, 0x404040, false);
guiGraphics.drawString(font, inboundText, 46 - this.font.width(inboundText) / 2, 80, 0x404040, false);
guiGraphics.drawString(font, outboundText, 131 - this.font.width(outboundText) / 2, 80, 0x404040, false);
}
@Override
@ -103,6 +124,5 @@ public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItem
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86);
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);
}
}

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
@ -70,7 +69,7 @@ public class GuiOilGenerator extends AAScreen<ContainerOilGenerator> {
}
if (this.generator.maxBurnTime > 0 && this.generator.currentEnergyProduce > 0) {
guiGraphics.drawCenteredString(this.font, this.generator.currentEnergyProduce + " " + I18n.get("misc.actuallyadditions.energy_tick"), this.leftPos + 87, this.topPos + 65, 0xFFFFFF);
guiGraphics.drawCenteredString(this.font, Component.literal(this.generator.currentEnergyProduce + " ").append(Component.translatable("misc.actuallyadditions.energy_tick")), this.leftPos + 87, this.topPos + 65, 0xFFFFFF);
guiGraphics.drawCenteredString(this.font, "for " + this.generator.maxBurnTime + " t", this.leftPos + 87, this.topPos + 75, 0xFFFFFF);
PoseStack poseStack = guiGraphics.pose();
poseStack.pushPose();

View file

@ -54,6 +54,7 @@ import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class DrillItem extends ItemEnergy {
@ -174,7 +175,7 @@ public class DrillItem extends ItemEnergy {
@Override
public InteractionResultHolder<ItemStack> use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) {
if (!world.isClientSide && player.isShiftKeyDown() && hand == InteractionHand.MAIN_HAND) {
player.openMenu(new SimpleMenuProvider((id, inv, p) -> new ContainerDrill(id, inv), Component.literal("")));
player.openMenu(new SimpleMenuProvider((id, inv, p) -> new ContainerDrill(id, inv), Component.translatable("container." + ActuallyAdditions.MODID + ".drill")));
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
}
return new InteractionResultHolder<>(InteractionResult.PASS, player.getItemInHand(hand));
@ -457,6 +458,77 @@ public class DrillItem extends ItemEnergy {
return true;
}
/**
* Generate a list of block positions that can be broken taking radius, poker and side into account
* @param stack The Drill
* @param radius The Radius to break Blocks in (0 means only 1 Block will be broken!)
* @param world The World
* @param aPos The position of the block being broken
* @param side The side of the block being broken
* @param player The Player who breaks the Blocks
* @return A list of block positions that can be broken
*/
public List<BlockPos> gatherBreakingPositions(ItemStack stack, int radius, Level world, BlockPos aPos, Direction side, Player player) {
int energyStored = this.getEnergyStored(stack);
List<BlockPos> positions = new ArrayList<>();
int xRange = radius;
int yRange = radius;
int zRange = 0;
//Corrects Blocks to hit depending on Side of original Block hit
if (side.getAxis() == Direction.Axis.Y) {
zRange = radius;
yRange = 0;
}
if (side.getAxis() == Direction.Axis.X) {
xRange = 0;
zRange = radius;
}
//Not defined later because main Block is getting broken below
BlockState state = world.getBlockState(aPos);
float mainHardness = state.getDestroySpeed(world, aPos);
//Break Middle Block first
int use = this.getEnergyUsePerBlock(stack);
if (energyStored < use) {
return positions;
}
if (radius == 2 && side.getAxis() != Direction.Axis.Y) {
aPos = aPos.above();
BlockState theState = world.getBlockState(aPos);
if (theState.getDestroySpeed(world, aPos) <= mainHardness + 5.0F) {
positions.add(aPos.immutable());
}
}
//Break Blocks around
if (radius > 0 && mainHardness >= 0.2F) {
for (int xPos = aPos.getX() - xRange; xPos <= aPos.getX() + xRange; xPos++) {
for (int yPos = aPos.getY() - yRange; yPos <= aPos.getY() + yRange; yPos++) {
for (int zPos = aPos.getZ() - zRange; zPos <= aPos.getZ() + zRange; zPos++) {
if (!(aPos.getX() == xPos && aPos.getY() == yPos && aPos.getZ() == zPos)) {
if (energyStored >= use) {
//Only break Blocks around that are (about) as hard or softer
BlockPos thePos = new BlockPos(xPos, yPos, zPos);
BlockState theState = world.getBlockState(thePos);
if (theState.getDestroySpeed(world, thePos) <= mainHardness + 5.0F) {
energyStored -= use;
positions.add(thePos.immutable());
}
} else {
return positions;
}
}
}
}
}
}
return positions;
}
/**
* Tries to harvest a certain Block
* Breaks the Block, drops Particles etc.

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
@ -37,7 +38,7 @@ public class ItemFilter extends ItemBase {
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
if (!world.isClientSide && hand == InteractionHand.MAIN_HAND) {
player.openMenu(new SimpleMenuProvider((windowId, inv, playerEnt) -> new ContainerFilter(windowId, inv), Component.empty()));
player.openMenu(new SimpleMenuProvider((windowId, inv, playerEnt) -> new ContainerFilter(windowId, inv), Component.translatable("container." + ActuallyAdditions.MODID + ".filter")));
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FILTER.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
}
return InteractionResultHolder.pass(player.getItemInHand(hand));

View file

@ -22,6 +22,7 @@ import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherCategory;
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.fermenting.FermentingCategory;
import de.ellpeck.actuallyadditions.mod.jei.laser.LaserRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.lens.MiningLensRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.pressing.PressingCategory;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
@ -52,6 +53,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
public static final RecipeType<EmpowererRecipe> EMPOWERER = RecipeType.create(ActuallyAdditions.MODID, "empowerer", EmpowererRecipe.class);
public static final RecipeType<CoffeeIngredientRecipe> COFFEE_MACHINE = RecipeType.create(ActuallyAdditions.MODID, "coffee_machine", CoffeeIngredientRecipe.class);
public static final RecipeType<CrushingRecipe> CRUSHING = RecipeType.create(ActuallyAdditions.MODID, "crushing", CrushingRecipe.class);
public static final RecipeType<MiningLensRecipe> MINING_LENS = RecipeType.create(ActuallyAdditions.MODID, "mining_lens", MiningLensRecipe.class);
@Override
public void registerCategories(IRecipeCategoryRegistration registry) {
@ -63,6 +65,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
registry.addRecipeCategories(new CoffeeMachineCategory(helpers.getGuiHelper()));
registry.addRecipeCategories(new PressingCategory(helpers.getGuiHelper()));
registry.addRecipeCategories(new CrusherCategory(helpers.getGuiHelper()));
registry.addRecipeCategories(new MiningLensRecipeCategory(helpers.getGuiHelper()));
}
@Override
@ -76,6 +79,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.CANOLA_PRESS.getItem()), PRESSING);
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.CRUSHER.getItem()), CRUSHING);
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.CRUSHER_DOUBLE.getItem()), CRUSHING);
registry.addRecipeCatalyst(new ItemStack(ActuallyItems.LENS_OF_THE_MINER.get()), MINING_LENS);
// registry.addRecipeCatalyst(new ItemStack(ActuallyItems.itemBooklet.get()), BookletRecipeCategory.NAME);
// registry.addRecipeCatalyst(new ItemStack(InitBlocks.blockCompost.get()), CompostRecipeCategory.NAME);
@ -91,6 +95,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
registry.addRecipes(COFFEE_MACHINE, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.COFFEE_INGREDIENT.get()).stream().map(RecipeHolder::value).toList());
registry.addRecipes(PRESSING, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.PRESSING.get()).stream().map(RecipeHolder::value).toList());
registry.addRecipes(CRUSHING, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.CRUSHING.get()).stream().map(RecipeHolder::value).toList());
registry.addRecipes(MINING_LENS, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS.get()).stream().map(RecipeHolder::value).toList());
//registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME);
}

View file

@ -19,7 +19,6 @@ import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
@ -69,7 +68,7 @@ public class CoffeeMachineCategory implements IRecipeCategory<CoffeeIngredientRe
Minecraft mc = Minecraft.getInstance();
if (!Strings.isNullOrEmpty(recipe.getExtraText())) {
guiGraphics.drawString(mc.font, Component.translatable("jei." + ActuallyAdditions.MODID + ".coffee.special").append( ":"), 2, 4, 4210752, false);
guiGraphics.drawString(mc.font, I18n.get(recipe.getExtraText()), 2, 16, 4210752, false);
guiGraphics.drawString(mc.font, Component.literal(recipe.getExtraText()), 2, 16, 4210752, false);
}
if (recipe.getMaxAmplifier() > 0) {

View file

@ -0,0 +1,88 @@
/*
* This file ("ReconstructorRecipeCategory.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.jei.lens;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.jei.JEIActuallyAdditionsPlugin;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.drawable.IDrawableStatic;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
public class MiningLensRecipeCategory implements IRecipeCategory<MiningLensRecipe> {
private final IDrawableStatic background;
private final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem());
public MiningLensRecipeCategory(IGuiHelper helper) {
this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60).setTextureSize(256,256).build();
}
@Override
public RecipeType<MiningLensRecipe> getRecipeType() {
return JEIActuallyAdditionsPlugin.MINING_LENS;
}
@Override
public Component getTitle() {
return Component.translatable("jei.actuallyadditions.mining_lens");
}
@Override
public IDrawable getBackground() {
return this.background;
}
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, MiningLensRecipe recipe, IFocusGroup focuses) {
Minecraft minecraft = Minecraft.getInstance();
ClientLevel level = minecraft.level;
if (level == null) {
throw new NullPointerException("level must not be null.");
}
RegistryAccess registryAccess = level.registryAccess();
builder.addSlot(RecipeIngredientRole.INPUT, 5, 19).addIngredients(recipe.getInput());
builder.addSlot(RecipeIngredientRole.INPUT, 27, 20).addItemStack(RECONSTRUCTOR);
builder.addSlot(RecipeIngredientRole.INPUT, 43, 20).addItemStack(new ItemStack(ActuallyItems.LENS_OF_THE_MINER.get()));
builder.addSlot(RecipeIngredientRole.OUTPUT, 66, 19).addItemStack(recipe.getResultItem(registryAccess));
}
@Override
public void draw(MiningLensRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics guiGraphics, double mouseX, double mouseY) {
Minecraft mc = Minecraft.getInstance();
Component component = Component.translatable("jei.actuallyadditions.mining_lens.weight");
guiGraphics.drawString(mc.font, component, 2, 42, 0, false);
String weight = String.valueOf(recipe.getWeight());
guiGraphics.drawString(mc.font, weight, 16 - mc.font.width(weight) / 2, 52, 0, false);
}
}

View file

@ -0,0 +1,21 @@
package de.ellpeck.actuallyadditions.mod.lootmodifier;
import com.mojang.serialization.Codec;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import java.util.function.Supplier;
public class ActuallyLootModifiers {
private static final DeferredRegister<Codec<? extends IGlobalLootModifier>> GLM = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, ActuallyAdditions.MODID);
public static final Supplier<Codec<? extends IGlobalLootModifier>> BAT_LOOT = GLM.register("bat_loot", BatLootModifier.CODEC);
public static final Supplier<Codec<? extends IGlobalLootModifier>> DUNGEON_LOOT = GLM.register("dungeon_loot", DungeonLootModifier.CODEC);
public static void init(IEventBus evt) {
GLM.register(evt);
}
}

View file

@ -0,0 +1,47 @@
package de.ellpeck.actuallyadditions.mod.lootmodifier;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.ambient.Bat;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.common.loot.LootModifier;
public class BatLootModifier extends LootModifier {
public static final Supplier<Codec<BatLootModifier>> CODEC = Suppliers.memoize(() ->
RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, BatLootModifier::new)));
public BatLootModifier(LootItemCondition[] conditionsIn) {
super(conditionsIn);
}
@Override
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
RandomSource random = context.getRandom();
if (CommonConfig.Other.DO_BAT_DROPS.get() &&
context.hasParam(LootContextParams.KILLER_ENTITY) &&
context.hasParam(LootContextParams.DAMAGE_SOURCE) &&
context.hasParam(LootContextParams.THIS_ENTITY) &&
context.getParam(LootContextParams.THIS_ENTITY) instanceof Bat) {
int looting = context.getLootingModifier();
if (random.nextInt(15) <= looting * 2) {
generatedLoot.add(new ItemStack(ActuallyItems.BATS_WING.get(), random.nextInt(2 + looting) + 1));
}
}
return generatedLoot;
}
@Override
public Codec<? extends IGlobalLootModifier> codec() {
return CODEC.get();
}
}

View file

@ -0,0 +1,141 @@
package de.ellpeck.actuallyadditions.mod.lootmodifier;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.common.loot.LootModifier;
public class DungeonLootModifier extends LootModifier {
public static final Supplier<Codec<DungeonLootModifier>> CODEC = Suppliers.memoize(() ->
RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, DungeonLootModifier::new)));
public DungeonLootModifier(LootItemCondition[] conditionsIn) {
super(conditionsIn);
}
@Override
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
RandomSource random = context.getRandom();
if (CommonConfig.Other.DUNGEON_LOOT.get()) {
ResourceLocation lootTable = context.getQueriedLootTableId();
boolean addCrystals = false;
boolean addDrillCore = false;
boolean addQuartz = false;
boolean addBatWings = false;
if (BuiltInLootTables.SIMPLE_DUNGEON.equals(lootTable)) {
addCrystals = true;
addDrillCore = true;
addQuartz = true;
} else if (BuiltInLootTables.ABANDONED_MINESHAFT.equals(lootTable)) {
addCrystals = true;
addDrillCore = true;
} else if (BuiltInLootTables.VILLAGE_WEAPONSMITH.equals(lootTable)) {
addDrillCore = true;
addQuartz = true;
} else if (BuiltInLootTables.STRONGHOLD_LIBRARY.equals(lootTable)) {
addBatWings = true;
} else if (BuiltInLootTables.IGLOO_CHEST.equals(lootTable)) {
addBatWings = true;
} else if (BuiltInLootTables.DESERT_PYRAMID.equals(lootTable)) {
addDrillCore = true;
addBatWings = true;
} else if (BuiltInLootTables.NETHER_BRIDGE.equals(lootTable)) {
addBatWings = true;
addCrystals = true;
addDrillCore = true;
} else if (BuiltInLootTables.END_CITY_TREASURE.equals(lootTable)) {
addBatWings = true;
addCrystals = true;
addDrillCore = true;
addQuartz = true;
} else if (BuiltInLootTables.WOODLAND_MANSION.equals(lootTable)) {
addBatWings = true;
addCrystals = true;
addDrillCore = true;
addQuartz = true;
}
if (addCrystals) {
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(0, TheCrystals.values().length - 1));
// LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 3));
// LootFunction[] functions = new LootFunction[] { damage, amount };
// pool.addEntry(new LootEntryItem(InitItems.itemCrystal, 20, 0, functions, noCondition, ActuallyAdditions.MODID + ":crystalItems"));
// pool.addEntry(new LootEntryItem(Item.getItemFromBlock(InitBlocks.blockCrystal), 3, 0, functions, noCondition, ActuallyAdditions.MODID + ":crystalBlocks"));
if (random.nextInt(5) == 0) {
int count = random.nextInt(3) + 1;
Item crystal = getRandomItem(random, ActuallyTags.Items.CRYSTALS, ActuallyItems.RESTONIA_CRYSTAL.get());
generatedLoot.add(new ItemStack(crystal, count));
}
if (random.nextInt(15) == 0) {
int count = random.nextInt(3) + 1;
Item crystal = getRandomItem(random, ActuallyTags.Items.CRYSTAL_BLOCKS, ActuallyBlocks.RESTONIA_CRYSTAL.getItem());
generatedLoot.add(new ItemStack(crystal, count));
}
}
if (addDrillCore) {
System.out.println("Deciding to add drill core or not");
if (random.nextInt(10) == 0) {
generatedLoot.add(new ItemStack(ActuallyItems.DRILL_CORE.get()));
}
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.DRILL_CORE.ordinal()));
// pool.addEntry(new LootEntryItem(InitItems.itemMisc, 5, 0, new LootFunction[] { damage }, noCondition, ActuallyAdditions.MODID + ":drillCore"));
}
if (addQuartz) {
if (random.nextInt(5) == 0) {
int count = random.nextInt(5) + 1;
generatedLoot.add(new ItemStack(ActuallyItems.BLACK_QUARTZ.get(), count));
}
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.QUARTZ.ordinal()));
// LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 5));
// pool.addEntry(new LootEntryItem(InitItems.itemMisc, 20, 0, new LootFunction[] { damage, amount }, noCondition, ActuallyAdditions.MODID + ":quartz"));
}
if (addBatWings) {
if (random.nextInt(10) == 0) {
int count = random.nextInt(2) + 1;
generatedLoot.add(new ItemStack(ActuallyItems.BATS_WING.get(), count));
}
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.BAT_WING.ordinal()));
// LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 2));
// pool.addEntry(new LootEntryItem(InitItems.itemMisc, 5, 0, new LootFunction[] { damage, amount }, noCondition, ActuallyAdditions.MODID + ":batWings"));
}
}
return generatedLoot;
}
private Item getRandomItem(RandomSource random, TagKey<Item> tagKey, Item defaultItem) {
HolderSet.Named<Item> holderSet = BuiltInRegistries.ITEM.getTag(tagKey).orElse(null);
if (holderSet != null) {
Holder<Item> itemHolder = holderSet.getRandomElement(random).orElse(null);
if (itemHolder != null) {
return itemHolder.value();
}
}
return defaultItem;
}
@Override
public Codec<? extends IGlobalLootModifier> codec() {
return CODEC.get();
}
}

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.misc;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.core.Holder;
import net.minecraft.network.chat.Component;
import net.minecraft.world.damagesource.DamageSource;

View file

@ -75,7 +75,8 @@ public abstract class TileEntityBase extends BlockEntity {
@Override
public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) {
this.readSyncableNBT(pkt.getTag(), NBTType.SYNC);
if (pkt.getTag() != null) //TODO: pkt.getTag() is nullable. Hopping Item Interface will throw in the log when placed because of this
this.readSyncableNBT(pkt.getTag(), NBTType.SYNC);
}
@Override

View file

@ -198,16 +198,15 @@ public class TileEntityItemInterface extends TileEntityBase {
int slotsQueried = 0;
for (GenericItemHandlerInfo info : this.genericInfos) {
if (!info.isLoaded()) continue;
for (SlotlessableItemHandlerWrapper handler : info.handlers) {
Optional<IItemHandler> normalHandler = Optional.ofNullable(handler.getNormalHandler());
slotsQueried += normalHandler.map(cap -> {
int queried = 0;
for (int i = 0; i < cap.getSlots(); i++) {
this.itemHandlerInfos.put(queried, new IItemHandlerInfo(cap, i, info.relayInQuestion));
queried++;
IItemHandler normalHandler = handler.getNormalHandler();
if (normalHandler != null) {
for (int i = 0; i < normalHandler.getSlots(); i++) {
this.itemHandlerInfos.put(slotsQueried, new IItemHandlerInfo(normalHandler, i, info.relayInQuestion));
slotsQueried++;
}
return queried;
}).orElse(0);
}
// TODO: [port] add back
// if (ActuallyAdditions.commonCapsLoaded) {

View file

@ -62,7 +62,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
List<ItemEntity> items = level.getEntities(EntityType.ITEM, axisAlignedBB, EntitySelector.ENTITY_STILL_ALIVE);
if (items != null && !items.isEmpty()) {
for (ItemEntity item : items) {
if (item != null && item.isAlive()) {
if (item != null) {
if (ActuallyAdditions.commonCapsLoaded) {
Object slotless = tile.itemHandler.getSlotlessHandler();
// TODO: [port] add back?
@ -79,11 +79,12 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
Optional<IItemHandler> handler = Optional.ofNullable(tile.itemHandler.getNormalHandler());
handler.ifPresent(cap -> {
System.out.println(cap.getSlots());
for (int i = 0; i < cap.getSlots(); i++) {
ItemStack left = cap.insertItem(i, item.getItem(), false);
item.setItem(left);
if (!StackUtil.isValid(left)) {
if (left.isEmpty()) {
item.discard();
break;
}
@ -126,7 +127,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
}
BlockState state = this.level.getBlockState(this.getBlockPos());
Direction facing = state.getValue(BlockStateProperties.FACING);
Direction facing = state.getValue(BlockStateProperties.FACING_HOPPER);
BlockPos toPos = this.getBlockPos().relative(facing);
if (this.level.isLoaded(toPos)) {

View file

@ -22,6 +22,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
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.BlockEntityType;
@ -200,10 +201,10 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase {
}
@OnlyIn(Dist.CLIENT)
public abstract String getExtraDisplayString();
public abstract Component getExtraDisplayString();
@OnlyIn(Dist.CLIENT)
public abstract String getCompassDisplayString();
public abstract Component getCompassDisplayString();
public abstract void onCompassAction(Player player);

View file

@ -18,10 +18,10 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import net.minecraft.ChatFormatting;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
@ -259,14 +259,14 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay {
@Override
@OnlyIn(Dist.CLIENT)
public String getExtraDisplayString() {
return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.extra") + ": " + ChatFormatting.DARK_RED + I18n.get(this.mode.name) + ChatFormatting.RESET;
public Component getExtraDisplayString() {
return Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.energy.extra").append(": ").append(Component.translatable(this.mode.name).withStyle(ChatFormatting.DARK_RED));
}
@Override
@OnlyIn(Dist.CLIENT)
public String getCompassDisplayString() {
return ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display");
public Component getCompassDisplayString() {
return Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display").withStyle(ChatFormatting.GREEN);
}
@Override

View file

@ -18,10 +18,10 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy.Mode;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -251,14 +251,14 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay {
@Override
@OnlyIn(Dist.CLIENT)
public String getExtraDisplayString() {
return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.fluid.extra") + ": " + ChatFormatting.DARK_RED + I18n.get(this.mode.name) + ChatFormatting.RESET;
public Component getExtraDisplayString() {
return Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.fluid.extra").append(": ").append(Component.translatable(this.mode.name).withStyle(ChatFormatting.DARK_RED));
}
@Override
@OnlyIn(Dist.CLIENT)
public String getCompassDisplayString() {
return ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display");
public Component getCompassDisplayString() {
return Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.energy.display").withStyle(ChatFormatting.GREEN);
}
@Override

View file

@ -19,10 +19,10 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface.GenericItem
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
import net.minecraft.ChatFormatting;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
@ -158,14 +158,14 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay {
@Override
@OnlyIn(Dist.CLIENT)
public String getExtraDisplayString() {
return I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.extra") + ": " + ChatFormatting.DARK_RED + this.getPriority() + ChatFormatting.RESET;
public Component getExtraDisplayString() {
return Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.item.extra").append(": ").append(Component.literal(String.valueOf(this.getPriority())).withStyle(ChatFormatting.DARK_RED));
}
@Override
@OnlyIn(Dist.CLIENT)
public String getCompassDisplayString() {
return ChatFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.1") + "\n" + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.2");
public Component getCompassDisplayString() {
return Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.1").append("\n").append(Component.translatable("info." + ActuallyAdditions.MODID + ".laserRelay.item.display.2")).withStyle(ChatFormatting.GREEN);
}
@Override

View file

@ -150,7 +150,7 @@ public class TileEntityLaserRelayItemAdvanced extends TileEntityLaserRelayItem i
@Override
public Component getDisplayName() {
return Component.empty();
return Component.translatable("container.actuallyadditions.laserRelayAdvanced");
}
@Nullable

View file

@ -101,6 +101,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl
if (hasBoundPosition())
serverLevel.registerCapabilityListener(boundPosition, capListener);
}
invalidateCapabilities();
}
int strength = this.getComparatorStrength();

View file

@ -36,13 +36,19 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.client.ClientHooks;
@ -423,4 +429,43 @@ public final class AssetUtil {
}
return new float[]{0.0f, (pos -= 170.0f) * 3.0f, 255.0f - pos * 3.0f};
}
@OnlyIn(Dist.CLIENT)
public static void renderHitOutline(PoseStack poseStack, VertexConsumer consumer, Entity entity,
double camX, double camY, double camZ, Level level, BlockPos pos, BlockState state) {
renderShape(poseStack, consumer, state.getShape(level, pos, CollisionContext.of(entity)),
(double) pos.getX() - camX,
(double) pos.getY() - camY,
(double) pos.getZ() - camZ,
0.0F,
0.0F,
0.0F,
0.4F
);
}
@OnlyIn(Dist.CLIENT)
private static void renderShape(PoseStack poseStack, VertexConsumer consumer, VoxelShape shape,
double x, double y, double z, float red, float green, float blue, float alpha) {
PoseStack.Pose posestack$pose = poseStack.last();
shape.forAllEdges(
(minX, minY, minZ, maxX, maxY, maxZ) -> {
float f = (float) (maxX - minX);
float f1 = (float) (maxY - minY);
float f2 = (float) (maxZ - minZ);
float f3 = Mth.sqrt(f * f + f1 * f1 + f2 * f2);
f /= f3;
f1 /= f3;
f2 /= f3;
consumer.vertex(posestack$pose.pose(), (float) (minX + x), (float) (minY + y), (float) (minZ + z))
.color(red, green, blue, alpha)
.normal(posestack$pose.normal(), f, f1, f2)
.endVertex();
consumer.vertex(posestack$pose.pose(), (float) (maxX + x), (float) (maxY + y), (float) (maxZ + z))
.color(red, green, blue, alpha)
.normal(posestack$pose.normal(), f, f1, f2)
.endVertex();
}
);
}
}

View file

@ -38,10 +38,10 @@ import net.neoforged.neoforge.common.util.FakePlayer;
import net.neoforged.neoforge.common.util.FakePlayerFactory;
import net.neoforged.neoforge.energy.IEnergyStorage;
import net.neoforged.neoforge.event.EventHooks;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.event.level.BlockEvent.BreakEvent;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
import net.neoforged.neoforge.items.IItemHandler;
import java.util.ArrayList;
import java.util.List;
@ -95,7 +95,7 @@ public final class WorldUtil {
}
if (!StackUtil.isValid(extracted)) {
/* IItemHandler handler = extractWrapper.getNormalHandler();
IItemHandler handler = extractWrapper.getNormalHandler();
if (handler != null) {
for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) {
if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) {
@ -106,7 +106,7 @@ public final class WorldUtil {
}
}
}
}*/
}
}
return extracted;

View file

@ -16,6 +16,7 @@ public class SlotlessableItemHandlerWrapper {
//TODO: Check if we need this wrapper at all? The previous implementation used CommonCapabilities ISlotlessItemhandler
private final IItemHandler normalHandler;
@Deprecated
private final Object slotlessHandler;
public SlotlessableItemHandlerWrapper(IItemHandler normalHandler, Object slotlessHandler) {
@ -27,6 +28,7 @@ public class SlotlessableItemHandlerWrapper {
return this.normalHandler;
}
@Deprecated
public Object getSlotlessHandler() {
return this.slotlessHandler;
}

View file

@ -341,7 +341,7 @@
"item.actuallyadditions.booklet": "Actually Additions Manual (wip)",
"item.actuallyadditions.rarmor_module_reconstructor": "Reconstruction Module (wip)",
"item.actuallyadditions.laser_wrench": "Laser Wrench",
"item.actuallyadditions.drill_core": "Drill Core (wip)",
"item.actuallyadditions.drill_core": "Drill Core",
"item.actuallyadditions.restonia_crystal": "Restonia Crystal",
"item.actuallyadditions.palis_crystal": "Palis Crystal",
"item.actuallyadditions.diamatine_crystal": "Diamatine Crystal",
@ -980,5 +980,7 @@
"_comment": "JEI",
"jei.actuallyadditions.coffee.special": "Special Feature",
"jei.actuallyadditions.coffee.maxAmount": "Max Amount",
"jei.actuallyadditions.coffee.extra.milk": "+01:00, -1 Level"
"jei.actuallyadditions.coffee.extra.milk": "+01:00, -1 Level",
"jei.actuallyadditions.mining_lens": "Lens of the Miner",
"jei.actuallyadditions.mining_lens.weight": "Weight:"
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementalcraft"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementalcraft:inert_crystal_ore"
},
"weight": 500
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementsofpower"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementsofpower:agate_ore"
},
"weight": 25
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementsofpower"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementsofpower:citrine_ore"
},
"weight": 25
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementsofpower"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementsofpower:onyx_ore"
},
"weight": 25
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementsofpower"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementsofpower:rubellite_ore"
},
"weight": 25
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementsofpower"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementsofpower:ruby_ore"
},
"weight": 25
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "elementsofpower"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "elementsofpower:sapphire_ore"
},
"weight": 25
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "immersiveengineering"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "immersiveengineering:ore_silver"
},
"weight": 1000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "mekanism"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "mekanism:florite_ore"
},
"weight": 1000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "mekanism"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "mekanism:lead_ore"
},
"weight": 2000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "mekanism"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "mekanism:osmium_ore"
},
"weight": 3000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "mekanism"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "mekanism:tin_ore"
},
"weight": 2000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "mekanism"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "mekanism:uranium_ore"
},
"weight": 500
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "modern_industrialization"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "modern_industrialization:antimony_ore"
},
"weight": 1000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "modern_industrialization"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "modern_industrialization:lignite_coal_ore"
},
"weight": 1500
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "modern_industrialization"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "modern_industrialization:monazite_ore"
},
"weight": 100
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "modern_industrialization"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "modern_industrialization:nickel_ore"
},
"weight": 2000
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "modern_industrialization"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "modern_industrialization:salt_ore"
},
"weight": 500
}

View file

@ -0,0 +1,16 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "powah"
}
],
"type": "actuallyadditions:mining_lens",
"ingredient": {
"tag": "forge:stone"
},
"result": {
"item": "powah:uraninite_ore"
},
"weight": 200
}