Update to 1.19.3

This commit is contained in:
Aria 2023-05-16 17:38:10 -07:00
parent c5dd4b402f
commit d93f7fdd00
51 changed files with 264 additions and 360 deletions

View file

@ -164,15 +164,15 @@ dependencies {
// http://www.gradle.org/docs/current/userguide/dependency_management.html
//api 'curse.maven:mariadb-jdbc-561883:3586357'
runtimeOnly fg.deobf("curse.maven:mekanism-268560:3875976")
runtimeOnly fg.deobf("curse.maven:mekanism-268560:4385637")
//Add JAOPCA to verify proper recipe handling.
//implementation fg.deobf("curse.maven:jaopca-266936:4405973")
//runtimeOnly fg.deobf("curse.maven:jaopca-266936:4405973")
// Add Tinkers to the runtime dependencies
implementation fg.deobf("curse.maven:mantle-74924:4353120")
implementation fg.deobf("curse.maven:tinkers-construct-74072:4395997")
//implementation fg.deobf("curse.maven:mantle-74924:4353120")
//implementation fg.deobf("curse.maven:tinkers-construct-74072:4395997")
}
// Example for how to get properties into the manifest for reading at runtime.

View file

@ -7,10 +7,10 @@ my_version=1.3.7.0306231532
my_modgroup=dev.zontreck.otemod
my_modid=otemod
mc_version=1.18.2
forge_version=40.2.1
libz_version=1.0.5.0306230154
mc_version=1.19.3
forge_version=44.1.0
libz_version=1.0.7.0515232132
parchment_version=2022.11.06
jei_version=10.2.1.283
parchment_version=2023.03.12
jei_version=12.4.0.22
# luckperms_version=5.4

View file

@ -14,7 +14,6 @@ import com.mojang.logging.LogUtils;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.item.ItemEntity;

View file

@ -1,12 +1,21 @@
package dev.zontreck.otemod.blocks;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
public class AuroraDoorBlock extends DoorBlock
{
public static final BlockBehaviour.Properties DOOR_PROPS;
static
{
DOOR_PROPS = BlockBehaviour.Properties.of(Blocks.IRON_DOOR.defaultBlockState().getMaterial()).requiresCorrectToolForDrops().strength(10, 100000f).sound(SoundType.NETHERITE_BLOCK);
}
public AuroraDoorBlock(Properties p_52737_, String name) {
super(p_52737_);
public AuroraDoorBlock() {
super(DOOR_PROPS, SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN);
}

View file

@ -1,7 +1,5 @@
package dev.zontreck.otemod.blocks;
import javax.annotation.Nullable;
import dev.zontreck.otemod.blocks.entity.ItemScrubberBlockEntity;
import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.networking.ModMessages;
@ -21,6 +19,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks;
import javax.annotation.Nullable;
public class ItemScrubberBlock extends BaseEntityBlock
{
@ -59,7 +59,7 @@ public class ItemScrubberBlock extends BaseEntityBlock
if(be instanceof ItemScrubberBlockEntity)
{
ItemScrubberBlockEntity entity = (ItemScrubberBlockEntity)be;
NetworkHooks.openGui(((ServerPlayer)player), entity, pos);
NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);

View file

@ -1,7 +1,5 @@
package dev.zontreck.otemod.blocks;
import javax.annotation.Nullable;
import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity;
import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.networking.ModMessages;
@ -21,6 +19,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks;
import javax.annotation.Nullable;
public class MagicalScrubberBlock extends BaseEntityBlock
{
@ -59,7 +59,7 @@ public class MagicalScrubberBlock extends BaseEntityBlock
if(be instanceof MagicalScrubberBlockEntity)
{
MagicalScrubberBlockEntity entity = (MagicalScrubberBlockEntity)be;
NetworkHooks.openGui(((ServerPlayer)player), entity, pos);
NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
}else{

View file

@ -2,21 +2,15 @@ package dev.zontreck.otemod.blocks;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockBehaviour.StatePredicate;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
@ -34,54 +28,55 @@ public class ModBlocks {
public static final RegistryObject<Block> ETERNIUM_ORE_BLOCK = BLOCKS.register("eternium_ore_block", () -> new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(7F).explosionResistance(1200).destroyTime(6)));
public static final RegistryObject<Item> ETERNIUM_ORE_BLOCK_I = ITEMS.register("eternium_ore_block", () -> new BlockItem(ETERNIUM_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> ETERNIUM_ORE_BLOCK_I = ITEMS.register("eternium_ore_block", () -> new BlockItem(ETERNIUM_ORE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> VAULT_STEEL_ORE_BLOCK = BLOCKS.register("vault_steel_ore_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100)));
public static final RegistryObject<Item> VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("vault_steel_ore_block", ()->new BlockItem(VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Item> VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("vault_steel_ore_block", ()->new BlockItem(VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> NETHER_VAULT_STEEL_ORE_BLOCK = BLOCKS.register("nether_vault_steel_ore_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100)));
public static final RegistryObject<Item> NETHER_VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("nether_vault_steel_ore_block", ()->new BlockItem(NETHER_VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Item> NETHER_VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("nether_vault_steel_ore_block", ()->new BlockItem(NETHER_VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> ETERNIUM_BLOCK = BLOCKS.register("eternium_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100)));
public static final RegistryObject<Item> ETERNIUM_BLOCK_I = ITEMS.register("eternium_block", ()->new FoiledBlockItem(ETERNIUM_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Item> ETERNIUM_BLOCK_I = ITEMS.register("eternium_block", ()->new FoiledBlockItem(ETERNIUM_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> DEEPSLATE_ETERNIUM_ORE_BLOCK = BLOCKS.register("deepslate_eternium_ore_block", () -> new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(5f).explosionResistance(1200).destroyTime(7)));
public static final RegistryObject<Item> DEEPSLATE_ETERNIUM_ORE_BLOCK_I = ITEMS.register("deepslate_eternium_ore_block", () -> new BlockItem(DEEPSLATE_ETERNIUM_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> DEEPSLATE_ETERNIUM_ORE_BLOCK_I = ITEMS.register("deepslate_eternium_ore_block", () -> new BlockItem(DEEPSLATE_ETERNIUM_ORE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> AURORA_BLOCK = BLOCKS.register("aurora_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(9f).explosionResistance(100000f).destroyTime(10).sound(SoundType.NETHERITE_BLOCK)));
public static final RegistryObject<Item> AURORA_BLOCK_I = ITEMS.register("aurora_block", () -> new BlockItem(AURORA_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> AURORA_BLOCK_I = ITEMS.register("aurora_block", () -> new BlockItem(AURORA_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> AURORA_DOOR = BLOCKS.register("aurora_door", () -> new DoorBlock(BlockBehaviour.Properties.copy(Blocks.IRON_DOOR).requiresCorrectToolForDrops().strength(9f).explosionResistance(100000f).destroyTime(10).sound(SoundType.NETHERITE_BLOCK)));
public static final RegistryObject<Item> AURORA_DOOR_I = ITEMS.register("aurora_door", () -> new BlockItem(AURORA_DOOR.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Block> AURORA_DOOR = BLOCKS.register("aurora_door", AuroraDoorBlock::new);
public static final RegistryObject<Item> AURORA_DOOR_I = ITEMS.register("aurora_door", () -> new BlockItem(AURORA_DOOR.get(), new Item.Properties()));
public static final RegistryObject<Block> CLEAR_GLASS_BLOCK = BLOCKS.register("clear_glass_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.GLASS).strength(1f).destroyTime(6).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> CLEAR_GLASS_BLOCK_I = ITEMS.register("clear_glass_block", () -> new BlockItem(CLEAR_GLASS_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> CLEAR_GLASS_BLOCK_I = ITEMS.register("clear_glass_block", () -> new BlockItem(CLEAR_GLASS_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> ITEM_SCRUBBER = BLOCKS.register("item_scrubber", ()->new ItemScrubberBlock(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> ITEM_SCRUBBER_I = ITEMS.register("item_scrubber", ()->new BlockItem(ITEM_SCRUBBER.get(), new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE)));
public static final RegistryObject<Item> ITEM_SCRUBBER_I = ITEMS.register("item_scrubber", ()->new BlockItem(ITEM_SCRUBBER.get(), new Item.Properties()));
public static final RegistryObject<Block> MAGICAL_SCRUBBER = BLOCKS.register("magical_scrubber", ()->new MagicalScrubberBlock(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> MAGICAL_SCRUBBER_I = ITEMS.register("magical_scrubber", ()->new BlockItem(MAGICAL_SCRUBBER.get(), new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE)));
public static final RegistryObject<Item> MAGICAL_SCRUBBER_I = ITEMS.register("magical_scrubber", ()->new BlockItem(MAGICAL_SCRUBBER.get(), new Item.Properties()));
public static final RegistryObject<Block> STABLE_SINGULARITY = BLOCKS.register("stable_singularity", ()->new Block(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> STABLE_SINGULARITY_I = ITEMS.register("stable_singularity", ()->new BlockItem(STABLE_SINGULARITY.get(), new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE)));
public static final RegistryObject<Item> STABLE_SINGULARITY_I = ITEMS.register("stable_singularity", ()->new BlockItem(STABLE_SINGULARITY.get(), new Item.Properties()));

View file

@ -1,7 +1,5 @@
package dev.zontreck.otemod.blocks.entity;
import javax.annotation.Nullable;
import dev.zontreck.otemod.implementation.OutputItemStackHandler;
import dev.zontreck.otemod.implementation.energy.OTEEnergy;
import dev.zontreck.otemod.implementation.scrubber.ItemScrubberMenu;
@ -11,7 +9,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleContainer;
@ -25,13 +22,14 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import javax.annotation.Nullable;
public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
{
@ -113,22 +111,22 @@ public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
@Override
public Component getDisplayName() {
return new TranslatableComponent("block.otemod.item_scrubber");
return Component.translatable("block.otemod.item_scrubber");
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
{
if(cap == CapabilityEnergy.ENERGY)
if(cap == ForgeCapabilities.ENERGY)
{
return lazyEnergyHandler.cast();
}
if(side == Direction.DOWN && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
if(side == Direction.DOWN && cap == ForgeCapabilities.ITEM_HANDLER)
{
// Return the output slot only
return lazyOutputItems.cast();
}
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
if(cap == ForgeCapabilities.ITEM_HANDLER)
{
return lazyItemHandler.cast();
}

View file

@ -1,9 +1,5 @@
package dev.zontreck.otemod.blocks.entity;
import java.util.Iterator;
import java.util.Map;
import javax.annotation.Nullable;
import dev.zontreck.libzontreck.util.ItemUtils;
import dev.zontreck.otemod.implementation.OutputItemStackHandler;
import dev.zontreck.otemod.implementation.energy.OTEEnergy;
@ -14,7 +10,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.Containers;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleContainer;
@ -31,13 +26,16 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.Map;
public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvider
{
@ -119,22 +117,22 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
@Override
public Component getDisplayName() {
return new TranslatableComponent("block.otemod.magical_scrubber");
return Component.translatable("block.otemod.magical_scrubber");
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
{
if(cap == CapabilityEnergy.ENERGY)
if(cap == ForgeCapabilities.ENERGY)
{
return lazyEnergyHandler.cast();
}
if(side == Direction.DOWN && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
if(side == Direction.DOWN && cap == ForgeCapabilities.ITEM_HANDLER)
{
// Return the output slot only
return lazyOutputItems.cast();
}
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
if(cap == ForgeCapabilities.ITEM_HANDLER)
{
return lazyItemHandler.cast();
}

View file

@ -10,7 +10,7 @@ import net.minecraftforge.registries.RegistryObject;
public class ModEntities {
public static final DeferredRegister<BlockEntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, OTEMod.MOD_ID);
public static final DeferredRegister<BlockEntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, OTEMod.MOD_ID);
public static final RegistryObject <BlockEntityType <ItemScrubberBlockEntity>> ITEM_SCRUBBER = ENTITIES.register("item_scrubber", ()-> BlockEntityType.Builder.of(ItemScrubberBlockEntity::new, ModBlocks.ITEM_SCRUBBER.get()).build(null));

View file

@ -1,13 +1,13 @@
package dev.zontreck.otemod.blocks.types;
import java.util.EnumMap;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Plane;
import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import java.util.EnumMap;
/** Pane block with sensible culling */
public class AlternatePaneBlock extends IronBarsBlock {
public static final EnumMap<Direction,BooleanProperty> DIRECTIONS;

View file

@ -12,8 +12,8 @@ import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.configs.OTEServerConfig;
import dev.zontreck.otemod.configs.PlayerFlyCache;
import dev.zontreck.otemod.enchantments.ModEnchantments;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Abilities;
@ -55,7 +55,7 @@ public class ChatServerOverride {
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
ChatHelpers.broadcast(new TextComponent(ChatColor.doColors("!Dark_Gray![!Dark_Green!+!Dark_Gray!] !Bold!!Dark_Aqua!"+prof.nickname)), ev.level.getServer());
ChatHelpers.broadcast(ChatHelpers.macro("!Dark_Gray![!Dark_Green!+!Dark_Gray!] !Bold!!Dark_Aqua![0]",prof.nickname), ev.level.getServer());
}
@ -71,7 +71,8 @@ public class ChatServerOverride {
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
// Send the alert
ChatHelpers.broadcast(new TextComponent(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "-" + ChatColor.DARK_GRAY + "] "+ChatColor.BOLD + ChatColor.DARK_AQUA + px.nickname), px.player.server);
ChatHelpers.broadcast(ChatHelpers.macro("!Dark_Gray![!Dark_Red!-!Dark_Gray!] !Bold!!Dark_Aqua![0]", px.nickname), px.player.server);
px.flying=px.player.getAbilities().flying;
ev.setCanceled(true);
@ -83,7 +84,7 @@ public class ChatServerOverride {
if(ev.getEntity().level.isClientSide)return;
// Fix for fly ability not copying to new instance on death or other circumstances
Player old = ev.getOriginal();
Player n = ev.getPlayer();
Player n = ev.getEntity();
PlayerFlyCache c = PlayerFlyCache.cachePlayer((ServerPlayer)old);
c.Assert((ServerPlayer)n);
@ -112,7 +113,7 @@ public class ChatServerOverride {
prefixStr = ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + XD.prefix_color + XD.prefix + ChatColor.resetChat() + ChatColor.DARK_GRAY + "] ";
}
String msg = ev.getMessage();
String msg = ev.getRawText();
msg= ChatColor.doColors(msg);
String nameStr = ChatColor.resetChat() + "< "+ XD.name_color + XD.nickname + ChatColor.resetChat() + " >";
@ -121,7 +122,7 @@ public class ChatServerOverride {
hover=hover.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.MINECOIN_GOLD+"User Name: "+XD.username));
ev.setCanceled(true);
ChatHelpers.broadcast(new TextComponent(prefixStr+nameStr+message).setStyle(hover), ev.getPlayer().server);
ChatHelpers.broadcast(Component.literal(prefixStr + nameStr + message).setStyle(hover), ev.getPlayer().server);
}

View file

@ -2,14 +2,12 @@ package dev.zontreck.otemod.commands;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
public class FlyCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
@ -39,12 +37,12 @@ public class FlyCommand {
p.getAbilities().flying=false;
p.onUpdateAbilities();
ctx.sendSuccess(new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " Your ability to fly has been disabled"), false);
ctx.sendSuccess(Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " Your ability to fly has been disabled"), false);
}else {
p.getAbilities().mayfly=true;
p.onUpdateAbilities();
ctx.sendSuccess(new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " You can now fly"), false);
ctx.sendSuccess(Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " You can now fly"), false);
}
return 0;

View file

@ -1,8 +1,6 @@
package dev.zontreck.otemod.commands.items;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.HoverTip;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
@ -12,7 +10,6 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
@ -39,7 +36,7 @@ public class ShareItemInChatCommand {
ItemStack is = play.getItemInHand(InteractionHand.MAIN_HAND);
if(is.getItem() instanceof AirItem)
{
play.displayClientMessage(new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You cannot share air in the chat.")), false);
play.displayClientMessage(ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot share air in the chat."), false);
return 0;
}
@ -50,7 +47,7 @@ public class ShareItemInChatCommand {
return 1;
}
MutableComponent component = new TextComponent(OTEMod.OTEPrefix).append(is.getDisplayName()).append(new TextComponent(ChatColor.doColors(" !White!-!Dark_Purple! Hover here to see the item that "+prof.name_color+prof.nickname+"!Dark_Purple! shared")));
MutableComponent component = ChatHelpers.macro(OTEMod.OTEPrefix).append(is.getDisplayName()).append(ChatHelpers.macro(" !White!-!Dark_Purple! Hover here to see the item that "+prof.name_color+prof.nickname+"!Dark_Purple! shared"));
Style style = Style.EMPTY.withFont(Style.DEFAULT_FONT);
component = component.withStyle(style.withHoverEvent(HoverTip.getItem(is)));

View file

@ -1,17 +1,15 @@
package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.server.command.EnumArgument;
@ -54,7 +52,7 @@ public class ChatColorCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false);
return 0;
}

View file

@ -1,17 +1,15 @@
package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.server.command.EnumArgument;
@ -54,7 +52,7 @@ public class NameColorCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false);
return 0;
}

View file

@ -2,16 +2,14 @@ package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
@ -50,7 +48,7 @@ public class NickCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false);
return 0;
}

View file

@ -1,16 +1,15 @@
package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.server.command.EnumArgument;
@ -54,7 +53,7 @@ public class PrefixColorCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false);
return 0;
}

View file

@ -2,16 +2,14 @@ package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
@ -50,7 +48,7 @@ public class PrefixCommand {
p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false);
source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false);
return 0;
}

View file

@ -1,15 +1,13 @@
package dev.zontreck.otemod.commands.vaults;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.vault.NoMoreVaultException;
import dev.zontreck.otemod.implementation.vault.VaultContainer;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleMenuProvider;
import net.minecraftforge.network.NetworkHooks;
@ -35,11 +33,11 @@ public class TrashCommand {
try {
container = new VaultContainer(play, -1);
} catch (NoMoreVaultException e) {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You cannot open anymore vaults. Craft a new vault!")), play.server);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot open anymore vaults. Craft a new vault!"), play.server);
return 0;
}
NetworkHooks.openGui(play, new SimpleMenuProvider(container.serverMenu, new TextComponent("Trash")));
NetworkHooks.openScreen(play, new SimpleMenuProvider(container.serverMenu, Component.literal("Trash")));
// Add to the master vault registry
if(VaultContainer.VAULT_REGISTRY.containsKey(play.getUUID()))VaultContainer.VAULT_REGISTRY.remove(play.getUUID());

View file

@ -2,15 +2,13 @@ package dev.zontreck.otemod.commands.vaults;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.vault.NoMoreVaultException;
import dev.zontreck.otemod.implementation.vault.VaultContainer;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleMenuProvider;
import net.minecraftforge.network.NetworkHooks;
@ -34,7 +32,7 @@ public class VaultCommand {
ServerPlayer play = (ServerPlayer)source.getEntity();
if(i <0)
{
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range")), source.getServer());
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range"), source.getServer());
return 0;
}
doOpen(play, i);
@ -49,11 +47,11 @@ public class VaultCommand {
try {
container = new VaultContainer(p, i);
} catch (NoMoreVaultException e) {
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You cannot open anymore vaults. Craft a new vault!")), p.server);
ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot open anymore vaults. Craft a new vault!"), p.server);
return;
}
NetworkHooks.openGui(p, new SimpleMenuProvider(container.serverMenu, new TextComponent("Vault "+i)));
NetworkHooks.openScreen(p, new SimpleMenuProvider(container.serverMenu, Component.literal("Vault " + i)));
// Add to the master vault registry
if(VaultContainer.VAULT_REGISTRY.containsKey(p.getUUID()))VaultContainer.VAULT_REGISTRY.remove(p.getUUID());

View file

@ -1,16 +1,7 @@
package dev.zontreck.otemod.commands.zschem;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.libzontreck.vectors.WorldPosition;
@ -26,12 +17,18 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.fml.loading.FMLConfig;
import net.minecraftforge.fml.loading.FMLPaths;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class LoadSchem {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
@ -115,17 +112,17 @@ public class LoadSchem {
MemoryHolder.setBlocks(play, blocks);
}else {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!No such ZSchem exists!")), source.getServer());
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix + " !Dark_Red!No such ZSchem exists!"), source.getServer());
return 0;
}
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem loaded from disk!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!ZSchem loaded from disk!"), OTEMod.THE_SERVER);
return 0;
}
}
}
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors("!Dark_Red! You must set the first position")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro("!Dark_Red! You must set the first position"), OTEMod.THE_SERVER);
return 0;
}
@ -133,10 +130,10 @@ public class LoadSchem {
private static int loadSchematicUsage(CommandSourceStack source)
{
String usage = OTEMod.OTEPrefix;
usage += ChatColor.doColors("!gold! /loadzschem [string:name]");
usage += "!gold! /loadzschem [string:name]";
ServerPlayer play=(ServerPlayer)source.getEntity();
if(play==null)return 1;
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(usage), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(usage), OTEMod.THE_SERVER);
return 0;
}
}

View file

@ -1,26 +1,21 @@
package dev.zontreck.otemod.commands.zschem;
import java.util.Collections;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import dev.zontreck.otemod.zschem.StoredBlock;
import dev.zontreck.otemod.zschem.WorldProp;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import java.util.Collections;
import java.util.List;
// This command will place the loaded schematic in world. The schematic will originate from position 1. The positions are relative and are added onto position 1.
public class Place {
@ -46,7 +41,7 @@ public class Place {
if(!MemoryHolder.hasPlayerCached(play)){
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first load the zschem!"), OTEMod.THE_SERVER);
return 1;
}
@ -67,13 +62,13 @@ public class Place {
}else {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first load the zschem!"), OTEMod.THE_SERVER);
return 1;
}
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!Enqueued!"), OTEMod.THE_SERVER);
return 0;
}

View file

@ -1,29 +1,24 @@
package dev.zontreck.otemod.commands.zschem;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import dev.zontreck.otemod.zschem.StoredBlock;
import dev.zontreck.otemod.zschem.WorldProp;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.block.Blocks;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import dev.zontreck.otemod.zschem.StoredBlock;
import dev.zontreck.otemod.zschem.WorldProp;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.block.Blocks;
// This command will place the loaded schematic in world. The schematic will originate from position 1. The positions are relative and are added onto position 1.
public class PlaceAsAir {
@ -49,7 +44,7 @@ public class PlaceAsAir {
if(!MemoryHolder.hasPlayerCached(play)){
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first set the positions!"), OTEMod.THE_SERVER);
return 1;
}
@ -74,13 +69,13 @@ public class PlaceAsAir {
}else {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first set the positions!"), OTEMod.THE_SERVER);
return 1;
}
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!Enqueued!"), OTEMod.THE_SERVER);
return 0;
}

View file

@ -1,19 +1,10 @@
package dev.zontreck.otemod.commands.zschem;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
@ -25,12 +16,16 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.fml.loading.FMLConfig;
import net.minecraftforge.fml.loading.FMLPaths;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class SaveSchem {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
@ -108,12 +103,12 @@ public class SaveSchem {
} catch (IOException e) {
e.printStackTrace();
}
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem saved to disk!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!ZSchem saved to disk!"), OTEMod.THE_SERVER);
return 0;
}
}
}
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors("!Dark_Red! You must first set the positions")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro("!Dark_Red! You must first set the positions"), OTEMod.THE_SERVER);
return 0;
}
@ -121,10 +116,10 @@ public class SaveSchem {
private static int saveSchematicUsage(CommandSourceStack source)
{
String usage = OTEMod.OTEPrefix;
usage += ChatColor.doColors("!gold! /savezschem [string:name]");
usage += "!gold! /savezschem [string:name]";
ServerPlayer play=(ServerPlayer)source.getEntity();
if(play==null)return 1;
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(usage), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(usage), OTEMod.THE_SERVER);
return 0;
}
}

View file

@ -1,19 +1,16 @@
package dev.zontreck.otemod.commands.zschem;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
public class SetPos1 {
@ -40,7 +37,7 @@ public class SetPos1 {
MemoryHolder.setPos1(play, new Vector3(source.getPosition()));
MemoryHolder.setLevel(play, source.getLevel());
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 1 set!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 1 set!")), OTEMod.THE_SERVER);
return 0;
}

View file

@ -1,19 +1,16 @@
package dev.zontreck.otemod.commands.zschem;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
public class SetPos2 {
@ -40,7 +37,7 @@ public class SetPos2 {
MemoryHolder.setPos2(play, new Vector3(source.getPosition()));
MemoryHolder.setLevel(play, source.getLevel());
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 2 set!")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 2 set!")), OTEMod.THE_SERVER);
return 0;
}

View file

@ -1,13 +1,9 @@
package dev.zontreck.otemod.entities;
import java.util.function.Supplier;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.entities.monsters.PossumEntity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
@ -15,7 +11,7 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModEntityTypes {
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, OTEMod.MOD_ID);
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, OTEMod.MOD_ID);
public static final RegistryObject<EntityType<? extends PossumEntity>> POSSUM = ENTITIES.register("possum", ()-> EntityType.Builder.of(PossumEntity::new, MobCategory.CREATURE).sized(1.5f, 0.5f).build(new ResourceLocation(OTEMod.MOD_ID, "possum").toString()));

View file

@ -15,10 +15,10 @@ public class ClientEvents {
{
@SubscribeEvent
public static void onKeyInput(InputEvent.ClickInputEvent event)
public static void onKeyInput(InputEvent.Key event)
{
//OTEMod.LOGGER.info("KEY PRESS: "+event.getKey());
if(KeyBindings.OPEN_VAULT.consumeClick())
if(KeyBindings.OPEN_VAULT.matches(event.getKey(), event.getScanCode()))
{
ModMessages.sendToServer(new OpenVaultC2SPacket(0, false, 0));
}

View file

@ -1,13 +1,7 @@
package dev.zontreck.otemod.events;
import java.time.Instant;
import java.util.Date;
import java.util.Random;
import org.antlr.v4.parse.ANTLRParser.id_return;
import dev.zontreck.libzontreck.items.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry;
import dev.zontreck.libzontreck.lore.LoreContainer;
import dev.zontreck.libzontreck.lore.LoreEntry;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
@ -19,12 +13,8 @@ import dev.zontreck.otemod.enchantments.MobEggEnchantment;
import dev.zontreck.otemod.enchantments.ModEnchantments;
import dev.zontreck.otemod.implementation.DeathMessages;
import dev.zontreck.otemod.items.tags.ItemStatType;
import dev.zontreck.otemod.ore.OreGenerator;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
@ -35,18 +25,16 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import java.time.Instant;
import java.util.Date;
import java.util.Random;
@Mod.EventBusSubscriber(modid=OTEMod.MOD_ID)
public class EventHandler {
@SubscribeEvent(priority = EventPriority.HIGH)
public static void addOresToBiomes(final BiomeLoadingEvent ev){
//ShapedAionResources.LOGGER.info("Biome loading event called. Registering aion ores");
//OTEMod.LOGGER.info("/!\\ Registering OTEMod ores /!\\");
OreGenerator.generateOres(ev);
}
@SubscribeEvent
public static void playerDied(LivingDeathEvent event)
@ -83,7 +71,6 @@ public class EventHandler {
double num = rng.nextDouble(0,100000);
if(num <= base_chance)
{
ItemStack head = HeadUtilities.get(profile.username).setHoverName(ChatHelpers.macro(profile.nickname+"'s Head"));
LoreContainer lore = new LoreContainer(head);
LoreEntry entry = new LoreEntry();
@ -105,7 +92,7 @@ public class EventHandler {
}
try {
ChatHelpers.broadcast(new TextComponent(DeathMessages.getRandomDeathMessage(Profile.get_profile_of(event.getEntity().getStringUUID()), event.getSource())), event.getEntity().level.getServer());
ChatHelpers.broadcast(Component.literal(DeathMessages.getRandomDeathMessage(Profile.get_profile_of(event.getEntity().getStringUUID()), event.getSource())), event.getEntity().level.getServer());
} catch (UserProfileNotYetExistsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -116,12 +103,12 @@ public class EventHandler {
public void onEntityKilled(LivingDropsEvent ev){
if(ev.getEntity().level.isClientSide)return;
Entity killedentity = ev.getEntityLiving();
Entity killedentity = ev.getEntity();
Entity ent = ev.getSource().getEntity();
if(ent instanceof Player)
{
ServerPlayer play = (ServerPlayer)ent;
LivingEntity killed = ev.getEntityLiving();
LivingEntity killed = ev.getEntity();
ItemStack stack = play.getMainHandItem();
int levelOfEgging = ItemUtils.getEnchantmentLevel(ModEnchantments.MOB_EGGING_ENCHANTMENT.get(),stack);

View file

@ -1,7 +1,7 @@
package dev.zontreck.otemod.events;
import dev.zontreck.libzontreck.items.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry;
import dev.zontreck.libzontreck.lore.LoreContainer;
import dev.zontreck.libzontreck.lore.LoreEntry;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.items.tags.ItemStatTag;
@ -13,23 +13,17 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.animal.Sheep;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.AxeItem;
import net.minecraft.world.item.HoeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ShearsItem;
import net.minecraft.world.item.ShovelItem;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.level.BlockEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.registries.ForgeRegistries;
@EventBusSubscriber(modid=OTEMod.MOD_ID, bus=Mod.EventBusSubscriber.Bus.FORGE)
public class LoreHandlers {
@ -37,11 +31,11 @@ public class LoreHandlers {
@SubscribeEvent
public void onBlockMined(BlockEvent.BreakEvent ev)
{
if(ev.getWorld().isClientSide())return;
if(ev.getLevel().isClientSide())return;
ServerPlayer sp = (ServerPlayer)ev.getPlayer();
ItemStack itemUsed = sp.getItemInHand(InteractionHand.MAIN_HAND);
ResourceLocation loc = itemUsed.getItem().getRegistryName();
ResourceLocation loc = ForgeRegistries.ITEMS.getKey(itemUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
if(itemModName.contains("pickaxe"))
{
@ -62,14 +56,14 @@ public class LoreHandlers {
public void onBlock(BlockEvent.BlockToolModificationEvent ev)
{
if(ev.getWorld().isClientSide())return;
if(ev.getLevel().isClientSide())return;
// Check the block right clicked, and the item in hand
ServerPlayer sp = (ServerPlayer)ev.getPlayer();
ItemStack itemUsed = sp.getMainHandItem();
BlockState bs = ev.getState();
ResourceLocation loc = itemUsed.getItem().getRegistryName();
ResourceLocation loc = ForgeRegistries.ITEMS.getKey(itemUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
if(itemModName.contains("hoe"))
@ -94,18 +88,18 @@ public class LoreHandlers {
public void onShears(PlayerInteractEvent.EntityInteract ev)
{
if(ev.getWorld().isClientSide)return;
if(ev.getLevel().isClientSide)return;
if(ev.getCancellationResult() == InteractionResult.PASS)
{
// Check the entity right clicked, and the item in hand
// Check the entity right-clicked, and the item in hand
OTEMod.LOGGER.info("Success");
ServerPlayer sp = (ServerPlayer)ev.getEntity();
ItemStack itemUsed = sp.getMainHandItem();
Entity target = ev.getTarget();
ResourceLocation loc = itemUsed.getItem().getRegistryName();
ResourceLocation loc = ForgeRegistries.ITEMS.getKey(itemUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
ResourceLocation locEnt = itemUsed.getItem().getRegistryName();
ResourceLocation locEnt = ForgeRegistries.ENTITY_TYPES.getKey(ev.getTarget().getType());
String entityModName = ChatHelpers.macroize("[0]:[1]", locEnt.getNamespace(), locEnt.getPath());
if(itemModName.contains("shears"))
{
@ -137,7 +131,7 @@ public class LoreHandlers {
if(sp==null)return;
ItemStack weaponUsed = sp.getItemInHand(InteractionHand.MAIN_HAND);
ResourceLocation loc = weaponUsed.getItem().getRegistryName();
ResourceLocation loc = ForgeRegistries.ITEMS.getKey(weaponUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
if(itemModName.contains("sword"))
{

View file

@ -44,7 +44,7 @@ public class DeathMessages {
{
if(sourceName.equals(""))
{
sourceName = source.getEntity().getName().getContents();
sourceName = source.getEntity().getName().getString();
}
} else sourceName = "an imaginary zombie!";

View file

@ -1,14 +1,12 @@
package dev.zontreck.otemod.implementation.energy.screenrenderer;
import java.util.List;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.energy.IEnergyStorage;
import java.util.List;
/*
* BluSunrize
* Copyright (c) 2021
@ -33,7 +31,7 @@ public class EnergyInfoArea extends InfoArea {
}
public List<Component> getTooltips() {
return List.of(new TextComponent(energy.getEnergyStored()+"/"+energy.getMaxEnergyStored()+" FE"));
return List.of(Component.literal(energy.getEnergyStored()+"/"+energy.getMaxEnergyStored()+" FE"));
}
@Override

View file

@ -15,7 +15,7 @@ import net.minecraftforge.registries.RegistryObject;
public final class ModMenuTypes
{
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, OTEMod.MOD_ID);
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OTEMod.MOD_ID);
public static final RegistryObject <MenuType <VaultMenu>> VAULT = CONTAINERS.register("vault", ()-> new MenuType<>(VaultMenu::new));

View file

@ -7,15 +7,11 @@ import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.inventory.SimpleContainerData;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.inventory.*;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.items.SlotItemHandler;
public class ItemScrubberMenu extends AbstractContainerMenu
@ -40,10 +36,10 @@ public class ItemScrubberMenu extends AbstractContainerMenu
addPlayerInventory(inv);
addPlayerHotbar(inv);
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).ifPresent(handler->{
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 16, 41));
});
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN).ifPresent(handler->{
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 177, 41));
});

View file

@ -7,15 +7,11 @@ import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.inventory.SimpleContainerData;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.inventory.*;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.items.SlotItemHandler;
public class MagicalScrubberMenu extends AbstractContainerMenu
@ -40,10 +36,10 @@ public class MagicalScrubberMenu extends AbstractContainerMenu
addPlayerInventory(inv);
addPlayerHotbar(inv);
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).ifPresent(handler->{
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 16, 41));
});
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN).ifPresent(handler->{
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 177, 41));
});

View file

@ -1,12 +1,12 @@
package dev.zontreck.otemod.implementation.vault;
import java.io.File;
import java.io.IOException;
import dev.zontreck.libzontreck.profiles.Profile;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import java.io.File;
import java.io.IOException;
public class Vault {
public int vaultNum;
public File file_location;

View file

@ -1,38 +1,26 @@
package dev.zontreck.otemod.implementation.vault;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.implementation.events.VaultModifiedEvent;
import dev.zontreck.otemod.implementation.vault.VaultProvider.VaultAccessStrategy;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.MenuConstructor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.items.ItemStackHandler;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class VaultContainer
{
public static Map<UUID, VaultContainer> VAULT_REGISTRY = new HashMap<>();
@ -88,7 +76,7 @@ public class VaultContainer
if(VAULT_NUMBER == -1)return; // We have no need to save the trash
boolean isEmpty=true;
CompoundTag saved = myInventory.serializeNBT();
ChatHelpers.broadcastToAbove(owner, new TextComponent(ChatColor.BOLD+ChatColor.DARK_GREEN+"Saving the vault's contents..."), server);
ChatHelpers.broadcastToAbove(owner, Component.literal(ChatColor.BOLD+ChatColor.DARK_GREEN+"Saving the vault's contents..."), server);
Profile profile=null;
try {

View file

@ -15,7 +15,6 @@ import net.minecraft.client.gui.font.TextFieldHelper;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Inventory;
@ -70,16 +69,17 @@ public class VaultScreen extends AbstractContainerScreen <VaultMenu>
super.init();
// This is where custom controls would be added!
this.addWidget(new Button(this.leftPos+7,this.topPos+84,16,16,new TextComponent(""), (button)->{
this.addWidget(Button.builder(Component.literal(""), (BTN)->{
thePlayer.closeContainer();
ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, -1));
}).size(16,16).pos(this.leftPos+7, this.topPos+86).build());
ModMessages.sendToServer(new OpenVaultC2SPacket(0,true,-1));
} ));
this.addWidget(new Button(this.leftPos+187,this.topPos+84,16,16,new TextComponent(""), (button)->{
this.addWidget(Button.builder(Component.literal(""), (BTN)->{
thePlayer.closeContainer();
ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, 1));
} ));
}).size(16,16).pos(this.leftPos+187, this.topPos+84).build());
}
@Override

View file

@ -3,6 +3,8 @@ package dev.zontreck.otemod.integrations;
import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.multiplayer.ClientRegistryLayer;
import net.minecraft.core.registries.Registries;
import net.minecraftforge.client.ClientRegistry;
public class KeyBindings {
@ -13,6 +15,7 @@ public class KeyBindings {
private static KeyMapping registerKeyMapping(String name, int keycode, String category){
final KeyMapping key = new KeyMapping(name, keycode, category);
ClientRegistry.registerKeyBinding(key);
return key;
}

View file

@ -4,8 +4,7 @@ import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
@ -36,6 +35,6 @@ public class LuckPermsHelper {
}
public static void sendNoPermissionsMessage(ServerPlayer play, String perm, String group) {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!You do not have permission to use that command. You need permission !Gold!"+perm+" !White! or !Gold!"+group)), play.server);
ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(Messages.OTE_PREFIX+" !Dark_Red!You do not have permission to use that command. You need permission !Gold!"+perm+" !White! or !Gold!"+group), play.server);
}
}

View file

@ -15,47 +15,47 @@ import net.minecraftforge.registries.RegistryObject;
public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, OTEMod.MOD_ID);
public static final RegistryObject<Item> ETERNIUM_FRAGMENT = ITEMS.register("eternium_fragment", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> ETERNIUM_FRAGMENT = ITEMS.register("eternium_fragment", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> IHAN_CRYSTAL = ITEMS.register("ihan_crystal", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> IHAN_CRYSTAL = ITEMS.register("ihan_crystal", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> AURORA_COMPOUND = ITEMS.register("aurora_compound", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> AURORA_COMPOUND = ITEMS.register("aurora_compound", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> ETERNIUM_RAW_ORE = ITEMS.register("eternium_ore", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> ETERNIUM_RAW_ORE = ITEMS.register("eternium_ore", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> RAW_COBALT = ITEMS.register("raw_cobalt", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> COBALT_NUGGET = ITEMS.register("cobalt_nugget", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> COBALT_INGOT = ITEMS.register("cobalt_ingot", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> ETERNIUM_INGOT = ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Item> RAW_COBALT = ITEMS.register("raw_cobalt", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> COBALT_NUGGET = ITEMS.register("cobalt_nugget", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> COBALT_INGOT = ITEMS.register("cobalt_ingot", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> ETERNIUM_INGOT = ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties()));
public static final RegistryObject<Item> MELTED_NETHER_STAR = ITEMS.register("melted_nether_star", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> SINGULARITY = ITEMS.register("singularity", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(1)));
public static final RegistryObject<Item> ETERNIUM_ROD = ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> SCRUBBER_FRAME_PIECE = ITEMS.register("scrubber_frame_piece", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> SCRUBBER_FRAME = ITEMS.register("scrubber_frame", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> MELTED_NETHER_STAR = ITEMS.register("melted_nether_star", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> SINGULARITY = ITEMS.register("singularity", () -> new Item(new Item.Properties().stacksTo(1)));
public static final RegistryObject<Item> ETERNIUM_ROD = ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> SCRUBBER_FRAME_PIECE = ITEMS.register("scrubber_frame_piece", () -> new Item(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> SCRUBBER_FRAME = ITEMS.register("scrubber_frame", () -> new Item(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULTSTEEL_INGOT = ITEMS.register("vault_steel_ingot", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_BL = ITEMS.register("vault_fragment_lower_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_LC = ITEMS.register("vault_fragment_lower", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_BR = ITEMS.register("vault_fragment_lower_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_L = ITEMS.register("vault_fragment_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_R = ITEMS.register("vault_fragment_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_UR = ITEMS.register("vault_fragment_upper_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_UL = ITEMS.register("vault_fragment_upper_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_U = ITEMS.register("vault_fragment_upper", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_C = ITEMS.register("vault_fragment_center", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULTSTEEL_INGOT = ITEMS.register("vault_steel_ingot", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_BL = ITEMS.register("vault_fragment_lower_left", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_LC = ITEMS.register("vault_fragment_lower", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_BR = ITEMS.register("vault_fragment_lower_right", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_L = ITEMS.register("vault_fragment_left", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_R = ITEMS.register("vault_fragment_right", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_UR = ITEMS.register("vault_fragment_upper_right", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_UL = ITEMS.register("vault_fragment_upper_left", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_U = ITEMS.register("vault_fragment_upper", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_C = ITEMS.register("vault_fragment_center", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT = ITEMS.register("vault", () -> new VaultItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT = ITEMS.register("vault", () -> new VaultItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> VAULT_RAW_ORE = ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_RAW_ORE = ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties()));

View file

@ -2,8 +2,6 @@ package dev.zontreck.otemod.items;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.items.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry;
import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
@ -12,7 +10,6 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.configs.OTEServerConfig;
import dev.zontreck.otemod.events.LoreHandlers;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
@ -57,12 +54,12 @@ public class VaultItem extends Item
{
if(p.available_vaults >= OTEServerConfig.MAX_VAULTS.get())
{
ChatHelpers.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You cannot activate anymore vaults due to the maximum set by the server admin")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(pPlayer.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot activate anymore vaults due to the maximum set by the server admin"), OTEMod.THE_SERVER);
return InteractionResultHolder.pass(is);
} else {
p.available_vaults++;
p.commit();
ChatHelpers.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(pPlayer.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults"), OTEMod.THE_SERVER);
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
return InteractionResultHolder.consume(is);
@ -70,7 +67,7 @@ public class VaultItem extends Item
}else {
p.available_vaults++;
p.commit();
ChatHelpers.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER);
ChatHelpers.broadcastTo(pPlayer.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults"), OTEMod.THE_SERVER);
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
return InteractionResultHolder.consume(is);

View file

@ -32,13 +32,13 @@ public class ModMessages {
net.messageBuilder(OpenVaultC2SPacket.class, id(), NetworkDirection.PLAY_TO_SERVER)
.decoder(OpenVaultC2SPacket::new)
.encoder(OpenVaultC2SPacket::toBytes)
.consumer(OpenVaultC2SPacket::handle)
.consumerMainThread(OpenVaultC2SPacket::handle)
.add();
net.messageBuilder(EnergySyncS2CPacket.class, id(), NetworkDirection.PLAY_TO_CLIENT)
.decoder(EnergySyncS2CPacket::new)
.encoder(EnergySyncS2CPacket::toBytes)
.consumer(EnergySyncS2CPacket::handle)
.consumerMainThread(EnergySyncS2CPacket::handle)
.add();
}

View file

@ -1,25 +1,8 @@
package dev.zontreck.otemod.ore;
import java.util.ArrayList;
import java.util.List;
import dev.zontreck.otemod.blocks.ModBlocks;
import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.OreFeature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.event.world.BiomeLoadingEvent;
public class OreGenerator {
/*
public static final List<ConfiguredFeature<OreConfiguration, OreFeature>> OVERWORLD_ORES = new ArrayList();
@ -61,5 +44,5 @@ public class OreGenerator {
base.add(VAULT_STEEL_ORE_PLACED);
base.add(NETHER_VAULTSTEEL_ORE_PLACED);
//base.add(DEEPSLATE_AION_ORE_PLACED);
}
}*/
}

View file

@ -6,29 +6,30 @@ import java.util.Map;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.libzontreck.vectors.WorldPosition;
import dev.zontreck.otemod.configs.OTEServerConfig;
import net.minecraft.client.telemetry.events.WorldLoadEvent;
import net.minecraft.server.level.ServerLevel;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.level.ExplosionEvent;
import net.minecraftforge.event.level.LevelEvent;
import net.minecraftforge.event.server.ServerStoppingEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class EventHandler {
@SubscribeEvent
public void onDetonate(ExplosionEvent.Detonate ev)
public void onDetonate(ExplosionEvent ev)
{
if(ev.getWorld().isClientSide)return;
if(ev.getLevel().isClientSide)return;
//Entity explodes = ev.getExplosion().getSourceMob();
// Register blocks to be healed
WorldPosition wpos = new WorldPosition(new Vector3(ev.getExplosion().getPosition()), (ServerLevel) ev.getWorld());
WorldPosition wpos = new WorldPosition(new Vector3(ev.getExplosion().getPosition()), (ServerLevel) ev.getLevel());
if(OTEServerConfig.EXCLUDE_DIMS.get().contains(wpos.Dimension)){
// Dimension is on the exclusion list. Do not process.
return;
}
WorldProp wp = WorldProp.acquire((ServerLevel)ev.getWorld());
WorldProp wp = WorldProp.acquire((ServerLevel)ev.getLevel());
if(wp!=null){
wp.onDetonate(ev);
@ -44,21 +45,21 @@ public class EventHandler {
}
@SubscribeEvent
public void onLoadLevel(WorldEvent.Load ev)
public void onLoadLevel(LevelEvent.Load ev)
{
if(!ev.getWorld().isClientSide() && ev.getWorld() instanceof ServerLevel)
if(!ev.getLevel().isClientSide() && ev.getLevel() instanceof ServerLevel)
{
healers.put((ServerLevel)ev.getWorld(), WorldProp.acquire((ServerLevel)ev.getWorld()));
healers.put((ServerLevel)ev.getLevel(), WorldProp.acquire((ServerLevel)ev.getLevel()));
}
}
@SubscribeEvent
public void onUnload(WorldEvent.Unload ev)
public void onUnload(LevelEvent.Unload ev)
{
if(!ev.getWorld().isClientSide())
if(!ev.getLevel().isClientSide())
{
healers.remove(ev.getWorld());
healers.remove(ev.getLevel());
}
}
@ -69,16 +70,16 @@ public class EventHandler {
}
@SubscribeEvent
public void onSaving(WorldEvent.Save ev)
public void onSaving(LevelEvent.Save ev)
{
WorldProp.SaveAll();
}
@SubscribeEvent
public void onLevelTick(TickEvent.WorldTickEvent ev)
public void onLevelTick(TickEvent.LevelTickEvent ev)
{
if(!ev.world.isClientSide){
WorldProp wp = WorldProp.acquire((ServerLevel)ev.world);
if(!ev.level.isClientSide){
WorldProp wp = WorldProp.acquire((ServerLevel)ev.level);
if(wp!=null){
wp.onTick();
}

View file

@ -13,7 +13,6 @@ import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Player;
@ -85,7 +84,7 @@ public class MemoryHolder {
if(c.isExpired()){
imeuc.remove();
ChatHelpers.broadcastTo(entry.getKey(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!ZSchem Session expired")), c.lvl.getServer());
ChatHelpers.broadcastTo(entry.getKey(), ChatHelpers.macro(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!ZSchem Session expired")), c.lvl.getServer());
}
}
}finally{

View file

@ -4,12 +4,19 @@ import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.libzontreck.vectors.WorldPosition;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.registries.RegistryManager;
public class StoredBlock
{
@ -143,8 +150,10 @@ public class StoredBlock
e.printStackTrace();
}
HolderGetter<Block> hg = position.getActualDimension().holderLookup(Registries.BLOCK);
state = NbtUtils.readBlockState(tag.getCompound("state"));
state = NbtUtils.readBlockState(hg, tag.getCompound("state"));
final CompoundTag tmp = tag.getCompound("entity");
blockEntity = tmp.isEmpty() ? null : tmp;

View file

@ -15,7 +15,7 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.event.level.ExplosionEvent;
public class WorldProp implements Supplier<Object>
{
@ -32,12 +32,12 @@ public class WorldProp implements Supplier<Object>
task.tick();
}
public void onDetonate(ExplosionEvent.Detonate ev)
public void onDetonate(ExplosionEvent ev)
{
Level w = ev.getWorld();
Level w = ev.getLevel();
//int maxTicks = 0;
for(BlockPos p : ev.getAffectedBlocks())
for(BlockPos p : ev.getExplosion().getToBlow())
{
BlockState bsExplode = w.getBlockState(p);
if(!isValid(bsExplode))continue;

View file

@ -1,7 +1,7 @@
{
"type": "minecraft:ore",
"config": {
"size": 8,
"size": 4,
"discard_chance_on_air_exposure": 0,
"targets": [
{

View file

@ -3,7 +3,7 @@
"placement": [
{
"type": "minecraft:count",
"count": 2
"count": 4
},
{
"type": "minecraft:in_square"
@ -16,7 +16,7 @@
"absolute": -63
},
"max_inclusive": {
"absolute": -59
"absolute": -50
}
}
}