added magnifier
This commit is contained in:
@@ -91,17 +91,10 @@ public class BlockDrill extends FallingBlock implements EntityBlock {
|
|||||||
loadings.put(QuicklyItems.CANOLABOTTLE, 8);
|
loadings.put(QuicklyItems.CANOLABOTTLE, 8);
|
||||||
loadings.put(QuicklyItems.CANOLABOTTLESTACK, 72);
|
loadings.put(QuicklyItems.CANOLABOTTLESTACK, 72);
|
||||||
Item item = itemStack.getItem();
|
Item item = itemStack.getItem();
|
||||||
if (itemStack.isEmpty()) {
|
if (QuicklyItems.MAGNIFIER.equals(item)) {
|
||||||
if (!level.isClientSide() && player instanceof ServerPlayer serverPlayer) {
|
if (!level.isClientSide() && player instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.sendSystemMessage(Component.translatable("info.block.drillfuel", state.getValue(FUEL)), false);
|
serverPlayer.sendSystemMessage(Component.translatable("info.block.drillfuel", state.getValue(FUEL)), false);
|
||||||
}
|
}
|
||||||
} else if (QuicklyItems.COPPERSTICK.equals(item)) {
|
|
||||||
Direction newDirection = hitResult.getDirection();
|
|
||||||
newDirection = newDirection.equals(Direction.UP) ? Direction.DOWN : newDirection;
|
|
||||||
Integer fuelLeft = state.getValue(FUEL);
|
|
||||||
level.addFreshEntity(
|
|
||||||
new ItemEntity(level, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(QuicklyItems.CANOLABOTTLE, fuelLeft)));
|
|
||||||
level.setBlockAndUpdate(pos, QuicklyBlocks.DRILL.defaultBlockState().setValue(FACING, newDirection));
|
|
||||||
} else if (loadings.containsKey(item)) {
|
} else if (loadings.containsKey(item)) {
|
||||||
Integer fuelWeight = loadings.get(item);
|
Integer fuelWeight = loadings.get(item);
|
||||||
if (fuelWeight != null) {
|
if (fuelWeight != null) {
|
||||||
@@ -119,6 +112,13 @@ public class BlockDrill extends FallingBlock implements EntityBlock {
|
|||||||
}
|
}
|
||||||
player.getActiveItem().shrink(1);
|
player.getActiveItem().shrink(1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Direction newDirection = hitResult.getDirection();
|
||||||
|
newDirection = newDirection.equals(Direction.UP) ? Direction.DOWN : newDirection;
|
||||||
|
Integer fuelLeft = state.getValue(FUEL);
|
||||||
|
level.addFreshEntity(
|
||||||
|
new ItemEntity(level, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(QuicklyItems.CANOLABOTTLE, fuelLeft)));
|
||||||
|
level.setBlockAndUpdate(pos, QuicklyBlocks.DRILL.defaultBlockState().setValue(FACING, newDirection));
|
||||||
}
|
}
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import java.util.List;
|
|||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
import de.jottyfan.minecraft.blockentity.ItemHoarderBlockEntity;
|
import de.jottyfan.minecraft.blockentity.ItemHoarderBlockEntity;
|
||||||
|
import de.jottyfan.minecraft.item.QuicklyItems;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
@@ -52,8 +54,10 @@ public class Itemhoarder extends Block implements EntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player,
|
protected InteractionResult useItemOn(ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player,
|
||||||
BlockHitResult hitResult) {
|
InteractionHand hand, BlockHitResult hitResult) {
|
||||||
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
|
if (QuicklyItems.MAGNIFIER.equals(itemStack.getItem())) {
|
||||||
MutableComponent message = Component.empty();
|
MutableComponent message = Component.empty();
|
||||||
BlockEntity blockEntity = level.getBlockEntity(pos);
|
BlockEntity blockEntity = level.getBlockEntity(pos);
|
||||||
if (blockEntity instanceof ItemHoarderBlockEntity) {
|
if (blockEntity instanceof ItemHoarderBlockEntity) {
|
||||||
@@ -63,11 +67,10 @@ public class Itemhoarder extends Block implements EntityBlock {
|
|||||||
message.append(Component.literal("\n")).append(line);
|
message.append(Component.literal("\n")).append(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component complete = Component.translatable("info.block.itemhoarder", message);
|
Component complete = Component.translatable("info.block.itemhoarder", message);
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
|
||||||
serverPlayer.displayClientMessage(complete, false);
|
serverPlayer.displayClientMessage(complete, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class QuicklyItems {
|
|||||||
public static final Item QUICKIEPOWDER = registerItem("quickiepowder");
|
public static final Item QUICKIEPOWDER = registerItem("quickiepowder");
|
||||||
public static final Item SPEEDINGOT = registerItem("speedingot");
|
public static final Item SPEEDINGOT = registerItem("speedingot");
|
||||||
public static final Item QUICKIEINGOT = registerItem("quickieingot");
|
public static final Item QUICKIEINGOT = registerItem("quickieingot");
|
||||||
|
public static final Item MAGNIFIER = registerItem("magnifier");
|
||||||
|
|
||||||
// TODO: salpeter, sulfor
|
// TODO: salpeter, sulfor
|
||||||
// TODO: carrot stack
|
// TODO: carrot stack
|
||||||
@@ -98,6 +99,7 @@ public class QuicklyItems {
|
|||||||
item.accept(COPPERSTRING);
|
item.accept(COPPERSTRING);
|
||||||
item.accept(COPPERSTICK);
|
item.accept(COPPERSTICK);
|
||||||
item.accept(COPPERSTUB);
|
item.accept(COPPERSTUB);
|
||||||
|
item.accept(MAGNIFIER);
|
||||||
item.accept(ARMOR_TURQUOISE_HELMET);
|
item.accept(ARMOR_TURQUOISE_HELMET);
|
||||||
item.accept(ARMOR_TURQUOISE_CHESTPLATE);
|
item.accept(ARMOR_TURQUOISE_CHESTPLATE);
|
||||||
item.accept(ARMOR_TURQUOISE_LEGGINGS);
|
item.accept(ARMOR_TURQUOISE_LEGGINGS);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class QuicklyTab {
|
|||||||
|
|
||||||
public static final void registerItemGroup() {
|
public static final void registerItemGroup() {
|
||||||
Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, QUICKLY_TAB,
|
Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, QUICKLY_TAB,
|
||||||
FabricItemGroup.builder().icon(() -> new ItemStack(QuicklyItems.STUB))
|
FabricItemGroup.builder().icon(() -> new ItemStack(QuicklyItems.QUICKIEPOWDER))
|
||||||
.title(Component.translatable("tab." + Quickly.MOD_ID)).build());
|
.title(Component.translatable("tab." + Quickly.MOD_ID)).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
src/main/resources/assets/quickly/items/magnifier.json
Normal file
6
src/main/resources/assets/quickly/items/magnifier.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "quickly:item/magnifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
"item.quickly.itemhoarder": "Itemsauger",
|
"item.quickly.itemhoarder": "Itemsauger",
|
||||||
"item.quickly.kelpbundle": "Seegrassbündel",
|
"item.quickly.kelpbundle": "Seegrassbündel",
|
||||||
"item.quickly.lavahoarder": "voller Lavasauger",
|
"item.quickly.lavahoarder": "voller Lavasauger",
|
||||||
|
"item.quickly.magnifier": "Lupe",
|
||||||
"item.quickly.monsterhoarder": "Monstersauger",
|
"item.quickly.monsterhoarder": "Monstersauger",
|
||||||
"item.quickly.oredeepslateturquoise": "Türkistiefenerz",
|
"item.quickly.oredeepslateturquoise": "Türkistiefenerz",
|
||||||
"item.quickly.oreturquoise": "Türkiserz",
|
"item.quickly.oreturquoise": "Türkiserz",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"item.quickly.itemhoarder": "item hoarder",
|
"item.quickly.itemhoarder": "item hoarder",
|
||||||
"item.quickly.kelpbundle": "kelp bundle",
|
"item.quickly.kelpbundle": "kelp bundle",
|
||||||
"item.quickly.lavahoarder": "filled lava hoarder",
|
"item.quickly.lavahoarder": "filled lava hoarder",
|
||||||
|
"item.quickly.magnifier": "magnifier",
|
||||||
"item.quickly.monsterhoarder": "monster hoarder",
|
"item.quickly.monsterhoarder": "monster hoarder",
|
||||||
"item.quickly.oredeepslateturquoise": "turquoise deepslate ore",
|
"item.quickly.oredeepslateturquoise": "turquoise deepslate ore",
|
||||||
"item.quickly.oreturquoise": "turquoise ore",
|
"item.quickly.oreturquoise": "turquoise ore",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/stick",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "quickly:item/magnifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/main/resources/assets/quickly/textures/item/magnifier.png
Normal file
BIN
src/main/resources/assets/quickly/textures/item/magnifier.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 557 B |
15
src/main/resources/data/quickly/recipe/shaped_magnifier.json
Normal file
15
src/main/resources/data/quickly/recipe/shaped_magnifier.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"g ",
|
||||||
|
" s"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"g": "minecraft:glass_pane",
|
||||||
|
"s": "quickly:copperstick"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"id": "quickly:magnifier",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user