different texture for linked chest, fixed double chest
This commit is contained in:
parent
fe45e71669
commit
fa53e02141
@ -38,12 +38,12 @@ mod_name=Networked Chests
|
|||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=All Rights Reserved
|
mod_license=All Rights Reserved
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=0.1.1
|
mod_version=0.2.0
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
mod_group_id=com.jenny
|
mod_group_id=com.jenny
|
||||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||||
mod_authors=Jenny
|
mod_authors=xJenny69
|
||||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||||
mod_description=
|
mod_description=
|
||||||
|
@ -2,6 +2,7 @@ package com.jenny.networked_chests.items;
|
|||||||
|
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
@ -15,7 +16,7 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
import net.minecraft.world.item.TooltipFlag;
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ public class ChestInterface extends Item {
|
|||||||
if (chestLocation == null) {
|
if (chestLocation == null) {
|
||||||
chestLocation = new CompoundTag();
|
chestLocation = new CompoundTag();
|
||||||
}
|
}
|
||||||
|
chestLocation.putInt("CustomModelData", 1);
|
||||||
chestLocation.putInt("chest_pos_x", blockPos.getX());
|
chestLocation.putInt("chest_pos_x", blockPos.getX());
|
||||||
chestLocation.putInt("chest_pos_y", blockPos.getY());
|
chestLocation.putInt("chest_pos_y", blockPos.getY());
|
||||||
chestLocation.putInt("chest_pos_z", blockPos.getZ());
|
chestLocation.putInt("chest_pos_z", blockPos.getZ());
|
||||||
@ -77,8 +79,9 @@ public class ChestInterface extends Item {
|
|||||||
private void openChest(Level level, ServerPlayer player, ItemStack itemStack) {
|
private void openChest(Level level, ServerPlayer player, ItemStack itemStack) {
|
||||||
if (chestSet(itemStack)) {
|
if (chestSet(itemStack)) {
|
||||||
if (isChest(level, getPos(itemStack))) {
|
if (isChest(level, getPos(itemStack))) {
|
||||||
((ChestBlockEntity) level.getBlockEntity(getPos(itemStack))).startOpen(player);
|
level.getBlockState(getPos(itemStack)).use(level, player, InteractionHand.MAIN_HAND, new BlockHitResult(player.position(), Direction.DOWN, getPos(itemStack), false));
|
||||||
player.openMenu((ChestBlockEntity) level.getBlockEntity(getPos(itemStack)));
|
//((ChestBlockEntity) level.getBlockEntity(getPos(itemStack))).startOpen(player);
|
||||||
|
//player.openMenu((ChestBlockEntity) level.getBlockEntity(getPos(itemStack)));
|
||||||
} else {
|
} else {
|
||||||
unsetChest(itemStack);
|
unsetChest(itemStack);
|
||||||
messageChestMissing(player);
|
messageChestMissing(player);
|
||||||
@ -97,6 +100,7 @@ public class ChestInterface extends Item {
|
|||||||
private void unsetChest(ItemStack itemStack) {
|
private void unsetChest(ItemStack itemStack) {
|
||||||
CompoundTag cTag = itemStack.getTag();
|
CompoundTag cTag = itemStack.getTag();
|
||||||
assert cTag != null;
|
assert cTag != null;
|
||||||
|
cTag.remove("CustomModelData");
|
||||||
cTag.remove("chest_pos_x");
|
cTag.remove("chest_pos_x");
|
||||||
cTag.remove("chest_pos_y");
|
cTag.remove("chest_pos_y");
|
||||||
cTag.remove("chest_pos_z");
|
cTag.remove("chest_pos_z");
|
||||||
|
@ -2,5 +2,13 @@
|
|||||||
"parent": "minecraft:item/generated",
|
"parent": "minecraft:item/generated",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "networked_chests:item/chest_interface"
|
"layer0": "networked_chests:item/chest_interface"
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"custom_model_data": 1
|
||||||
|
},
|
||||||
|
"model": "networked_chests:item/chest_interface_linked"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "networked_chests:item/chest_interface_linked"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 162 B |
Loading…
x
Reference in New Issue
Block a user