1.0.11
All checks were successful
RelicCraft/pipeline/head This commit looks good

Ctrl+Middle-Clicking an active Teleportation Beacon/Restrictor will now correctly appear as active in the inventory
This commit is contained in:
TheBrokenRail 2020-04-08 18:22:38 -04:00
parent 918d0bc9b9
commit 73cb9b1991
11 changed files with 45 additions and 14 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.11**
* Ctrl+Middle-Clicking an active Teleportation Beacon/Restrictor will now correctly appear as active in the inventory
**1.0.10** **1.0.10**
* Allow Dilating Random Tick Speed * Allow Dilating Random Tick Speed

View File

@ -19,9 +19,6 @@ minecraft {
repositories { repositories {
jcenter() jcenter()
maven {
url "https://dl.bintray.com/shedaniel/autoconfig1u/"
}
} }
dependencies { dependencies {

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.7.10+build.191 fabric_loader_version = 0.7.10+build.191
# Mod Properties # Mod Properties
mod_version = 1.0.10 mod_version = 1.0.11
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = reliccraft archives_base_name = reliccraft

View File

@ -11,6 +11,7 @@ import com.thebrokenrail.reliccraft.block.DragonEggHolderBlockEntity;
import com.thebrokenrail.reliccraft.block.TeleportationBeaconBlock; import com.thebrokenrail.reliccraft.block.TeleportationBeaconBlock;
import com.thebrokenrail.reliccraft.block.TeleportationRestrictorBlock; import com.thebrokenrail.reliccraft.block.TeleportationRestrictorBlock;
import com.thebrokenrail.reliccraft.entity.RelicEntity; import com.thebrokenrail.reliccraft.entity.RelicEntity;
import com.thebrokenrail.reliccraft.item.DragonEggHolderBlockItem;
import com.thebrokenrail.reliccraft.item.TargetedEnderPearlItem; import com.thebrokenrail.reliccraft.item.TargetedEnderPearlItem;
import com.thebrokenrail.reliccraft.item.TimeDilaterItem; import com.thebrokenrail.reliccraft.item.TimeDilaterItem;
import com.thebrokenrail.reliccraft.item.RelicItem; import com.thebrokenrail.reliccraft.item.RelicItem;
@ -31,9 +32,7 @@ import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.loot.BinomialLootTableRange; import net.minecraft.loot.BinomialLootTableRange;
import net.minecraft.loot.LootTables; import net.minecraft.loot.LootTables;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.ItemEntry;
@ -43,7 +42,6 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.structure.StructurePieceType; import net.minecraft.structure.StructurePieceType;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -154,8 +152,8 @@ public class RelicCraft implements ModInitializer {
TELEPORTATION_BEACON_BLOCK = Registry.register(Registry.BLOCK, new Identifier(NAMESPACE, "teleportation_beacon"), new TeleportationBeaconBlock()); TELEPORTATION_BEACON_BLOCK = Registry.register(Registry.BLOCK, new Identifier(NAMESPACE, "teleportation_beacon"), new TeleportationBeaconBlock());
DRAGON_EGG_HOLDER_BLOCK_ENTITY = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(NAMESPACE, "dragon_egg_holder"), BlockEntityType.Builder.create(DragonEggHolderBlockEntity::new, TELEPORTATION_RESTRICTOR_BLOCK, TELEPORTATION_BEACON_BLOCK).build(null)); DRAGON_EGG_HOLDER_BLOCK_ENTITY = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(NAMESPACE, "dragon_egg_holder"), BlockEntityType.Builder.create(DragonEggHolderBlockEntity::new, TELEPORTATION_RESTRICTOR_BLOCK, TELEPORTATION_BEACON_BLOCK).build(null));
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "teleportation_restrictor"), new BlockItem(TELEPORTATION_RESTRICTOR_BLOCK, new Item.Settings().group(ItemGroup.MISC).rarity(Rarity.UNCOMMON))); Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "teleportation_restrictor"), new DragonEggHolderBlockItem(TELEPORTATION_RESTRICTOR_BLOCK));
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "teleportation_beacon"), new BlockItem(TELEPORTATION_BEACON_BLOCK, new Item.Settings().group(ItemGroup.MISC).rarity(Rarity.UNCOMMON))); Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "teleportation_beacon"), new DragonEggHolderBlockItem(TELEPORTATION_BEACON_BLOCK));
ACTIVATE_TELEPORTATION_RESTRICTOR_CRITERION = CriteriaRegistryHook.callRegister(new ActivateTeleportationRestrictorCriterion()); ACTIVATE_TELEPORTATION_RESTRICTOR_CRITERION = CriteriaRegistryHook.callRegister(new ActivateTeleportationRestrictorCriterion());
REVEAL_RELIC_CRITERION = CriteriaRegistryHook.callRegister(new RevealRelicCriterion()); REVEAL_RELIC_CRITERION = CriteriaRegistryHook.callRegister(new RevealRelicCriterion());

View File

@ -108,6 +108,10 @@ public class DragonEggHolderBlockEntity extends BlockEntity implements Inventory
@Override @Override
public void markDirty() { public void markDirty() {
super.markDirty(); super.markDirty();
updateBlockState();
}
private void updateBlockState() {
if (hasWorld()) { if (hasWorld()) {
assert getWorld() != null; assert getWorld() != null;
BlockState state = getWorld().getBlockState(pos); BlockState state = getWorld().getBlockState(pos);

View File

@ -0,0 +1,29 @@
package com.thebrokenrail.reliccraft.item;
import com.thebrokenrail.reliccraft.RelicCraft;
import net.minecraft.block.Block;
import net.minecraft.inventory.Inventories;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
public class DragonEggHolderBlockItem extends BlockItem {
public DragonEggHolderBlockItem(Block block) {
super(block, new Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MISC));
addPropertyGetter(new Identifier(RelicCraft.NAMESPACE, "active"), (stack, world, entity) -> {
CompoundTag tag = stack.getSubTag("BlockEntityTag");
if (tag != null) {
DefaultedList<ItemStack> list = DefaultedList.ofSize(1, ItemStack.EMPTY);
Inventories.fromTag(tag, list);
if (!list.get(0).isEmpty()) {
return 1;
}
}
return 0;
});
}
}

View File

@ -3,7 +3,7 @@
"overrides": [ "overrides": [
{ {
"predicate": { "predicate": {
"custom_model_data": 1 "reliccraft:active": 1
}, },
"model": "reliccraft:block/active_teleportation_beacon" "model": "reliccraft:block/active_teleportation_beacon"
} }

View File

@ -3,7 +3,7 @@
"overrides": [ "overrides": [
{ {
"predicate": { "predicate": {
"custom_model_data": 1 "reliccraft:active": 1
}, },
"model": "reliccraft:block/active_teleportation_restrictor" "model": "reliccraft:block/active_teleportation_restrictor"
} }

View File

@ -3,7 +3,7 @@
"display": { "display": {
"icon": { "icon": {
"item": "reliccraft:teleportation_beacon", "item": "reliccraft:teleportation_beacon",
"nbt": "{CustomModelData: 1}" "nbt": "{BlockEntityTag: {Items: [{Slot: 0b, id: \"minecraft:dragon_egg\", Count: 1b}], id: \"reliccraft:dragon_egg_holder\"}}"
}, },
"title": { "title": {
"translate": "advancements.reliccraft.activate_teleportation_beacon.title" "translate": "advancements.reliccraft.activate_teleportation_beacon.title"

View File

@ -3,7 +3,7 @@
"display": { "display": {
"icon": { "icon": {
"item": "reliccraft:teleportation_restrictor", "item": "reliccraft:teleportation_restrictor",
"nbt": "{CustomModelData: 1}" "nbt": "{BlockEntityTag: {Items: [{Slot: 0b, id: \"minecraft:dragon_egg\", Count: 1b}], id: \"reliccraft:dragon_egg_holder\"}}"
}, },
"title": { "title": {
"translate": "advancements.reliccraft.activate_teleportation_restrictor.title" "translate": "advancements.reliccraft.activate_teleportation_restrictor.title"

View File

@ -3,7 +3,7 @@
"display": { "display": {
"icon": { "icon": {
"item": "reliccraft:teleportation_beacon", "item": "reliccraft:teleportation_beacon",
"nbt": "{CustomModelData: 1}" "nbt": "{BlockEntityTag: {Items: [{Slot: 0b, id: \"minecraft:dragon_egg\", Count: 1b}], id: \"reliccraft:dragon_egg_holder\"}}"
}, },
"title": { "title": {
"translate": "advancements.reliccraft.use_targeted_ender_pearl.title" "translate": "advancements.reliccraft.use_targeted_ender_pearl.title"