Finish making some quality of life changes

This commit is contained in:
zontreck 2024-01-03 04:14:49 -07:00
parent 8a395bd9d6
commit 30bbd059b3
63 changed files with 1256 additions and 908 deletions

View file

@ -4,10 +4,7 @@ import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.blocks.FoiledBlockItem;
import dev.zontreck.otemod.entities.ModEntityTypes;
import dev.zontreck.otemod.implementation.CreativeModeTabs;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.SimpleFoiledItem;
import net.minecraft.world.item.*;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
@ -31,7 +28,13 @@ public class ModItems {
public static final RegistryObject<Item> MELTED_ENDER_PEARL = CreativeModeTabs.addToOTEModTab(ITEMS.register("melted_ender_pearl", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64))));
public static final RegistryObject<Item> SINGULARITY = CreativeModeTabs.addToOTEModTab(ITEMS.register("singularity", () -> new Item(new Item.Properties().stacksTo(1))));
public static final RegistryObject<Item> SINGULARITY = CreativeModeTabs.addToOTEModTab(ITEMS.register("singularity", () -> new UnstableSingularity(new Item.Properties().stacksTo(1))));
public static final RegistryObject<Item> COMPRESSED_OBSIDIAN_SHEET = CreativeModeTabs.addToOTEModTab(ITEMS.register("compressed_obsidian_sheet", ()->new Item(new Item.Properties())));
public static final RegistryObject<Item> LAYERED_COMPRESSED_OBSIDIAN_SHEET = CreativeModeTabs.addToOTEModTab(ITEMS.register("layered_compressed_obsidian_sheet", ()->new SimpleFoiledItem(new Item.Properties())));
public static final RegistryObject<Item> ENCASED_SINGULARITY = CreativeModeTabs.addToOTEModTab(ITEMS.register("encased_singularity", ()->new SimpleFoiledItem(new Item.Properties())));
public static final RegistryObject<Item> ETERNIUM_ROD = CreativeModeTabs.addToOTEModTab(ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64))));
public static final RegistryObject<Item> SCRUBBER_FRAME_PIECE = CreativeModeTabs.addToOTEModTab(ITEMS.register("scrubber_frame_piece", () -> new Item(new Item.Properties().stacksTo(64))));
public static final RegistryObject<Item> SCRUBBER_FRAME = CreativeModeTabs.addToOTEModTab(ITEMS.register("scrubber_frame", () -> new Item(new Item.Properties().stacksTo(64))));

View file

@ -1,5 +1,6 @@
package dev.zontreck.otemod.items;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.lore.ExtraLore;
import dev.zontreck.libzontreck.lore.LoreContainer;
import dev.zontreck.libzontreck.lore.LoreEntry;
@ -86,12 +87,9 @@ public class ThrownPossBall extends ThrowableItemProjectile
captured=true;
LoreContainer cont = new LoreContainer(getItem());
cont.miscData.LoreData.clear();
LoreEntry entry = new LoreEntry();
entry.bold = true;
entry.text = dev.zontreck.libzontreck.chat.ChatColor.doColors("!Dark_Green!Captured Mob: !Dark_Purple!" + entityName);
cont.miscData.LoreData.add(entry);
cont.miscData.loreData.clear();
LoreEntry entry = new LoreEntry.Builder().bold(true).text(ChatColor.doColors("!Dark_Green!Captured Mob: !Dark_Purple!" + entityName)).build();
cont.miscData.loreData.add(entry);
cont.commitLore();
@ -136,7 +134,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
}
LoreContainer cont = new LoreContainer(item);
cont.miscData.LoreData.clear();
cont.miscData.loreData.clear();
cont.commitLore();
if(item.getDamageValue() == 0)

View file

@ -0,0 +1,38 @@
package dev.zontreck.otemod.items;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.SimpleFoiledItem;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public class UnstableSingularity extends SimpleFoiledItem
{
public UnstableSingularity(Properties pProperties) {
super(pProperties);
}
@Override
public InteractionResult useOn(UseOnContext pContext) {
BlockState block = pContext.getLevel().getBlockState(pContext.getClickedPos());
if(block.getBlock().defaultDestroyTime() < 0)
{
pContext.getLevel().explode(pContext.getPlayer(), pContext.getClickedPos().getX(), pContext.getClickedPos().getY(), pContext.getClickedPos().getZ(), 16, true, Level.ExplosionInteraction.TNT);
pContext.getLevel().setBlock(pContext.getClickedPos(), Blocks.AIR.defaultBlockState(), 0, 0);
pContext.getItemInHand().shrink(1);
}
return InteractionResult.CONSUME;
}
}