ring of last chance

This commit is contained in:
Ellpeck 2020-02-07 23:50:16 +01:00
parent d1de398db4
commit 5a44d3f8af
27 changed files with 193 additions and 27 deletions

View file

@ -1,17 +1,32 @@
{
"variants": {
"facing=north": {
"facing=north,waterlogged=false": {
"model": "naturesaura:block/blast_furnace_booster"
},
"facing=south": {
"facing=south,waterlogged=false": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 180
},
"facing=west": {
"facing=west,waterlogged=false": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 270
},
"facing=east": {
"facing=east,waterlogged=false": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 90
},
"facing=north,waterlogged=true": {
"model": "naturesaura:block/blast_furnace_booster"
},
"facing=south,waterlogged=true": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 180
},
"facing=west,waterlogged=true": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 270
},
"facing=east,waterlogged=true": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 90
}

View file

@ -1,27 +1,53 @@
{
"variants": {
"facing=down": {
"facing=down,waterlogged=false": {
"model": "naturesaura:block/furnace_heater",
"x": 180
},
"facing=up": {
"facing=up,waterlogged=false": {
"model": "naturesaura:block/furnace_heater"
},
"facing=north": {
"facing=north,waterlogged=false": {
"model": "naturesaura:block/furnace_heater",
"x": 90
},
"facing=south": {
"facing=south,waterlogged=false": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 180
},
"facing=west": {
"facing=west,waterlogged=false": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 270
},
"facing=east": {
"facing=east,waterlogged=false": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 90
},
"facing=down,waterlogged=true": {
"model": "naturesaura:block/furnace_heater",
"x": 180
},
"facing=up,waterlogged=true": {
"model": "naturesaura:block/furnace_heater"
},
"facing=north,waterlogged=true": {
"model": "naturesaura:block/furnace_heater",
"x": 90
},
"facing=south,waterlogged=true": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 180
},
"facing=west,waterlogged=true": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 270
},
"facing=east,waterlogged=true": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 90

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "naturesaura:item/death_ring"
}
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:death_ring"
]
}

View file

@ -37,6 +37,7 @@ public class CuriosCompat implements ICompat {
.put(ModItems.AURA_CACHE, CurioTags.BELT)
.put(ModItems.AURA_TROVE, CurioTags.BELT)
.put(ModItems.SHOCKWAVE_CREATOR, CurioTags.NECKLACE)
.put(ModItems.DEATH_RING, CurioTags.RING)
.build();
@Override

View file

@ -32,7 +32,7 @@ import static net.minecraft.dispenser.DefaultDispenseItemBehavior.doDispense;
public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICustomItemModel {
public ItemAuraBottle(Item emptyBottle) {
super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB));
super("aura_bottle");
MinecraftForge.EVENT_BUS.register(new EventHandler());
DispenserBlock.registerDispenseBehavior(emptyBottle, (source, stack) -> {

View file

@ -38,7 +38,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
private final int capacity;
public ItemAuraCache(String name, int capacity) {
super(name, new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super(name, new Properties().maxStackSize(1));
this.capacity = capacity;
}

View file

@ -15,7 +15,7 @@ import net.minecraft.world.World;
public class ItemCaveFinder extends ItemImpl {
public ItemCaveFinder() {
super("cave_finder", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super("cave_finder", new Properties().maxStackSize(1));
}
@Override

View file

@ -23,7 +23,7 @@ import java.util.List;
public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, ICustomItemModel {
public ItemColorChanger() {
super("color_changer", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super("color_changer", new Properties().maxStackSize(1));
this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "fill_mode"),
(stack, worldIn, entityIn) -> isFillMode(stack) ? 1F : 0F);

View file

@ -0,0 +1,42 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.packet.PacketClient;
import de.ellpeck.naturesaura.packet.PacketHandler;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class ItemDeathRing extends ItemImpl {
public ItemDeathRing() {
super("death_ring", new Properties().maxStackSize(1));
MinecraftForge.EVENT_BUS.register(new Events());
}
public static class Events {
@SubscribeEvent
public void onDeath(LivingDeathEvent event) {
LivingEntity entity = event.getEntityLiving();
if (!entity.world.isRemote && entity instanceof PlayerEntity) {
ItemStack equipped = Helper.getEquippedItem(s -> s.getItem() == ModItems.DEATH_RING, (PlayerEntity) entity);
if (!equipped.isEmpty()) {
entity.setHealth(entity.getMaxHealth() / 2);
entity.clearActivePotions();
entity.addPotionEffect(new EffectInstance(Effects.REGENERATION, 500, 1));
PacketHandler.sendToAllAround(entity.world, entity.getPosition(), 32,
new PacketClient(1, entity.getEntityId()));
equipped.shrink(1);
event.setCanceled(true);
}
}
}
}
}

View file

@ -21,7 +21,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem {
public ItemEffectPowder() {
super("effect_powder", new Properties().group(NaturesAura.CREATIVE_TAB));
super("effect_powder");
}
public static ResourceLocation getEffect(ItemStack stack) {

View file

@ -31,7 +31,7 @@ import java.util.List;
public class ItemEnderAccess extends ItemImpl {
public ItemEnderAccess() {
super("ender_access", new Properties().group(NaturesAura.CREATIVE_TAB));
super("ender_access");
}
@Override

View file

@ -17,7 +17,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemEye extends ItemImpl implements ITrinketItem {
public ItemEye(String name) {
super(name, new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super(name, new Properties().maxStackSize(1));
}
@Override

View file

@ -5,10 +5,9 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
// Name (Glowing) ambiguous?
public class ItemGlowing extends ItemImpl {
public ItemGlowing(String baseName) {
super(baseName, new Properties().group(NaturesAura.CREATIVE_TAB));
super(baseName);
}
@Override

View file

@ -11,7 +11,7 @@ import net.minecraft.util.ActionResultType;
public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem {
public ItemGoldFiber() {
super("gold_fiber", new Properties().group(NaturesAura.CREATIVE_TAB));
super("gold_fiber");
}
@Override

View file

@ -10,11 +10,11 @@ public class ItemImpl extends Item implements IModItem {
private final String baseName;
public ItemImpl(String baseName) {
this(baseName, new Properties().group(NaturesAura.CREATIVE_TAB));
this(baseName, new Properties());
}
public ItemImpl(String baseName, Item.Properties properties) {
super(properties);
super(properties.group(NaturesAura.CREATIVE_TAB));
this.baseName = baseName;
ModRegistry.add(this);
}

View file

@ -15,7 +15,7 @@ import javax.annotation.Nonnull;
public class ItemMoverMinecart extends ItemImpl {
public ItemMoverMinecart() {
super("mover_cart", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super("mover_cart", new Properties().maxStackSize(1));
}
@Nonnull

View file

@ -20,7 +20,7 @@ public class ItemMultiblockMaker extends ItemImpl {
private static List<IMultiblock> multiblocks;
public ItemMultiblockMaker() {
super("multiblock_maker", new Properties().group(NaturesAura.CREATIVE_TAB));
super("multiblock_maker");
}
private static int getMultiblock(ItemStack stack) {

View file

@ -28,7 +28,7 @@ public class ItemRangeVisualizer extends ItemImpl {
public static final ListMultimap<DimensionType, BlockPos> VISUALIZED_RAILS = ArrayListMultimap.create();
public ItemRangeVisualizer() {
super("range_visualizer", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super("range_visualizer", new Properties().maxStackSize(1));
MinecraftForge.EVENT_BUS.register(new EventHandler());
}

View file

@ -36,7 +36,7 @@ import java.util.List;
public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
public ItemShockwaveCreator() {
super("shockwave_creator", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
super("shockwave_creator", new Properties().maxStackSize(1));
}
@Override

View file

@ -45,4 +45,5 @@ public final class ModItems {
public static Item ENDER_ACCESS;
public static Item CAVE_FINDER;
public static Item CRIMSON_MEAL;
public static Item DEATH_RING;
}

View file

@ -1,8 +1,13 @@
package de.ellpeck.naturesaura.packet;
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.network.NetworkEvent;
@ -52,6 +57,13 @@ public class PacketClient {
int goalDim = message.data[0];
BlockPos goalPos = new BlockPos(message.data[1], message.data[2], message.data[3]);
ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, DimensionType.getById(goalDim), goalPos);
case 1:
Entity entity = mc.world.getEntityByID(message.data[0]);
mc.particles.emitParticleAtEntity(entity, ParticleTypes.TOTEM_OF_UNDYING, 30);
mc.world.playSound(entity.getPosX(), entity.getPosY(), entity.getPosZ(), SoundEvents.ITEM_TOTEM_USE, entity.getSoundCategory(), 1.0F, 1.0F, false);
if (entity == mc.player) {
mc.gameRenderer.displayItemActivation(new ItemStack(ModItems.DEATH_RING));
}
}
}
}

View file

@ -172,7 +172,8 @@ public final class ModRegistry {
new ItemImpl("token_grief"),
new ItemEnderAccess(),
new ItemCaveFinder(),
new ItemCrimsonMeal()
new ItemCrimsonMeal(),
new ItemDeathRing()
);
Helper.populateObjectHolders(ModItems.class, event.getRegistry());
}

View file

@ -105,6 +105,7 @@
"item.naturesaura.cave_finder": "Staff of Shadows",
"item.naturesaura.aura_trove": "Aura Trove",
"item.naturesaura.crimson_meal": "Crimson Meal",
"item.naturesaura.death_ring": "Ring of Last Chance",
"container.naturesaura:tree_ritual.name": "Ritual of the Forest",
"container.naturesaura:altar.name": "Natural Altar Infusion",
"container.naturesaura:offering.name": "Offering to the Gods",

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

View file

@ -0,0 +1,21 @@
{
"name": "Ring of Last Chance",
"icon": "naturesaura:death_ring",
"category": "items",
"advancement": "naturesaura:sky_ingot",
"pages": [
{
"type": "text",
"text": "When one is stuck, as one says, between a rock and a hard place, not much can be done - sometimes, $(thing)death$() just has to be accepted as an occurence.$(p)That's what magical botanists used to think before they realized that $(thing)death itself$() could be $()averted$() using something as simple as a ring: The $(item)Ring of Last Chance$(), when placed anywhere in the user's"
},
{
"type": "text",
"text": "inventory, will prevent their death by healing them and $(thing)disappearing$() in the process, similary to the $(item)Totem of Undying$()."
},
{
"type": "crafting",
"text": "Creating the $(item)Ring of Last Chance$()$(p)$(italic)This Ring Fits perfectly",
"recipe": "naturesaura:death_ring"
}
]
}

View file

@ -0,0 +1,35 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"TKE",
"GSG",
"NGN"
],
"key": {
"G": {
"item": "minecraft:gold_ingot"
},
"S": {
"item": "naturesaura:sky_ingot"
},
"T": {
"item": "naturesaura:token_terror"
},
"E": {
"item": "naturesaura:token_euphoria"
},
"N": {
"type": "forge:nbt",
"item": "naturesaura:aura_bottle",
"nbt": {
"stored_type": "naturesaura:end"
}
},
"K": {
"item": "minecraft:wither_skeleton_skull"
}
},
"result": {
"item": "naturesaura:death_ring"
}
}