Compare commits

..

5 commits

Author SHA1 Message Date
Flanks255
ccfb8d162d Fixed Phantom Placer / Breaker.
Removed some Wips.
Bump for FC
2024-04-28 16:46:39 -05:00
Mrbysco
84d5eb0add Update to released patchouli 2024-04-28 22:12:50 +02:00
Mrbysco
9bd1fa63ea Reduce drill placement code size 2024-04-28 22:12:22 +02:00
Mrbysco
846172e69c Update DrillItem.java 2024-04-28 22:08:12 +02:00
Mrbysco
7e7fd0d8e2 Fix the block placing drill upgrade 2024-04-28 22:07:31 +02:00
20 changed files with 171 additions and 118 deletions

View file

@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.daemon=false
# Actually Additions # Actually Additions
mod_version=1.2.10 mod_version=1.2.11
# Forge # Forge
game_version=1.20.4 game_version=1.20.4
@ -19,5 +19,5 @@ neogradle.subsystems.parchment.mappingsVersion=2024.02.25
# Other mods # Other mods
jei_version=17.3.0.49 jei_version=17.3.0.49
patchouli_version=1.20.4-85-NEOFORGE-SNAPSHOT patchouli_version=1.20.4-85-NEOFORGE
patchouli_provider_version=1.20.4-1.0.10-Snapshot.6 patchouli_provider_version=1.20.4-1.0.10-Snapshot.7

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-03-11T19:15:36.5038055 Loot Tables // 1.20.4 2024-04-28T16:44:33.1316406 Loot Tables
f6655bb234dbcf1041fe8ad95c976ddddda2b02a data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json f6655bb234dbcf1041fe8ad95c976ddddda2b02a data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json
e15c868b26b669c30365bfb93e7d9274e07df16d data/actuallyadditions/loot_tables/blocks/battery_box.json e15c868b26b669c30365bfb93e7d9274e07df16d data/actuallyadditions/loot_tables/blocks/battery_box.json
745d64af3b0203a138f9eca7de21ed4988b35c95 data/actuallyadditions/loot_tables/blocks/bio_reactor.json 745d64af3b0203a138f9eca7de21ed4988b35c95 data/actuallyadditions/loot_tables/blocks/bio_reactor.json
@ -25,6 +25,7 @@ b598ece027ef00e9ed0457a7f9542ebe8b89538c data/actuallyadditions/loot_tables/bloc
6416e24b52f6a361efa8c9955b20fdeb1c623d79 data/actuallyadditions/loot_tables/blocks/coal_generator.json 6416e24b52f6a361efa8c9955b20fdeb1c623d79 data/actuallyadditions/loot_tables/blocks/coal_generator.json
afab93747299dba6783292e5949ea7e0cd5d5b13 data/actuallyadditions/loot_tables/blocks/coffee.json afab93747299dba6783292e5949ea7e0cd5d5b13 data/actuallyadditions/loot_tables/blocks/coffee.json
ef604b6cc4ac21ee792ab7df41b77578b4d213db data/actuallyadditions/loot_tables/blocks/coffee_machine.json ef604b6cc4ac21ee792ab7df41b77578b4d213db data/actuallyadditions/loot_tables/blocks/coffee_machine.json
fa895b25a0816ca506f7031ec3861cfd4de04f28 data/actuallyadditions/loot_tables/blocks/crate_small.json
7767779372fd1929d1d818e00d8a3d869f2d4a87 data/actuallyadditions/loot_tables/blocks/crusher.json 7767779372fd1929d1d818e00d8a3d869f2d4a87 data/actuallyadditions/loot_tables/blocks/crusher.json
9f549621d659a42dcb71516dd1d97cb347611094 data/actuallyadditions/loot_tables/blocks/crusher_double.json 9f549621d659a42dcb71516dd1d97cb347611094 data/actuallyadditions/loot_tables/blocks/crusher_double.json
25b7a44418e2858552dd5150d67bffe1f30269a8 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json 25b7a44418e2858552dd5150d67bffe1f30269a8 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-03-13T18:06:15.6143021 Recipes // 1.20.4 2024-04-28T16:44:33.1452594 Recipes
4d3128b37a7153882a9324cda49b5069207561c5 data/actuallyadditions/recipes/atomic_reconstructor.json 4d3128b37a7153882a9324cda49b5069207561c5 data/actuallyadditions/recipes/atomic_reconstructor.json
b0367f5012651764931e8b8fd0c5bcca4e8614c0 data/actuallyadditions/recipes/battery_box.json b0367f5012651764931e8b8fd0c5bcca4e8614c0 data/actuallyadditions/recipes/battery_box.json
dba5d4a1a79489d5766fad32f912ab1a64618854 data/actuallyadditions/recipes/bio_reactor.json dba5d4a1a79489d5766fad32f912ab1a64618854 data/actuallyadditions/recipes/bio_reactor.json
@ -56,9 +56,11 @@ ff81da8a0f6632779414c0512100696a11771814 data/actuallyadditions/recipes/hopping_
11a57ce2eea04fed226a817a3995acd406bb2efb data/actuallyadditions/recipes/long_range_breaker.json 11a57ce2eea04fed226a817a3995acd406bb2efb data/actuallyadditions/recipes/long_range_breaker.json
73696fd4e851f440a9850485fc9ad03fc63442a9 data/actuallyadditions/recipes/oil_generator.json 73696fd4e851f440a9850485fc9ad03fc63442a9 data/actuallyadditions/recipes/oil_generator.json
afbee3f7074b7aa88d4bc8941d820d02b827da4b data/actuallyadditions/recipes/phantom_booster.json afbee3f7074b7aa88d4bc8941d820d02b827da4b data/actuallyadditions/recipes/phantom_booster.json
8dd44158b3b1780fa4479879262239294c45c37f data/actuallyadditions/recipes/phantom_breaker.json
f0a9c8a0de8fb884cd207c34c4a10e7a4a021153 data/actuallyadditions/recipes/phantom_energyface.json f0a9c8a0de8fb884cd207c34c4a10e7a4a021153 data/actuallyadditions/recipes/phantom_energyface.json
c7b65084e855bd7f083819ed9339320577510c6f data/actuallyadditions/recipes/phantom_itemface.json c7b65084e855bd7f083819ed9339320577510c6f data/actuallyadditions/recipes/phantom_itemface.json
6d3aa070e0fccbb126c80323423c9482259dd6de data/actuallyadditions/recipes/phantom_liquiface.json 6d3aa070e0fccbb126c80323423c9482259dd6de data/actuallyadditions/recipes/phantom_liquiface.json
bb11bd865cfdf6756e104ecc0d755772183b047f data/actuallyadditions/recipes/phantom_placer.json
253e31ad471e2a8e20bfbe077826a8fac35fcc84 data/actuallyadditions/recipes/phantom_redstoneface.json 253e31ad471e2a8e20bfbe077826a8fac35fcc84 data/actuallyadditions/recipes/phantom_redstoneface.json
8c78ebb9351b98ffe368391a391b90385c0b8b7f data/actuallyadditions/recipes/placer.json 8c78ebb9351b98ffe368391a391b90385c0b8b7f data/actuallyadditions/recipes/placer.json
981e7e91216504b421d069f72920499df052e64f data/actuallyadditions/recipes/player_interface.json 981e7e91216504b421d069f72920499df052e64f data/actuallyadditions/recipes/player_interface.json

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-04-09T17:25:30.7116661 Item Models: actuallyadditions // 1.20.4 2024-04-28T16:44:33.1387413 Item Models: actuallyadditions
34463d3d2ae3fafaaea338e7ffc03cd139d3cfeb assets/actuallyadditions/models/item/advanced_coil.json 34463d3d2ae3fafaaea338e7ffc03cd139d3cfeb assets/actuallyadditions/models/item/advanced_coil.json
24594fc68e66011dc2d7b79b92c94b387e710318 assets/actuallyadditions/models/item/advanced_leaf_blower.json 24594fc68e66011dc2d7b79b92c94b387e710318 assets/actuallyadditions/models/item/advanced_leaf_blower.json
ba2d814e269cdef72e1045f200b3c20ed6961517 assets/actuallyadditions/models/item/atomic_reconstructor.json ba2d814e269cdef72e1045f200b3c20ed6961517 assets/actuallyadditions/models/item/atomic_reconstructor.json
@ -37,6 +37,7 @@ c73981382d646e4a0186b26fcfad817d39252055 assets/actuallyadditions/models/item/ch
a67f1795e1ad1d6ed19f2a35f176f39e00dbb9c3 assets/actuallyadditions/models/item/coffee_machine.json a67f1795e1ad1d6ed19f2a35f176f39e00dbb9c3 assets/actuallyadditions/models/item/coffee_machine.json
523148eac33929fb0d2892856a5ddcb784043bb5 assets/actuallyadditions/models/item/crafter_on_a_stick.json 523148eac33929fb0d2892856a5ddcb784043bb5 assets/actuallyadditions/models/item/crafter_on_a_stick.json
89cc79420e3a7c2952ce729537b7503a517bb9de assets/actuallyadditions/models/item/crate_keeper.json 89cc79420e3a7c2952ce729537b7503a517bb9de assets/actuallyadditions/models/item/crate_keeper.json
cfc7022ad26717b33c916d380435cc32ace34c0b assets/actuallyadditions/models/item/crate_small.json
9bc734dadf9d5b85b8cc5685b673a1d074cf3d6d assets/actuallyadditions/models/item/crusher.json 9bc734dadf9d5b85b8cc5685b673a1d074cf3d6d assets/actuallyadditions/models/item/crusher.json
4b7ef5dd15d930d4b0b5507cd08c27cb5ee1498a assets/actuallyadditions/models/item/crusher_double.json 4b7ef5dd15d930d4b0b5507cd08c27cb5ee1498a assets/actuallyadditions/models/item/crusher_double.json
91e18e2c5ae8f657b977865312e8cd7ee348d8f1 assets/actuallyadditions/models/item/crystallized_canola_seed.json 91e18e2c5ae8f657b977865312e8cd7ee348d8f1 assets/actuallyadditions/models/item/crystallized_canola_seed.json

View file

@ -0,0 +1,3 @@
{
"parent": "actuallyadditions:block/crate_small"
}

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "actuallyadditions:crate_small"
}
],
"rolls": 1.0
}
],
"random_sequence": "actuallyadditions:blocks/crate_small"
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:breaker"
},
{
"item": "actuallyadditions:phantom_itemface"
}
],
"result": {
"item": "actuallyadditions:phantom_breaker"
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:placer"
},
{
"item": "actuallyadditions:phantom_itemface"
}
],
"result": {
"item": "actuallyadditions:phantom_placer"
}
}

View file

@ -317,6 +317,16 @@ public class BlockRecipeGenerator extends RecipeProvider {
.define('F', ActuallyBlocks.BREAKER.get()) .define('F', ActuallyBlocks.BREAKER.get())
.save(recipeOutput); .save(recipeOutput);
// Phantom Placer
Recipe.shapeless(ActuallyBlocks.PHANTOM_PLACER.get())
.ingredients(ActuallyBlocks.PLACER.get(), ActuallyBlocks.PHANTOM_ITEMFACE.get())
.save(recipeOutput);
// Phantom Breaker
Recipe.shapeless(ActuallyBlocks.PHANTOM_BREAKER.get())
.ingredients(ActuallyBlocks.BREAKER.get(), ActuallyBlocks.PHANTOM_ITEMFACE.get())
.save(recipeOutput);
// Powered furnace. // Powered furnace.
Recipe.shaped(ActuallyBlocks.POWERED_FURNACE.getItem()) Recipe.shaped(ActuallyBlocks.POWERED_FURNACE.getItem())
.pattern("EXC", "FIF", "CXE") .pattern("EXC", "FIF", "CXE")

View file

@ -102,6 +102,7 @@ public class LootTableGenerator extends LootTableProvider {
this.dropSelf(ActuallyBlocks.BREAKER.get()); this.dropSelf(ActuallyBlocks.BREAKER.get());
this.dropSelf(ActuallyBlocks.PLACER.get()); this.dropSelf(ActuallyBlocks.PLACER.get());
this.dropSelf(ActuallyBlocks.DROPPER.get()); this.dropSelf(ActuallyBlocks.DROPPER.get());
this.dropSelf(ActuallyBlocks.CRATE_SMALL.get());
this.dropSelf(ActuallyBlocks.FLUID_PLACER.get()); this.dropSelf(ActuallyBlocks.FLUID_PLACER.get());
this.dropSelf(ActuallyBlocks.FLUID_COLLECTOR.get()); this.dropSelf(ActuallyBlocks.FLUID_COLLECTOR.get());
this.dropSelf(ActuallyBlocks.COFFEE_MACHINE.get()); this.dropSelf(ActuallyBlocks.COFFEE_MACHINE.get());

View file

@ -27,6 +27,7 @@ import net.minecraft.util.FormattedCharSequence;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -109,40 +110,34 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
@Nullable @Nullable
@Override @Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> entityType) { public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> entityType) {
switch (this.type) { return switch (this.type) {
case PLACER: case PLACER, BREAKER ->
return level.isClientSide? TileEntityPhantomPlacer::clientTick : TileEntityPhantomPlacer::serverTick; level.isClientSide ? TileEntityPhantomPlacer::clientTick : TileEntityPhantomPlacer::serverTick;
case BREAKER: case LIQUIFACE ->
return level.isClientSide? TileEntityPhantomBreaker::clientTick : TileEntityPhantomBreaker::serverTick; level.isClientSide ? TileEntityPhantomLiquiface::clientTick : TileEntityPhantomLiquiface::serverTick;
case LIQUIFACE: case ENERGYFACE ->
return level.isClientSide? TileEntityPhantomLiquiface::clientTick : TileEntityPhantomLiquiface::serverTick; level.isClientSide ? TileEntityPhantomEnergyface::clientTick : TileEntityPhantomEnergyface::serverTick;
case ENERGYFACE: case REDSTONEFACE ->
return level.isClientSide? TileEntityPhantomEnergyface::clientTick : TileEntityPhantomEnergyface::serverTick; level.isClientSide ? TileEntityPhantomRedstoneface::clientTick : TileEntityPhantomRedstoneface::serverTick;
case REDSTONEFACE: default ->
return level.isClientSide? TileEntityPhantomRedstoneface::clientTick : TileEntityPhantomRedstoneface::serverTick; level.isClientSide ? TileEntityPhantomItemface::clientTick : TileEntityPhantomItemface::serverTick;
default: };
return level.isClientSide? TileEntityPhantomItemface::clientTick : TileEntityPhantomItemface::serverTick;
}
} }
// TODO: [port] validate this works
@Override @Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
if (this.tryToggleRedstone(world, pos, player)) { if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.PASS; return InteractionResult.SUCCESS;
} }
/*
if (!world.isClientSide) { if (!world.isClientSide) {
TileEntity tile = world.getBlockEntity(pos); BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) { if (tile instanceof MenuProvider menuProvider) {
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos); player.openMenu(menuProvider, pos);
} }
} }
*/ return InteractionResult.SUCCESS;
return InteractionResult.PASS;
} }
// TODO: [port] fix all of this, it's a mess
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) { public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
@ -163,10 +158,8 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, 0xFFFFFF, true); drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, 0xFFFFFF, true);
if (phantom.isBoundThingInRange()) { if (phantom.isBoundThingInRange()) {
//StringUtil.drawSplitString(minecraft.font, ChatFormatting.DARK_GREEN + I18n.get("tooltip.actuallyadditions.phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
} else { } else {
//StringUtil.drawSplitString(minecraft.font, ChatFormatting.DARK_RED + I18n.get("tooltip.actuallyadditions.phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true); drawWordWrap(guiGraphics, minecraft.font, Component.translatable("tooltip.actuallyadditions.phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
} }
} else { } else {

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
@ -19,6 +20,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public abstract class AAScreen<T extends AbstractContainerMenu> extends AbstractContainerScreen<T> { public abstract class AAScreen<T extends AbstractContainerMenu> extends AbstractContainerScreen<T> {
//TODO standardize this to dunswe?
public static final String[] SIDES = { I18n.get("info.actuallyadditions.gui.disabled"), I18n.get("info.actuallyadditions.gui.up"), I18n.get("info.actuallyadditions.gui.down"), I18n.get("info.actuallyadditions.gui.north"), I18n.get("info.actuallyadditions.gui.east"), I18n.get("info.actuallyadditions.gui.south"), I18n.get("info.actuallyadditions.gui.west") };
public AAScreen(T container, Inventory inventory, Component pTitle) { public AAScreen(T container, Inventory inventory, Component pTitle) {
super(container, inventory, pTitle); super(container, inventory, pTitle);

View file

@ -12,9 +12,12 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
@ -22,12 +25,15 @@ import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiPhantomPlacer extends AAScreen<ContainerPhantomPlacer> { public class GuiPhantomPlacer extends AAScreen<ContainerPhantomPlacer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker"); private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityPhantomPlacer placer; private final TileEntityPhantomPlacer placer;
private Button buttonSide;
public GuiPhantomPlacer(ContainerPhantomPlacer container, Inventory inventory, Component title) { public GuiPhantomPlacer(ContainerPhantomPlacer container, Inventory inventory, Component title) {
super(container, inventory, title); super(container, inventory, title);
@ -40,44 +46,40 @@ public class GuiPhantomPlacer extends AAScreen<ContainerPhantomPlacer> {
public void init() { public void init() {
super.init(); super.init();
// if (!this.placer.isBreaker) { if (!this.placer.isBreaker) {
// this.addButton(new Button(0, this.leftPos + 63, this.topPos + 75, 50, 20, this.getSide())); buttonSide = Button.builder(Component.literal(this.getSide()), (button) -> PacketHandlerHelper.sendButtonPacket(this.placer, 0))
// } .bounds(this.leftPos + 63, this.topPos + 75, 50, 20).build();
this.addRenderableWidget(buttonSide);
}
} }
@Override @Override
protected void containerTick() { protected void containerTick() {
super.containerTick(); super.containerTick();
// if (!this.placer.isBreaker) { if (!this.placer.isBreaker && this.buttonSide != null) {
// this.buttonList.get(0).displayString = this.getSide(); buttonSide.setMessage(Component.literal(this.getSide()));
// } }
} }
@Override @Override
public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
super.render(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks);
// if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) { if (!this.placer.isBreaker && buttonSide.isMouseOver(mouseX, mouseY)) {
// String loc = "info." + ActuallyAdditions.MODID + ".placer.sides"; String loc = "info.actuallyadditions.placer.sides";
//
// List<String> textList = new ArrayList<>(); List<Component> textList = new ArrayList<>();
// textList.add(TextFormatting.GOLD + StringUtil.localize(loc + ".1")); textList.add(Component.translatable(loc + ".1").withStyle(ChatFormatting.GOLD));
// textList.addAll(this.font.listFormattedStringToWidth(StringUtil.localize(loc + ".2"), 200)); textList.add(Component.translatable(loc + ".2"));
// this.drawHoveringText(textList, mouseX, mouseY); //renderComponentTooltip guiGraphics.renderComponentTooltip(font, textList, mouseX, mouseY);
// } }
} }
// @Override
// protected void actionPerformed(Button button) throws IOException {
// if (!this.placer.isBreaker) {
// PacketHandlerHelper.sendButtonPacket(this.placer, button.id);
// }
// }
// private String getSide() { private String getSide() {
// return GuiInputter.SIDES[this.placer.side + 1]; return SIDES[this.placer.side + 1];
// } }
@Override @Override
public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) { public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -111,6 +111,7 @@ public class DrillItem extends ItemEnergy {
@Nonnull @Nonnull
@Override @Override
public InteractionResult useOn(UseOnContext context) { public InteractionResult useOn(UseOnContext context) {
Level level = context.getLevel();
Player player = context.getPlayer(); Player player = context.getPlayer();
InteractionHand hand = context.getHand(); InteractionHand hand = context.getHand();
@ -121,28 +122,11 @@ public class DrillItem extends ItemEnergy {
if (slot >= 0 && slot < 9) { // TODO: validate... old = PlayerInventory.getHotbarSize(); new = 9 if (slot >= 0 && slot < 9) { // TODO: validate... old = PlayerInventory.getHotbarSize(); new = 9
ItemStack equip = player.getInventory().getItem(slot); ItemStack equip = player.getInventory().getItem(slot);
if (!equip.isEmpty() && equip != stack) { if (!equip.isEmpty() && equip != stack) {
ItemStack toPlaceStack = equip.copy(); ItemStack toPlaceStack = equip;
WorldUtil.setHandItemWithoutAnnoyingSound(player, hand, toPlaceStack);
//tryPlaceItemIntoWorld could throw an Exception
try {
//Places the Block into the World //Places the Block into the World
if (toPlaceStack.useOn(context) != InteractionResult.FAIL) { BlockHitResult result = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), context.getClickedPos(), context.isInside());
if (!player.isCreative()) { return toPlaceStack.useOn(new UseOnContext(level, player, hand, toPlaceStack, result));
WorldUtil.setHandItemWithoutAnnoyingSound(player, hand, toPlaceStack.copy());
}
}
}
//Notify the Player and log the Exception
catch (Exception e) {
ActuallyAdditions.LOGGER.error("Player " + player.getName() + " who should place a Block using a Drill at " + player.getX() + ", " + player.getY() + ", " + player.getZ() + " in World " + context.getLevel().dimension() + " threw an Exception! Don't let that happen again!");
}
player.getInventory().setItem(slot, player.getItemInHand(hand));
WorldUtil.setHandItemWithoutAnnoyingSound(player, hand, stack);
return InteractionResult.SUCCESS;
} }
} }
} }

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
@ -41,6 +42,7 @@ public class ItemDrillUpgrade extends ItemBase {
ItemStack stack = player.getItemInHand(hand); ItemStack stack = player.getItemInHand(hand);
if (!world.isClientSide && this.type == UpgradeType.PLACER) { if (!world.isClientSide && this.type == UpgradeType.PLACER) {
this.setSlotToPlaceFrom(stack, player.getInventory().selected); this.setSlotToPlaceFrom(stack, player.getInventory().selected);
player.sendSystemMessage(Component.literal("Set the slot to place from to " + (player.getInventory().selected + 1)));
return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack);
} }
return new InteractionResultHolder<>(InteractionResult.FAIL, stack); return new InteractionResultHolder<>(InteractionResult.FAIL, stack);

View file

@ -15,10 +15,11 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level; import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nonnull;
public class TileEntityPhantomBreaker extends TileEntityPhantomPlacer { public class TileEntityPhantomBreaker extends TileEntityPhantomPlacer {
public TileEntityPhantomBreaker(BlockPos pos, BlockState state) { public TileEntityPhantomBreaker(BlockPos pos, BlockState state) {
@ -26,18 +27,6 @@ public class TileEntityPhantomBreaker extends TileEntityPhantomPlacer {
this.isBreaker = true; this.isBreaker = true;
} }
public static <T extends BlockEntity> void clientTick(Level level, BlockPos pos, BlockState state, T t) {
if (t instanceof TileEntityPhantomBreaker tile) {
tile.clientTick();
}
}
public static <T extends BlockEntity> void serverTick(Level level, BlockPos pos, BlockState state, T t) {
if (t instanceof TileEntityPhantomBreaker tile) {
tile.serverTick();
}
}
@Override @Override
public IAcceptor getAcceptor() { public IAcceptor getAcceptor() {
return (slot, stack, automation) -> !automation; return (slot, stack, automation) -> !automation;
@ -48,4 +37,9 @@ public class TileEntityPhantomBreaker extends TileEntityPhantomPlacer {
return ItemStackHandlerAA.REMOVE_TRUE; return ItemStackHandlerAA.REMOVE_TRUE;
} }
@Nonnull
@Override
public Component getDisplayName() {
return Component.translatable("container.actuallyadditions.phantomBreaker");
}
} }

View file

@ -37,6 +37,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@ -236,9 +237,10 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
this.sendUpdate(); this.sendUpdate();
} }
@Nonnull
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return Component.empty(); return Component.translatable("container.actuallyadditions.phantomPlacer");
} }
@Nullable @Nullable

View file

@ -214,6 +214,7 @@ public final class WorldUtil {
return false; return false;
} }
//TODO standardize this to dunswe?
public static Direction getDirectionBySidesInOrder(int side) { public static Direction getDirectionBySidesInOrder(int side) {
switch (side) { switch (side) {
case 0: case 0:

View file

@ -136,12 +136,12 @@
"block.actuallyadditions.lamp_cyan": "Cyan Lamp", "block.actuallyadditions.lamp_cyan": "Cyan Lamp",
"block.actuallyadditions.lamp_purple": "Purple Lamp", "block.actuallyadditions.lamp_purple": "Purple Lamp",
"block.actuallyadditions.phantom_itemface": "Phantom Itemface", "block.actuallyadditions.phantom_itemface": "Phantom Itemface",
"block.actuallyadditions.player_interface": "Player Interface (wip)", "block.actuallyadditions.player_interface": "Player Interface",
"block.actuallyadditions.phantom_energyface": "Phantom Energyface", "block.actuallyadditions.phantom_energyface": "Phantom Energyface",
"block.actuallyadditions.phantom_redstoneface": "Phantom Redstoneface", "block.actuallyadditions.phantom_redstoneface": "Phantom Redstoneface",
"block.actuallyadditions.phantom_liquiface": "Phantom Liquiface", "block.actuallyadditions.phantom_liquiface": "Phantom Liquiface",
"block.actuallyadditions.phantom_placer": "Phantom Placer (wip)", "block.actuallyadditions.phantom_placer": "Phantom Placer",
"block.actuallyadditions.phantom_breaker": "Phantom Breaker (wip)", "block.actuallyadditions.phantom_breaker": "Phantom Breaker",
"block.actuallyadditions.lava_factory_controller": "Lava Factory Controller", "block.actuallyadditions.lava_factory_controller": "Lava Factory Controller",
"block.actuallyadditions.lava_factory_casing": "Lava Casing", "block.actuallyadditions.lava_factory_casing": "Lava Casing",
"block.actuallyadditions.fluid_placer": "Fluid Placer", "block.actuallyadditions.fluid_placer": "Fluid Placer",
@ -257,23 +257,26 @@
"block.actuallyadditions.atomic_reconstructor.info.2.12": "Replacer", "block.actuallyadditions.atomic_reconstructor.info.2.12": "Replacer",
"block.actuallyadditions.atomic_reconstructor.info.2.13": "Differentiator", "block.actuallyadditions.atomic_reconstructor.info.2.13": "Differentiator",
"block.actuallyadditions.atomic_reconstructor.info.2.14": "Receiver", "block.actuallyadditions.atomic_reconstructor.info.2.14": "Receiver",
"block.actuallyadditions.crate_small": "Small Storage Crate (wip)",
"block.actuallyadditions.crate_medium": "Medium Storage Crate (wip)",
"block.actuallyadditions.crate_large": "Large Storage Crate (wip)",
"_comment": "Items", "_comment": "Items",
"item.actuallyadditions.drill_blue": "Blue Drill (wip)", "item.actuallyadditions.drill_blue": "Blue Drill",
"item.actuallyadditions.drill_light_blue": "Light Blue Drill (wip)", "item.actuallyadditions.drill_light_blue": "Light Blue Drill",
"item.actuallyadditions.drill_brown": "Brown Drill (wip)", "item.actuallyadditions.drill_brown": "Brown Drill",
"item.actuallyadditions.drill_black": "Black Drill (wip)", "item.actuallyadditions.drill_black": "Black Drill",
"item.actuallyadditions.drill_white": "White Drill (wip)", "item.actuallyadditions.drill_white": "White Drill",
"item.actuallyadditions.drill_magenta": "Magenta Drill (wip)", "item.actuallyadditions.drill_magenta": "Magenta Drill",
"item.actuallyadditions.drill_orange": "Orange Drill (wip)", "item.actuallyadditions.drill_orange": "Orange Drill",
"item.actuallyadditions.drill_pink": "Pink Drill (wip)", "item.actuallyadditions.drill_pink": "Pink Drill",
"item.actuallyadditions.drill_purple": "Purple Drill (wip)", "item.actuallyadditions.drill_purple": "Purple Drill",
"item.actuallyadditions.drill_red": "Red Drill (wip)", "item.actuallyadditions.drill_red": "Red Drill",
"item.actuallyadditions.drill_yellow": "Yellow Drill (wip)", "item.actuallyadditions.drill_yellow": "Yellow Drill",
"item.actuallyadditions.drill_cyan": "Cyan Drill (wip)", "item.actuallyadditions.drill_cyan": "Cyan Drill",
"item.actuallyadditions.drill_gray": "Gray Drill (wip)", "item.actuallyadditions.drill_gray": "Gray Drill",
"item.actuallyadditions.drill_green": "Green Drill (wip)", "item.actuallyadditions.drill_green": "Green Drill",
"item.actuallyadditions.drill_light_gray": "Light Gray Drill (wip)", "item.actuallyadditions.drill_light_gray": "Light Gray Drill",
"item.actuallyadditions.drill_lime": "Lime Drill (wip)", "item.actuallyadditions.drill_lime": "Lime Drill",
"item.actuallyadditions.rice": "Rice", "item.actuallyadditions.rice": "Rice",
"item.actuallyadditions.rice_dough": "Rice Dough", "item.actuallyadditions.rice_dough": "Rice Dough",
"item.actuallyadditions.rice_seeds": "Rice Seeds", "item.actuallyadditions.rice_seeds": "Rice Seeds",
@ -313,7 +316,7 @@
"item.actuallyadditions.drill_upgrade_silk_touch": "Drill Silk Touch Augment", "item.actuallyadditions.drill_upgrade_silk_touch": "Drill Silk Touch Augment",
"item.actuallyadditions.drill_upgrade_fortune": "Drill Fortune Augment I", "item.actuallyadditions.drill_upgrade_fortune": "Drill Fortune Augment I",
"item.actuallyadditions.drill_upgrade_fortune_ii": "Drill Fortune Augment II (Gives Fortune III!)", "item.actuallyadditions.drill_upgrade_fortune_ii": "Drill Fortune Augment II (Gives Fortune III!)",
"item.actuallyadditions.drill_upgrade_block_placing": "Drill Block Placing Augment (wip)", "item.actuallyadditions.drill_upgrade_block_placing": "Drill Block Placing Augment",
"item.actuallyadditions.drill_upgrade_three_by_three": "Drill Area Augment I", "item.actuallyadditions.drill_upgrade_three_by_three": "Drill Area Augment I",
"item.actuallyadditions.drill_upgrade_five_by_five": "Drill Area Augment II", "item.actuallyadditions.drill_upgrade_five_by_five": "Drill Area Augment II",
"item.actuallyadditions.dough": "Dough (wip)", "item.actuallyadditions.dough": "Dough (wip)",
@ -530,10 +533,10 @@
"container.actuallyadditions.crusher_double": "Double Crusher", "container.actuallyadditions.crusher_double": "Double Crusher",
"container.actuallyadditions.powered_furnace": "Powered Furnace", "container.actuallyadditions.powered_furnace": "Powered Furnace",
"container.actuallyadditions.feeder": "Feeder", "container.actuallyadditions.feeder": "Feeder",
"container.actuallyadditions.crate_small": "Small Storage Crate (wip)", "container.actuallyadditions.crate_small": "Small Storage Crate",
"container.actuallyadditions.crate_small.desc": "'Small'", "container.actuallyadditions.crate_small.desc": "'Small'",
"container.actuallyadditions.crate_medium": "Medium Storage Crate (wip)", "container.actuallyadditions.crate_medium": "Medium Storage Crate",
"container.actuallyadditions.crate_large": "Large Storage Crate (wip)", "container.actuallyadditions.crate_large": "Large Storage Crate",
"container.actuallyadditions.crate_large.desc": "Supersolid", "container.actuallyadditions.crate_large.desc": "Supersolid",
"container.actuallyadditions.repairer": "Repairer", "container.actuallyadditions.repairer": "Repairer",
"container.actuallyadditions.placer": "Placer", "container.actuallyadditions.placer": "Placer",