Downgrade to 1.18.2
This commit is contained in:
parent
c7040f83ae
commit
19573bbd56
63 changed files with 424 additions and 311 deletions
|
@ -3,11 +3,11 @@
|
||||||
org.gradle.jvmargs=-Xmx8G
|
org.gradle.jvmargs=-Xmx8G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
my_version=1.3.7.2
|
my_version=1.3.7.3
|
||||||
|
|
||||||
mc_version=1.19.2
|
mc_version=1.18.2
|
||||||
forge_version=43.2.3
|
forge_version=40.2.1
|
||||||
libz_version=1.0.3.7
|
libz_version=1.0.4.10
|
||||||
parchment_version=2022.11.27
|
parchment_version=2022.11.06
|
||||||
jei_version=11.5.0.297
|
jei_version=10.2.1.1002
|
||||||
# luckperms_version=5.4
|
# luckperms_version=5.4
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -15,15 +15,15 @@ import com.mojang.serialization.Codec;
|
||||||
import net.minecraft.client.gui.screens.MenuScreens;
|
import net.minecraft.client.gui.screens.MenuScreens;
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.event.InputEvent;
|
import net.minecraftforge.client.event.InputEvent;
|
||||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.world.BiomeModifier;
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
|
@ -223,7 +223,7 @@ public class OTEMod
|
||||||
if(cont.has_expired())
|
if(cont.has_expired())
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
Component expire = Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE+"Teleport request has expired");
|
Component expire = new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE+" Teleport request has expired");
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, expire, OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(cont.FromPlayer, expire, OTEMod.THE_SERVER);
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, expire, OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(cont.ToPlayer, expire, OTEMod.THE_SERVER);
|
||||||
OTEMod.TeleportRegistry.remove(cont);
|
OTEMod.TeleportRegistry.remove(cont);
|
||||||
|
@ -254,8 +254,8 @@ public class OTEMod
|
||||||
|
|
||||||
if(OTEServerConfig.ITEM_DESPAWN_TIMER.get()<=0)return;
|
if(OTEServerConfig.ITEM_DESPAWN_TIMER.get()<=0)return;
|
||||||
|
|
||||||
|
ItemEntity ite = (ItemEntity)ev.getEntity();
|
||||||
if(ev.getEntity().getAge() != (1200 * 5)) {
|
if(ite.getAge() != (1200 * 5)) {
|
||||||
|
|
||||||
//OTEMod.LOGGER.info("Extra life has already been given to item : "+ev.getEntity().getName().getString());
|
//OTEMod.LOGGER.info("Extra life has already been given to item : "+ev.getEntity().getName().getString());
|
||||||
return; // We already gave it extra life, the default is 6000, or 5 minutes
|
return; // We already gave it extra life, the default is 6000, or 5 minutes
|
||||||
|
|
|
@ -11,19 +11,13 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.Rotation;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
|
|
||||||
|
@ -65,7 +59,7 @@ public class ItemScrubberBlock extends BaseEntityBlock
|
||||||
if(be instanceof ItemScrubberBlockEntity)
|
if(be instanceof ItemScrubberBlockEntity)
|
||||||
{
|
{
|
||||||
ItemScrubberBlockEntity entity = (ItemScrubberBlockEntity)be;
|
ItemScrubberBlockEntity entity = (ItemScrubberBlockEntity)be;
|
||||||
NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
|
NetworkHooks.openGui(((ServerPlayer)player), entity, pos);
|
||||||
|
|
||||||
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
|
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dev.zontreck.otemod.blocks;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import dev.zontreck.otemod.blocks.entity.ItemScrubberBlockEntity;
|
|
||||||
import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity;
|
import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity;
|
||||||
import dev.zontreck.otemod.blocks.entity.ModEntities;
|
import dev.zontreck.otemod.blocks.entity.ModEntities;
|
||||||
import dev.zontreck.otemod.networking.ModMessages;
|
import dev.zontreck.otemod.networking.ModMessages;
|
||||||
|
@ -12,19 +11,13 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.Rotation;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
|
|
||||||
|
@ -66,7 +59,7 @@ public class MagicalScrubberBlock extends BaseEntityBlock
|
||||||
if(be instanceof MagicalScrubberBlockEntity)
|
if(be instanceof MagicalScrubberBlockEntity)
|
||||||
{
|
{
|
||||||
MagicalScrubberBlockEntity entity = (MagicalScrubberBlockEntity)be;
|
MagicalScrubberBlockEntity entity = (MagicalScrubberBlockEntity)be;
|
||||||
NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
|
NetworkHooks.openGui(((ServerPlayer)player), entity, pos);
|
||||||
|
|
||||||
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
|
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.MenuProvider;
|
import net.minecraft.world.MenuProvider;
|
||||||
import net.minecraft.world.SimpleContainer;
|
import net.minecraft.world.SimpleContainer;
|
||||||
|
@ -24,9 +25,10 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
|
@ -111,22 +113,22 @@ public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getDisplayName() {
|
public Component getDisplayName() {
|
||||||
return Component.translatable("block.otemod.item_scrubber");
|
return new TranslatableComponent("block.otemod.item_scrubber");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
|
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
|
||||||
{
|
{
|
||||||
if(cap == ForgeCapabilities.ENERGY)
|
if(cap == CapabilityEnergy.ENERGY)
|
||||||
{
|
{
|
||||||
return lazyEnergyHandler.cast();
|
return lazyEnergyHandler.cast();
|
||||||
}
|
}
|
||||||
if(side == Direction.DOWN && cap == ForgeCapabilities.ITEM_HANDLER)
|
if(side == Direction.DOWN && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||||
{
|
{
|
||||||
// Return the output slot only
|
// Return the output slot only
|
||||||
return lazyOutputItems.cast();
|
return lazyOutputItems.cast();
|
||||||
}
|
}
|
||||||
if(cap == ForgeCapabilities.ITEM_HANDLER)
|
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||||
{
|
{
|
||||||
return lazyItemHandler.cast();
|
return lazyItemHandler.cast();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package dev.zontreck.otemod.blocks.entity;
|
package dev.zontreck.otemod.blocks.entity;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||||
import dev.zontreck.otemod.implementation.OutputItemStackHandler;
|
import dev.zontreck.otemod.implementation.OutputItemStackHandler;
|
||||||
import dev.zontreck.otemod.implementation.energy.OTEEnergy;
|
import dev.zontreck.otemod.implementation.energy.OTEEnergy;
|
||||||
import dev.zontreck.otemod.implementation.scrubber.MagicalScrubberMenu;
|
import dev.zontreck.otemod.implementation.scrubber.MagicalScrubberMenu;
|
||||||
|
@ -15,8 +13,8 @@ import dev.zontreck.otemod.networking.packets.EnergySyncS2CPacket;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.MenuProvider;
|
import net.minecraft.world.MenuProvider;
|
||||||
import net.minecraft.world.SimpleContainer;
|
import net.minecraft.world.SimpleContainer;
|
||||||
|
@ -25,20 +23,18 @@ import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.ContainerData;
|
import net.minecraft.world.inventory.ContainerData;
|
||||||
import net.minecraft.world.item.EnchantedBookItem;
|
import net.minecraft.world.item.EnchantedBookItem;
|
||||||
import net.minecraft.world.item.Item;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.Item.Properties;
|
|
||||||
import net.minecraft.world.item.enchantment.Enchantment;
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
import net.minecraft.world.item.enchantment.EnchantmentInstance;
|
import net.minecraft.world.item.enchantment.EnchantmentInstance;
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
|
@ -123,22 +119,22 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getDisplayName() {
|
public Component getDisplayName() {
|
||||||
return Component.translatable("block.otemod.magical_scrubber");
|
return new TranslatableComponent("block.otemod.magical_scrubber");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
|
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
|
||||||
{
|
{
|
||||||
if(cap == ForgeCapabilities.ENERGY)
|
if(cap == CapabilityEnergy.ENERGY)
|
||||||
{
|
{
|
||||||
return lazyEnergyHandler.cast();
|
return lazyEnergyHandler.cast();
|
||||||
}
|
}
|
||||||
if(side == Direction.DOWN && cap == ForgeCapabilities.ITEM_HANDLER)
|
if(side == Direction.DOWN && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||||
{
|
{
|
||||||
// Return the output slot only
|
// Return the output slot only
|
||||||
return lazyOutputItems.cast();
|
return lazyOutputItems.cast();
|
||||||
}
|
}
|
||||||
if(cap == ForgeCapabilities.ITEM_HANDLER)
|
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||||
{
|
{
|
||||||
return lazyItemHandler.cast();
|
return lazyItemHandler.cast();
|
||||||
}
|
}
|
||||||
|
@ -238,16 +234,18 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
|
||||||
ItemStack existing = entity.outputItems.getStackInSlot(0);
|
ItemStack existing = entity.outputItems.getStackInSlot(0);
|
||||||
ItemStack main = entity.itemsHandler.getStackInSlot(0);
|
ItemStack main = entity.itemsHandler.getStackInSlot(0);
|
||||||
|
|
||||||
Map<Enchantment, Integer> enchants = main.getAllEnchantments();
|
//Map<Enchantment, Integer> enchants = main.getAllEnchantments();
|
||||||
if(enchants.size()>0)
|
Map<Enchantment, Integer> enchantments = ItemUtils.getEnchantments(main);
|
||||||
|
|
||||||
|
if(enchantments.size()>0)
|
||||||
{
|
{
|
||||||
Iterator<Map.Entry<Enchantment,Integer>> iEntries = enchants.entrySet().iterator();
|
Iterator<Map.Entry<Enchantment,Integer>> iEntries = enchantments.entrySet().iterator();
|
||||||
Map.Entry<Enchantment,Integer> entry = iEntries.next();
|
Map.Entry<Enchantment,Integer> entry = iEntries.next();
|
||||||
|
|
||||||
EnchantmentInstance eInst = new EnchantmentInstance(entry.getKey(), entry.getValue());
|
EnchantmentInstance eInst = new EnchantmentInstance(entry.getKey(), entry.getValue());
|
||||||
existing = EnchantedBookItem.createForEnchantment(eInst);
|
existing = EnchantedBookItem.createForEnchantment(eInst);
|
||||||
|
|
||||||
main.getAllEnchantments().remove(entry.getKey());
|
enchantments.remove(entry.getKey());
|
||||||
//iEntries.remove();
|
//iEntries.remove();
|
||||||
main = makeOutputItem(main);
|
main = makeOutputItem(main);
|
||||||
while(iEntries.hasNext())
|
while(iEntries.hasNext())
|
||||||
|
@ -256,7 +254,7 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
|
||||||
main.enchant(entry.getKey(), entry.getValue());
|
main.enchant(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(main.getAllEnchantments().size()==0){
|
if(enchantments.size()==0){
|
||||||
entity.itemsHandler.extractItem(0, 1, false);
|
entity.itemsHandler.extractItem(0, 1, false);
|
||||||
}else entity.itemsHandler.setStackInSlot(0, main);
|
}else entity.itemsHandler.setStackInSlot(0, main);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
public class ModEntities {
|
public class ModEntities {
|
||||||
|
|
||||||
public static final DeferredRegister<BlockEntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, OTEMod.MOD_ID);
|
public static final DeferredRegister<BlockEntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, 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));
|
public static final RegistryObject <BlockEntityType <ItemScrubberBlockEntity>> ITEM_SCRUBBER = ENTITIES.register("item_scrubber", ()-> BlockEntityType.Builder.of(ItemScrubberBlockEntity::new, ModBlocks.ITEM_SCRUBBER.get()).build(null));
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||||
import dev.zontreck.libzontreck.chat.HoverTip;
|
import dev.zontreck.libzontreck.chat.HoverTip;
|
||||||
|
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||||
import dev.zontreck.otemod.configs.PlayerFlyCache;
|
import dev.zontreck.otemod.configs.PlayerFlyCache;
|
||||||
|
@ -15,14 +16,13 @@ import dev.zontreck.otemod.configs.Profile;
|
||||||
import dev.zontreck.otemod.enchantments.ModEnchantments;
|
import dev.zontreck.otemod.enchantments.ModEnchantments;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.player.Abilities;
|
import net.minecraft.world.entity.player.Abilities;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.event.ServerChatEvent;
|
import net.minecraftforge.event.ServerChatEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
@ -63,7 +63,8 @@ public class ChatServerOverride {
|
||||||
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
||||||
p.commit(); // Commits the profile to the server
|
p.commit(); // Commits the profile to the server
|
||||||
|
|
||||||
ev.getEntity().displayClientMessage(Component.literal(ChatColor.doColors( OTEMod.OTEPrefix +" !Dark_Green!First join! Your server profile has been created")), false);
|
|
||||||
|
play.displayClientMessage(new TextComponent(ChatColor.doColors( OTEMod.OTEPrefix +" !Dark_Green!First join! Your server profile has been created")), false);
|
||||||
}
|
}
|
||||||
}catch (SQLException e){
|
}catch (SQLException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -84,15 +85,14 @@ public class ChatServerOverride {
|
||||||
boolean mayFly = false;
|
boolean mayFly = false;
|
||||||
ItemStack feet = play.getItemBySlot(EquipmentSlot.FEET);
|
ItemStack feet = play.getItemBySlot(EquipmentSlot.FEET);
|
||||||
ItemStack legs = play.getItemBySlot(EquipmentSlot.LEGS);
|
ItemStack legs = play.getItemBySlot(EquipmentSlot.LEGS);
|
||||||
if(feet.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get())>0)mayFly=true;
|
if(ItemUtils.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get(), feet)>0)mayFly = true;
|
||||||
if(legs.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get())>0)mayFly=true;
|
|
||||||
|
|
||||||
playerAbilities.mayfly=mayFly;
|
playerAbilities.mayfly=mayFly;
|
||||||
play.onUpdateAbilities();
|
play.onUpdateAbilities();
|
||||||
|
|
||||||
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
|
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
|
||||||
|
|
||||||
ChatServerOverride.broadcast(Component.literal(ChatColor.doColors("!Dark_Gray![!Dark_Green!+!Dark_Gray!] !Bold!!Dark_Aqua!"+prof.nickname)), ev.getEntity().getServer());
|
ChatServerOverride.broadcast(new TextComponent(ChatColor.doColors("!Dark_Gray![!Dark_Green!+!Dark_Gray!] !Bold!!Dark_Aqua!"+prof.nickname)), ev.getEntity().getServer());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class ChatServerOverride {
|
||||||
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
|
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
|
||||||
|
|
||||||
// Send the alert
|
// Send the alert
|
||||||
ChatServerOverride.broadcast(Component.literal(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "-" + ChatColor.DARK_GRAY + "] "+ChatColor.BOLD + ChatColor.DARK_AQUA + px.nickname), ev.getEntity().getServer());
|
ChatServerOverride.broadcast(new TextComponent(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "-" + ChatColor.DARK_GRAY + "] "+ChatColor.BOLD + ChatColor.DARK_AQUA + px.nickname), ev.getEntity().getServer());
|
||||||
|
|
||||||
px.flying=sp.getAbilities().flying;
|
px.flying=sp.getAbilities().flying;
|
||||||
px.commit();
|
px.commit();
|
||||||
|
@ -123,7 +123,7 @@ public class ChatServerOverride {
|
||||||
if(ev.getEntity().level.isClientSide)return;
|
if(ev.getEntity().level.isClientSide)return;
|
||||||
// Fix for fly ability not copying to new instance on death or other circumstances
|
// Fix for fly ability not copying to new instance on death or other circumstances
|
||||||
Player old = ev.getOriginal();
|
Player old = ev.getOriginal();
|
||||||
Player n = ev.getEntity();
|
Player n = ev.getPlayer();
|
||||||
|
|
||||||
PlayerFlyCache c = PlayerFlyCache.cachePlayer((ServerPlayer)old);
|
PlayerFlyCache c = PlayerFlyCache.cachePlayer((ServerPlayer)old);
|
||||||
c.Assert((ServerPlayer)n);
|
c.Assert((ServerPlayer)n);
|
||||||
|
@ -146,7 +146,7 @@ public class ChatServerOverride {
|
||||||
prefixStr = ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + XD.prefix_color + XD.prefix + ChatColor.resetChat() + ChatColor.DARK_GRAY + "] ";
|
prefixStr = ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + XD.prefix_color + XD.prefix + ChatColor.resetChat() + ChatColor.DARK_GRAY + "] ";
|
||||||
}
|
}
|
||||||
|
|
||||||
String msg = ev.getMessage().getString();
|
String msg = ev.getMessage();
|
||||||
msg= ChatColor.doColors(msg);
|
msg= ChatColor.doColors(msg);
|
||||||
|
|
||||||
String nameStr = ChatColor.resetChat() + "< "+ XD.name_color + XD.nickname + ChatColor.resetChat() + " >";
|
String nameStr = ChatColor.resetChat() + "< "+ XD.name_color + XD.nickname + ChatColor.resetChat() + " >";
|
||||||
|
@ -155,7 +155,7 @@ public class ChatServerOverride {
|
||||||
hover=hover.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.MINECOIN_GOLD+"User Name: "+XD.username));
|
hover=hover.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.MINECOIN_GOLD+"User Name: "+XD.username));
|
||||||
ev.setCanceled(true);
|
ev.setCanceled(true);
|
||||||
|
|
||||||
ChatServerOverride.broadcast(Component.literal(prefixStr+nameStr+message).setStyle(hover), ev.getPlayer().server);
|
ChatServerOverride.broadcast(new TextComponent(prefixStr+nameStr+message).setStyle(hover), ev.getPlayer().server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public class ChatServerOverride {
|
||||||
{
|
{
|
||||||
play.displayClientMessage(message, true); // Send the message!
|
play.displayClientMessage(message, true); // Send the message!
|
||||||
}
|
}
|
||||||
LogToConsole(Component.literal("[all] ").append(message));
|
LogToConsole(new TextComponent("[all] ").append(message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ public class ChatServerOverride {
|
||||||
{
|
{
|
||||||
play.displayClientMessage(message, false); // Send the message!
|
play.displayClientMessage(message, false); // Send the message!
|
||||||
}
|
}
|
||||||
LogToConsole(Component.literal("[all] ").append(message));
|
LogToConsole(new TextComponent("[all] ").append(message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ public class ChatServerOverride {
|
||||||
ServerPlayer play = s.getPlayerList().getPlayer(ID);
|
ServerPlayer play = s.getPlayerList().getPlayer(ID);
|
||||||
play.displayClientMessage(message, false); // Send the message!
|
play.displayClientMessage(message, false); // Send the message!
|
||||||
|
|
||||||
LogToConsole(Component.literal("[server] -> ["+play.getName().toString()+"] ").append(message));
|
LogToConsole(new TextComponent("[server] -> ["+play.getName().toString()+"] ").append(message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ public class ChatServerOverride {
|
||||||
ServerPlayer play = s.getPlayerList().getPlayer(ID);
|
ServerPlayer play = s.getPlayerList().getPlayer(ID);
|
||||||
play.displayClientMessage(message, true); // Send the message!
|
play.displayClientMessage(message, true); // Send the message!
|
||||||
|
|
||||||
LogToConsole(Component.literal("[server] -> ["+play.getName().toString()+"] ").append(message));
|
LogToConsole(new TextComponent("[server] -> ["+play.getName().toString()+"] ").append(message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import dev.zontreck.otemod.commands.homes.DelHomeCommand;
|
||||||
import dev.zontreck.otemod.commands.homes.HomeCommand;
|
import dev.zontreck.otemod.commands.homes.HomeCommand;
|
||||||
import dev.zontreck.otemod.commands.homes.HomesCommand;
|
import dev.zontreck.otemod.commands.homes.HomesCommand;
|
||||||
import dev.zontreck.otemod.commands.homes.SetHomeCommand;
|
import dev.zontreck.otemod.commands.homes.SetHomeCommand;
|
||||||
|
import dev.zontreck.otemod.commands.items.ShareItemInChatCommand;
|
||||||
import dev.zontreck.otemod.commands.profilecmds.ChatColorCommand;
|
import dev.zontreck.otemod.commands.profilecmds.ChatColorCommand;
|
||||||
import dev.zontreck.otemod.commands.profilecmds.NameColorCommand;
|
import dev.zontreck.otemod.commands.profilecmds.NameColorCommand;
|
||||||
import dev.zontreck.otemod.commands.profilecmds.NickCommand;
|
import dev.zontreck.otemod.commands.profilecmds.NickCommand;
|
||||||
|
@ -135,5 +136,7 @@ public class CommandRegistry {
|
||||||
LoadSchem.register(ev.getDispatcher());
|
LoadSchem.register(ev.getDispatcher());
|
||||||
Place.register(ev.getDispatcher());
|
Place.register(ev.getDispatcher());
|
||||||
PlaceAsAir.register(ev.getDispatcher());
|
PlaceAsAir.register(ev.getDispatcher());
|
||||||
|
|
||||||
|
ShareItemInChatCommand.register(ev.getDispatcher());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
|
||||||
public class FlyCommand {
|
public class FlyCommand {
|
||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
|
@ -29,12 +30,8 @@ public class FlyCommand {
|
||||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||||
// if(homeName==null)return 0;
|
// if(homeName==null)return 0;
|
||||||
CommandSourceStack ctx = ctx2.getSource();
|
CommandSourceStack ctx = ctx2.getSource();
|
||||||
if(! ctx.isPlayer())
|
|
||||||
{
|
ServerPlayer p = (ServerPlayer)ctx.getEntity();
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ServerPlayer p = ctx.getPlayer();
|
|
||||||
if(p==null)return 1;
|
if(p==null)return 1;
|
||||||
|
|
||||||
if(p.getAbilities().mayfly){
|
if(p.getAbilities().mayfly){
|
||||||
|
@ -42,12 +39,12 @@ public class FlyCommand {
|
||||||
p.getAbilities().flying=false;
|
p.getAbilities().flying=false;
|
||||||
p.onUpdateAbilities();
|
p.onUpdateAbilities();
|
||||||
|
|
||||||
ctx.sendSuccess(Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " Your ability to fly has been disabled"), false);
|
ctx.sendSuccess(new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " Your ability to fly has been disabled"), false);
|
||||||
}else {
|
}else {
|
||||||
p.getAbilities().mayfly=true;
|
p.getAbilities().mayfly=true;
|
||||||
p.onUpdateAbilities();
|
p.onUpdateAbilities();
|
||||||
|
|
||||||
ctx.sendSuccess(Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " You can now fly"), false);
|
ctx.sendSuccess(new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " You can now fly"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -13,7 +13,8 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
|
||||||
public class DelHomeCommand {
|
public class DelHomeCommand {
|
||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
|
@ -34,11 +35,11 @@ public class DelHomeCommand {
|
||||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||||
// if(homeName==null)return 0;
|
// if(homeName==null)return 0;
|
||||||
|
|
||||||
if(! ctx.isPlayer())
|
if(!(ctx.getEntity() instanceof Player))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ServerPlayer p = ctx.getPlayer();
|
ServerPlayer p = (ServerPlayer) ctx.getEntity();
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
|
@ -54,13 +55,13 @@ public class DelHomeCommand {
|
||||||
pstat.execute();
|
pstat.execute();
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(ctx.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors("!dark_green! Home was deleted successfully")), ctx.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors("!dark_green! Home was deleted successfully")), ctx.getServer());
|
||||||
|
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ChatServerOverride.broadcastTo(ctx.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors("!dark_red! Home was unable to be deleted")), ctx.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors("!dark_red! Home was unable to be deleted")), ctx.getServer());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
|
||||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||||
import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
|
import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
|
||||||
|
import dev.zontreck.libzontreck.exceptions.InvalidSideException;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import dev.zontreck.otemod.commands.teleport.TeleportActioner;
|
import dev.zontreck.otemod.commands.teleport.TeleportActioner;
|
||||||
|
@ -22,11 +23,12 @@ import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
import net.minecraft.network.chat.TextColor;
|
import net.minecraft.network.chat.TextColor;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
|
||||||
public class HomeCommand {
|
public class HomeCommand {
|
||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
|
@ -47,11 +49,11 @@ public class HomeCommand {
|
||||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||||
// if(homeName==null)return 0;
|
// if(homeName==null)return 0;
|
||||||
|
|
||||||
if(! ctx.isPlayer())
|
if(!(ctx.getEntity() instanceof Player))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ServerPlayer p = ctx.getPlayer();
|
ServerPlayer p = (ServerPlayer)ctx.getEntity();
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
String SQL="";
|
String SQL="";
|
||||||
try {
|
try {
|
||||||
|
@ -83,7 +85,13 @@ public class HomeCommand {
|
||||||
position = dest.Position.asMinecraftVector();
|
position = dest.Position.asMinecraftVector();
|
||||||
rot = dest.Rotation.asMinecraftVector();
|
rot = dest.Rotation.asMinecraftVector();
|
||||||
|
|
||||||
ServerLevel dimL = dest.getActualDimension();
|
ServerLevel dimL=null;
|
||||||
|
try {
|
||||||
|
dimL = (ServerLevel)dest.getActualDimension();
|
||||||
|
} catch (InvalidSideException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
TeleportActioner.ApplyTeleportEffect(p);
|
TeleportActioner.ApplyTeleportEffect(p);
|
||||||
// Instantiate a Teleport Runner
|
// Instantiate a Teleport Runner
|
||||||
|
@ -101,15 +109,15 @@ public class HomeCommand {
|
||||||
Style sxx = Style.EMPTY.withColor(TextColor.parseColor(ChatColor.DARK_GREEN)).withFont(Style.DEFAULT_FONT);
|
Style sxx = Style.EMPTY.withColor(TextColor.parseColor(ChatColor.DARK_GREEN)).withFont(Style.DEFAULT_FONT);
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(ctx.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors("!dark_green!Home found! Wormhole opening now...")), ctx.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !dark_green!Home found! Wormhole opening now...")), ctx.getServer());
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if(!e.getMessage().equals("%%"))
|
if(!e.getMessage().equals("%%"))
|
||||||
ChatServerOverride.broadcastTo(ctx.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors("!Dark_Red! Could not go to the home")), ctx.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red! Could not go to the home")), ctx.getServer());
|
||||||
else
|
else
|
||||||
ctx.sendFailure(Component.literal("FAILED SQL: "+ ChatColor.GOLD+ SQL));
|
ctx.sendFailure(new TextComponent("FAILED SQL: "+ ChatColor.GOLD+ SQL));
|
||||||
} catch (InvalidDeserialization e) {
|
} catch (InvalidDeserialization e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -18,8 +18,9 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
|
||||||
public class HomesCommand {
|
public class HomesCommand {
|
||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
|
@ -30,12 +31,12 @@ public class HomesCommand {
|
||||||
private static int getHomes(CommandContext<CommandSourceStack> ctx)
|
private static int getHomes(CommandContext<CommandSourceStack> ctx)
|
||||||
{
|
{
|
||||||
// Request homes
|
// Request homes
|
||||||
if(! ctx.getSource().isPlayer())
|
if(!(ctx.getSource().getEntity() instanceof Player))
|
||||||
{
|
{
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ServerPlayer p = ctx.getSource().getPlayer();
|
ServerPlayer p = (ServerPlayer)ctx.getSource().getEntity();
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
|
@ -46,13 +47,13 @@ public class HomesCommand {
|
||||||
homes.add(rs.getString("home_name"));
|
homes.add(rs.getString("home_name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(p.getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Purple!There are !gold!"+String.valueOf(homes.size())+" !dark_purple!total homes.")), p.server);
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Purple!There are !gold!"+String.valueOf(homes.size())+" !dark_purple!total homes.")), p.server);
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
|
|
||||||
for (String string : homes) {
|
for (String string : homes) {
|
||||||
Style st = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.BOLD+ChatColor.DARK_GREEN+"Click here to go to this home")).withClickEvent(Clickable.command("/home "+string));
|
Style st = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.BOLD+ChatColor.DARK_GREEN+"Click here to go to this home")).withClickEvent(Clickable.command("/home "+string));
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(ctx.getSource().getPlayer().getUUID(), Component.literal(ChatColor.BOLD + ChatColor.MINECOIN_GOLD+"["+ChatColor.resetChat()+ChatColor.UNDERLINE+ChatColor.BOLD+ChatColor.DARK_GREEN+"HOME"+ChatColor.resetChat()+ChatColor.BOLD+ChatColor.MINECOIN_GOLD+"] "+ChatColor.resetChat()+ChatColor.YELLOW+string).setStyle(st), ctx.getSource().getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.BOLD + ChatColor.MINECOIN_GOLD+"["+ChatColor.resetChat()+ChatColor.UNDERLINE+ChatColor.BOLD+ChatColor.DARK_GREEN+"HOME"+ChatColor.resetChat()+ChatColor.BOLD+ChatColor.MINECOIN_GOLD+"] "+ChatColor.resetChat()+ChatColor.YELLOW+string).setStyle(st), ctx.getSource().getServer());
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
|
@ -16,9 +16,10 @@ import dev.zontreck.otemod.database.TeleportDestination;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
|
||||||
public class SetHomeCommand {
|
public class SetHomeCommand {
|
||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
|
@ -39,12 +40,12 @@ public class SetHomeCommand {
|
||||||
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
// homeName = StringArgumentType.getString(ctx2, "nickname");
|
||||||
// if(homeName==null)return 0;
|
// if(homeName==null)return 0;
|
||||||
|
|
||||||
if(! ctx.isPlayer())
|
if(!(ctx.getEntity() instanceof Player))
|
||||||
{
|
{
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ServerPlayer p = ctx.getPlayer();
|
ServerPlayer p = (ServerPlayer)ctx.getEntity();
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
|
@ -63,13 +64,13 @@ public class SetHomeCommand {
|
||||||
|
|
||||||
pstat.execute();
|
pstat.execute();
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(p.getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors(" !dark_green!Home was created or updated successfully!")), ctx.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !dark_green!Home was created or updated successfully!")), ctx.getServer());
|
||||||
|
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ChatServerOverride.broadcastTo(p.getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors(" !dark_red!Home could not be updated or created for a unknown reason!")), ctx.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !dark_red!Home could not be updated or created for a unknown reason!")), ctx.getServer());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
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.otemod.OTEMod;
|
||||||
|
import dev.zontreck.otemod.configs.Profile;
|
||||||
|
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;
|
||||||
|
import net.minecraft.world.item.AirItem;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
public class ShareItemInChatCommand {
|
||||||
|
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
|
{
|
||||||
|
dispatcher.register(Commands.literal("shareitem").executes(c->share_item(c.getSource())));
|
||||||
|
|
||||||
|
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||||
|
//String arg = StringArgumentType.getString(command, "nickname");
|
||||||
|
//return setHome(command.getSource(), arg);
|
||||||
|
//}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int share_item(CommandSourceStack source) {
|
||||||
|
|
||||||
|
if(source.getEntity() instanceof Player)
|
||||||
|
{
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
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);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Profile prof = Profile.get_profile_of(play.getUUID().toString());
|
||||||
|
|
||||||
|
MutableComponent component = new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Green!" + is.getDisplayName()+" !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)));
|
||||||
|
|
||||||
|
play.server.sendMessage(component, play.getUUID());
|
||||||
|
|
||||||
|
}else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,9 @@ import dev.zontreck.otemod.configs.Profile;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
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;
|
import net.minecraftforge.server.command.EnumArgument;
|
||||||
|
|
||||||
public class ChatColorCommand {
|
public class ChatColorCommand {
|
||||||
|
@ -35,15 +38,16 @@ public class ChatColorCommand {
|
||||||
String colorcoded = ChatColor.from(string);
|
String colorcoded = ChatColor.from(string);
|
||||||
|
|
||||||
// Get profile
|
// Get profile
|
||||||
if(source.getPlayer()==null){
|
if(!(source.getEntity() instanceof Player)){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Profile p = Profile.get_profile_of(source.getPlayer().getStringUUID());
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
Profile p = Profile.get_profile_of(play.getStringUUID());
|
||||||
p.chat_color = colorcoded;
|
p.chat_color = colorcoded;
|
||||||
p.commit();
|
p.commit();
|
||||||
OTEMod.PROFILES.put(source.getPlayer().getStringUUID(), p);
|
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
||||||
|
|
||||||
source.sendSuccess(Component.literal(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false);
|
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ import dev.zontreck.otemod.configs.Profile;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
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;
|
import net.minecraftforge.server.command.EnumArgument;
|
||||||
|
|
||||||
public class NameColorCommand {
|
public class NameColorCommand {
|
||||||
|
@ -35,16 +38,16 @@ public class NameColorCommand {
|
||||||
String colorcoded = ChatColor.from(string);
|
String colorcoded = ChatColor.from(string);
|
||||||
|
|
||||||
// Get profile
|
// Get profile
|
||||||
if(source.getPlayer()==null){
|
if(!(source.getEntity() instanceof Player)){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"Only a player can use this command"));
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Profile p = Profile.get_profile_of(source.getPlayer().getStringUUID());
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
Profile p = Profile.get_profile_of(play.getStringUUID());
|
||||||
p.name_color = colorcoded;
|
p.name_color = colorcoded;
|
||||||
p.commit();
|
p.commit();
|
||||||
OTEMod.PROFILES.put(source.getPlayer().getStringUUID(), p);
|
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
||||||
|
|
||||||
source.sendSuccess(Component.literal(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false);
|
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,16 @@ import dev.zontreck.otemod.configs.Profile;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
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;
|
||||||
|
|
||||||
public class NickCommand {
|
public class NickCommand {
|
||||||
|
|
||||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.register(Commands.literal("nick")
|
dispatcher.register(Commands.literal("nick")
|
||||||
.executes(c->setchatcolor(c.getSource(), c.getSource().getPlayer().getName().getString()))
|
.executes(c->setchatcolor(c.getSource(), c.getSource().getPlayerOrException().getName().getString()))
|
||||||
.then(Commands.argument("new_name", StringArgumentType.string())//StringArgumentType.string())
|
.then(Commands.argument("new_name", StringArgumentType.string())//StringArgumentType.string())
|
||||||
.executes(c -> setchatcolor(c.getSource(), StringArgumentType.getString(c, "new_name")))// EnumArgument.getS(c, "color")))
|
.executes(c -> setchatcolor(c.getSource(), StringArgumentType.getString(c, "new_name")))// EnumArgument.getS(c, "color")))
|
||||||
)
|
)
|
||||||
|
@ -30,16 +33,17 @@ public class NickCommand {
|
||||||
public static int setchatcolor(CommandSourceStack source, String string) {
|
public static int setchatcolor(CommandSourceStack source, String string) {
|
||||||
|
|
||||||
// Get profile
|
// Get profile
|
||||||
if(source.getPlayer()==null){
|
if(!(source.getEntity() instanceof Player)){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"Only a player can use this command"));
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Profile p = Profile.get_profile_of(source.getPlayer().getStringUUID());
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
|
Profile p = Profile.get_profile_of(play.getStringUUID());
|
||||||
p.nickname = string;
|
p.nickname = string;
|
||||||
p.commit();
|
p.commit();
|
||||||
OTEMod.PROFILES.put(source.getPlayer().getStringUUID(), p);
|
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
||||||
|
|
||||||
source.sendSuccess(Component.literal(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false);
|
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ import dev.zontreck.otemod.configs.Profile;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
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;
|
import net.minecraftforge.server.command.EnumArgument;
|
||||||
|
|
||||||
public class PrefixColorCommand {
|
public class PrefixColorCommand {
|
||||||
|
@ -35,16 +38,17 @@ public class PrefixColorCommand {
|
||||||
String colorcoded = ChatColor.from(string);
|
String colorcoded = ChatColor.from(string);
|
||||||
|
|
||||||
// Get profile
|
// Get profile
|
||||||
if(source.getPlayer()==null){
|
if(!(source.getEntity() instanceof Player)){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"Only a player can use this command"));
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Profile p = Profile.get_profile_of(source.getPlayer().getStringUUID());
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
|
Profile p = Profile.get_profile_of(play.getStringUUID());
|
||||||
p.prefix_color = colorcoded;
|
p.prefix_color = colorcoded;
|
||||||
p.commit();
|
p.commit();
|
||||||
OTEMod.PROFILES.put(source.getPlayer().getStringUUID(), p);
|
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
||||||
|
|
||||||
source.sendSuccess(Component.literal(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false);
|
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ import dev.zontreck.otemod.configs.Profile;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
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;
|
||||||
|
|
||||||
public class PrefixCommand {
|
public class PrefixCommand {
|
||||||
|
|
||||||
|
@ -30,16 +33,17 @@ public class PrefixCommand {
|
||||||
public static int setchatcolor(CommandSourceStack source, String string) {
|
public static int setchatcolor(CommandSourceStack source, String string) {
|
||||||
|
|
||||||
// Get profile
|
// Get profile
|
||||||
if(source.getPlayer()==null){
|
if(!(source.getEntity() instanceof Player)){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"Only a player can use this command"));
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Profile p = Profile.get_profile_of(source.getPlayer().getStringUUID());
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
|
Profile p = Profile.get_profile_of(play.getStringUUID());
|
||||||
p.prefix = string;
|
p.prefix = string;
|
||||||
p.commit();
|
p.commit();
|
||||||
OTEMod.PROFILES.put(source.getPlayer().getStringUUID(), p);
|
OTEMod.PROFILES.put(play.getStringUUID(), p);
|
||||||
|
|
||||||
source.sendSuccess(Component.literal(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false);
|
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,10 @@ import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
@ -109,8 +111,12 @@ public class RTPCommand {
|
||||||
//return 0; // Removed until the player data registry is implemented
|
//return 0; // Removed until the player data registry is implemented
|
||||||
}
|
}
|
||||||
CommandRegistry.markUsed("rtp");*/
|
CommandRegistry.markUsed("rtp");*/
|
||||||
ServerPlayer pla = source.getPlayer();
|
if(!(source.getEntity() instanceof Player)){
|
||||||
TeleportContainer cont = new TeleportContainer(pla, null, source.getPlayer().getRotationVector(), source.getLevel());
|
return 1;
|
||||||
|
}
|
||||||
|
ServerPlayer pla = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
|
TeleportContainer cont = new TeleportContainer(pla, null, pla.getRotationVector(), source.getLevel());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +131,7 @@ public class RTPCommand {
|
||||||
boolean found_place= false;
|
boolean found_place= false;
|
||||||
|
|
||||||
int tries=0;
|
int tries=0;
|
||||||
ChatServerOverride.broadcastTo(pla.getUUID(), Component.literal(ChatColor.DARK_GRAY + "["+ChatColor.DARK_GREEN+"OTEMOD"+ChatColor.DARK_GRAY+"] "+ChatColor.GREEN+"Searching for a suitable landing location..."), source.getServer());
|
ChatServerOverride.broadcastTo(pla.getUUID(), new TextComponent(ChatColor.DARK_GRAY + "["+ChatColor.DARK_GREEN+"OTEMOD"+ChatColor.DARK_GRAY+"] "+ChatColor.GREEN+"Searching for a suitable landing location..."), source.getServer());
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -212,7 +218,7 @@ public class RTPCommand {
|
||||||
}*/
|
}*/
|
||||||
v=findPosition(source.getLevel(), allowWater);
|
v=findPosition(source.getLevel(), allowWater);
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(pla.getUUID(), Component.literal(ChatColor.DARK_GRAY + "["+ChatColor.DARK_GREEN + "OTEMOD" + ChatColor.DARK_GRAY + "] "+ChatColor.DARK_PURPLE+" A suitable location has been found. Wormhole opening now!"), source.getServer());
|
ChatServerOverride.broadcastTo(pla.getUUID(), new TextComponent(ChatColor.DARK_GRAY + "["+ChatColor.DARK_GREEN + "OTEMOD" + ChatColor.DARK_GRAY + "] "+ChatColor.DARK_PURPLE+" A suitable location has been found. Wormhole opening now!"), source.getServer());
|
||||||
|
|
||||||
// Apply the effect
|
// Apply the effect
|
||||||
TeleportActioner.ApplyTeleportEffect(pla);
|
TeleportActioner.ApplyTeleportEffect(pla);
|
||||||
|
@ -230,6 +236,8 @@ public class RTPCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int doCancel(CommandSourceStack source, String TPID) {
|
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||||
|
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
UUID teleporter = UUID.fromString(TPID);
|
UUID teleporter = UUID.fromString(TPID);
|
||||||
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
||||||
if(cont.TeleportID.equals(teleporter)){
|
if(cont.TeleportID.equals(teleporter)){
|
||||||
|
@ -238,7 +246,7 @@ public class RTPCommand {
|
||||||
ServerPlayer from = source.getServer().getPlayerList().getPlayer(cont.FromPlayer);
|
ServerPlayer from = source.getServer().getPlayerList().getPlayer(cont.FromPlayer);
|
||||||
ServerPlayer to = source.getServer().getPlayerList().getPlayer(cont.ToPlayer);
|
ServerPlayer to = source.getServer().getPlayerList().getPlayer(cont.ToPlayer);
|
||||||
|
|
||||||
Component comp = Component.literal(ChatColor.DARK_GRAY + "["+ ChatColor.DARK_GREEN+ "OTEMOD" + ChatColor.DARK_GRAY+"] " + ChatColor.DARK_PURPLE+"Teleport request was accepted. Opening wormhole!");
|
Component comp = new TextComponent(ChatColor.DARK_GRAY + "["+ ChatColor.DARK_GREEN+ "OTEMOD" + ChatColor.DARK_GRAY+"] " + ChatColor.DARK_PURPLE+"Teleport request was accepted. Opening wormhole!");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||||
|
@ -257,9 +265,9 @@ public class RTPCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component comp = Component.literal(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
Component comp = new TextComponent(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), comp, source.getServer());
|
ChatServerOverride.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.network.chat.ClickEvent;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.HoverEvent;
|
import net.minecraft.network.chat.HoverEvent;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class TPACommand {
|
public class TPACommand {
|
||||||
|
@ -32,24 +33,26 @@ public class TPACommand {
|
||||||
private static int tpa(CommandSourceStack source, ServerPlayer serverPlayer) {
|
private static int tpa(CommandSourceStack source, ServerPlayer serverPlayer) {
|
||||||
// Send the request to player
|
// Send the request to player
|
||||||
if(serverPlayer == null){
|
if(serverPlayer == null){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"Error: Player not found"));
|
source.sendFailure(new TextComponent(ChatColor.DARK_RED+"Error: Player not found"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(!OTEMod.DEVELOPER){
|
if(!OTEMod.DEVELOPER){
|
||||||
if(source.getPlayer().getUUID() == serverPlayer.getUUID()){
|
if(play.getUUID() == serverPlayer.getUUID()){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"You cannot teleport to yourself!"));
|
source.sendFailure(new TextComponent(ChatColor.DARK_RED+"You cannot teleport to yourself!"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TeleportContainer cont = new TeleportContainer(source.getPlayer().getUUID(), serverPlayer.getUUID());
|
TeleportContainer cont = new TeleportContainer(play.getUUID(), serverPlayer.getUUID());
|
||||||
|
|
||||||
for(TeleportContainer cont2 : OTEMod.TeleportRegistry){
|
for(TeleportContainer cont2 : OTEMod.TeleportRegistry){
|
||||||
if(cont2.compareTo(cont)==0){
|
if(cont2.compareTo(cont)==0){
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, Component.literal(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, new TextComponent(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
if(cont2.FromPlayer == cont.FromPlayer){
|
if(cont2.FromPlayer == cont.FromPlayer){
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, Component.literal(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, new TextComponent(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +65,7 @@ public class TPACommand {
|
||||||
Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he).withClickEvent(ce);
|
Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he).withClickEvent(ce);
|
||||||
|
|
||||||
// Send the alerts
|
// Send the alerts
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, Component.literal(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(Component.literal(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
ChatServerOverride.broadcastTo(cont.FromPlayer, new TextComponent(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(new TextComponent(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
||||||
|
|
||||||
|
|
||||||
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
||||||
|
@ -74,16 +77,16 @@ public class TPACommand {
|
||||||
Style s2 = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce2).withHoverEvent(he2);
|
Style s2 = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce2).withHoverEvent(he2);
|
||||||
|
|
||||||
Profile p = Profile.get_profile_of(cont.FromPlayer.toString());
|
Profile p = Profile.get_profile_of(cont.FromPlayer.toString());
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, Component.literal(p.name_color+p.nickname + ChatColor.BOLD + ChatColor.DARK_PURPLE+" is requesting to teleport to you\n \n").
|
ChatServerOverride.broadcastTo(cont.ToPlayer, new TextComponent(p.name_color+p.nickname + ChatColor.BOLD + ChatColor.DARK_PURPLE+" is requesting to teleport to you\n \n").
|
||||||
append(Component.literal(ChatColor.DARK_GRAY+"["+ChatColor.DARK_GREEN+"ACCEPT" + ChatColor.DARK_GRAY+"] ").setStyle(s)).
|
append(new TextComponent(ChatColor.DARK_GRAY+"["+ChatColor.DARK_GREEN+"ACCEPT" + ChatColor.DARK_GRAY+"] ").setStyle(s)).
|
||||||
append(Component.literal(ChatColor.DARK_GRAY + "["+ChatColor.DARK_RED+"DENY"+ChatColor.DARK_GRAY+"]").setStyle(s2)), serverPlayer.server);
|
append(new TextComponent(ChatColor.DARK_GRAY + "["+ChatColor.DARK_RED+"DENY"+ChatColor.DARK_GRAY+"]").setStyle(s2)), serverPlayer.server);
|
||||||
|
|
||||||
OTEMod.TeleportRegistry.add(cont);
|
OTEMod.TeleportRegistry.add(cont);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int usage(CommandSourceStack source) {
|
private static int usage(CommandSourceStack source) {
|
||||||
source.sendSuccess(Component.literal("/tpa USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"), false);
|
source.sendSuccess(new TextComponent("/tpa USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"), false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.network.chat.ClickEvent;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.HoverEvent;
|
import net.minecraft.network.chat.HoverEvent;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class TPAHereCommand {
|
public class TPAHereCommand {
|
||||||
|
@ -31,25 +32,27 @@ public class TPAHereCommand {
|
||||||
|
|
||||||
private static int tpa(CommandSourceStack source, ServerPlayer serverPlayer) {
|
private static int tpa(CommandSourceStack source, ServerPlayer serverPlayer) {
|
||||||
// Send the request to player
|
// Send the request to player
|
||||||
|
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(serverPlayer == null){
|
if(serverPlayer == null){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"Error: Player not found"));
|
source.sendFailure(new TextComponent(ChatColor.DARK_RED+"Error: Player not found"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!OTEMod.DEVELOPER){
|
if(!OTEMod.DEVELOPER){
|
||||||
if(source.getPlayer().getUUID() == serverPlayer.getUUID()){
|
if(play.getUUID() == serverPlayer.getUUID()){
|
||||||
source.sendFailure(Component.literal(ChatColor.DARK_RED+"You cannot teleport to yourself!"));
|
source.sendFailure(new TextComponent(ChatColor.DARK_RED+"You cannot teleport to yourself!"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), source.getPlayer().getUUID());
|
TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), play.getUUID());
|
||||||
|
|
||||||
for(TeleportContainer cont2 : OTEMod.TeleportRegistry){
|
for(TeleportContainer cont2 : OTEMod.TeleportRegistry){
|
||||||
if(cont2.compareTo(cont)==0){
|
if(cont2.compareTo(cont)==0){
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, Component.literal(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
ChatServerOverride.broadcastTo(cont.ToPlayer, new TextComponent(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
if(cont2.ToPlayer.equals(cont.ToPlayer)){
|
if(cont2.ToPlayer.equals(cont.ToPlayer)){
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, Component.literal(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, new TextComponent(ChatColor.DARK_RED+ "You already have a TPA Request active, wait for it to expire, or use the cancel button/command"), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +65,7 @@ public class TPAHereCommand {
|
||||||
Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he).withClickEvent(ce);
|
Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he).withClickEvent(ce);
|
||||||
|
|
||||||
// Send the alerts
|
// Send the alerts
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, Component.literal(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(Component.literal(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
ChatServerOverride.broadcastTo(cont.ToPlayer, new TextComponent(ChatColor.BOLD + ChatColor.DARK_GREEN +"TPA Request Sent! ").append(new TextComponent(ChatColor.BOLD+ChatColor.DARK_GRAY+"["+ChatColor.DARK_RED+"X"+ChatColor.DARK_GRAY+"]").setStyle(s)), serverPlayer.server);
|
||||||
|
|
||||||
|
|
||||||
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
||||||
|
@ -74,16 +77,16 @@ public class TPAHereCommand {
|
||||||
Style s2 = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce2).withHoverEvent(he2);
|
Style s2 = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce2).withHoverEvent(he2);
|
||||||
|
|
||||||
Profile p = Profile.get_profile_of(cont.ToPlayer.toString());
|
Profile p = Profile.get_profile_of(cont.ToPlayer.toString());
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, Component.literal(p.name_color+p.nickname + ChatColor.BOLD + ChatColor.DARK_PURPLE+" is requesting you to teleport to them\n \n").
|
ChatServerOverride.broadcastTo(cont.FromPlayer, new TextComponent(p.name_color+p.nickname + ChatColor.BOLD + ChatColor.DARK_PURPLE+" is requesting you to teleport to them\n \n").
|
||||||
append(Component.literal(ChatColor.DARK_GRAY+"["+ChatColor.DARK_GREEN+"ACCEPT" + ChatColor.DARK_GRAY+"] ").setStyle(s)).
|
append(new TextComponent(ChatColor.DARK_GRAY+"["+ChatColor.DARK_GREEN+"ACCEPT" + ChatColor.DARK_GRAY+"] ").setStyle(s)).
|
||||||
append(Component.literal(ChatColor.DARK_GRAY + "["+ChatColor.DARK_RED+"DENY"+ChatColor.DARK_GRAY+"]").setStyle(s2)), serverPlayer.server);
|
append(new TextComponent(ChatColor.DARK_GRAY + "["+ChatColor.DARK_RED+"DENY"+ChatColor.DARK_GRAY+"]").setStyle(s2)), serverPlayer.server);
|
||||||
|
|
||||||
OTEMod.TeleportRegistry.add(cont);
|
OTEMod.TeleportRegistry.add(cont);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int usage(CommandSourceStack source) {
|
private static int usage(CommandSourceStack source) {
|
||||||
source.sendSuccess(Component.literal("/tpa USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"), false);
|
source.sendSuccess(new TextComponent("/tpa USAGE\n\n "+ChatColor.BOLD + ChatColor.DARK_GRAY+"/tpa "+ChatColor.DARK_RED+"target_player\n"), false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class TPAcceptCommand {
|
public class TPAcceptCommand {
|
||||||
|
@ -29,6 +30,8 @@ public class TPAcceptCommand {
|
||||||
|
|
||||||
private static int doCancel(CommandSourceStack source, String TPID) {
|
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||||
UUID teleporter = UUID.fromString(TPID);
|
UUID teleporter = UUID.fromString(TPID);
|
||||||
|
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
||||||
if(cont.TeleportID.equals(teleporter)){
|
if(cont.TeleportID.equals(teleporter)){
|
||||||
// Accepting!
|
// Accepting!
|
||||||
|
@ -36,7 +39,7 @@ public class TPAcceptCommand {
|
||||||
ServerPlayer from = source.getServer().getPlayerList().getPlayer(cont.FromPlayer);
|
ServerPlayer from = source.getServer().getPlayerList().getPlayer(cont.FromPlayer);
|
||||||
ServerPlayer to = source.getServer().getPlayerList().getPlayer(cont.ToPlayer);
|
ServerPlayer to = source.getServer().getPlayerList().getPlayer(cont.ToPlayer);
|
||||||
|
|
||||||
Component comp = Component.literal(OTEMod.OTEPrefix + " " + ChatColor.DARK_PURPLE+"Teleport request was accepted. Opening wormhole!");
|
Component comp = new TextComponent(OTEMod.OTEPrefix + " " + ChatColor.DARK_PURPLE+"Teleport request was accepted. Opening wormhole!");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||||
|
@ -55,9 +58,9 @@ public class TPAcceptCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component comp = Component.literal(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
Component comp = new TextComponent(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), comp, source.getServer());
|
ChatServerOverride.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class TPCancelCommand {
|
public class TPCancelCommand {
|
||||||
|
|
||||||
|
@ -28,10 +30,12 @@ public class TPCancelCommand {
|
||||||
|
|
||||||
private static int doCancel(CommandSourceStack source, String TPID) {
|
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||||
UUID teleporter = UUID.fromString(TPID);
|
UUID teleporter = UUID.fromString(TPID);
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
||||||
if(cont.TeleportID.equals(teleporter)){
|
if(cont.TeleportID.equals(teleporter)){
|
||||||
// Canceling!
|
// Canceling!
|
||||||
Component comp = Component.literal(OTEMod.OTEPrefix + " " + ChatColor.DARK_PURPLE+"Teleport request was cancelled");
|
Component comp = new TextComponent(OTEMod.OTEPrefix + " " + ChatColor.DARK_PURPLE+"Teleport request was cancelled");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||||
|
@ -41,9 +45,9 @@ public class TPCancelCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component comp = Component.literal(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled");
|
Component comp = new TextComponent(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), comp, source.getServer());
|
ChatServerOverride.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class TPDenyCommand {
|
public class TPDenyCommand {
|
||||||
|
|
||||||
|
@ -28,10 +30,12 @@ public class TPDenyCommand {
|
||||||
|
|
||||||
private static int doCancel(CommandSourceStack source, String TPID) {
|
private static int doCancel(CommandSourceStack source, String TPID) {
|
||||||
UUID teleporter = UUID.fromString(TPID);
|
UUID teleporter = UUID.fromString(TPID);
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
for(TeleportContainer cont : OTEMod.TeleportRegistry){
|
||||||
if(cont.TeleportID.equals(teleporter)){
|
if(cont.TeleportID.equals(teleporter)){
|
||||||
// Canceling!
|
// Canceling!
|
||||||
Component comp = Component.literal(OTEMod.OTEPrefix + " " + ChatColor.DARK_PURPLE+"Teleport request was denied");
|
Component comp = new TextComponent(OTEMod.OTEPrefix + " " + ChatColor.DARK_PURPLE+"Teleport request was denied");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.FromPlayer, comp, source.getServer());
|
||||||
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
ChatServerOverride.broadcastTo(cont.ToPlayer, comp, source.getServer());
|
||||||
|
@ -41,9 +45,9 @@ public class TPDenyCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component comp = Component.literal(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
Component comp = new TextComponent(ChatColor.DARK_RED+"The teleport was not found, perhaps the request expired or was already cancelled/denied");
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), comp, source.getServer());
|
ChatServerOverride.broadcastTo(play.getUUID(), comp, source.getServer());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class TeleportActioner
|
||||||
player.server.execute(new Runnable(){
|
player.server.execute(new Runnable(){
|
||||||
public void run(){
|
public void run(){
|
||||||
|
|
||||||
MobEffectInstance inst = new MobEffectInstance(MobEffects.DARKNESS, 200, 1, true, true);
|
MobEffectInstance inst = new MobEffectInstance(MobEffects.BLINDNESS, 200, 1, true, true);
|
||||||
MobEffectInstance regen = new MobEffectInstance(MobEffects.REGENERATION, 200, 2, true, true);
|
MobEffectInstance regen = new MobEffectInstance(MobEffects.REGENERATION, 200, 2, true, true);
|
||||||
|
|
||||||
// 10-05-2022 - Adjusted to 100 on duration due to a small issue where it would sometimes stop levitation prior to the teleport taking effect.
|
// 10-05-2022 - Adjusted to 100 on duration due to a small issue where it would sometimes stop levitation prior to the teleport taking effect.
|
||||||
|
|
|
@ -6,6 +6,8 @@ import dev.zontreck.otemod.implementation.vault.VaultContainer;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.SimpleMenuProvider;
|
import net.minecraft.world.SimpleMenuProvider;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
|
|
||||||
|
@ -24,14 +26,15 @@ public class TrashCommand {
|
||||||
private static int vault(CommandSourceStack source) {
|
private static int vault(CommandSourceStack source) {
|
||||||
//VaultContainer cont = new VaultContainer(i, source.getPlayer().getUUID());
|
//VaultContainer cont = new VaultContainer(i, source.getPlayer().getUUID());
|
||||||
//cont.startOpen(source.getPlayer());
|
//cont.startOpen(source.getPlayer());
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
|
|
||||||
|
VaultContainer container = new VaultContainer(play, -1);
|
||||||
|
|
||||||
VaultContainer container = new VaultContainer(source.getPlayer(), -1);
|
NetworkHooks.openGui(play, new SimpleMenuProvider(container.serverMenu, new TextComponent("Trash")));
|
||||||
|
|
||||||
NetworkHooks.openScreen(source.getPlayer(), new SimpleMenuProvider(container.serverMenu, Component.literal("Trash")));
|
|
||||||
|
|
||||||
// Add to the master vault registry
|
// Add to the master vault registry
|
||||||
if(VaultContainer.VAULT_REGISTRY.containsKey(source.getPlayer().getUUID()))VaultContainer.VAULT_REGISTRY.remove(source.getPlayer().getUUID());
|
if(VaultContainer.VAULT_REGISTRY.containsKey(play.getUUID()))VaultContainer.VAULT_REGISTRY.remove(play.getUUID());
|
||||||
VaultContainer.VAULT_REGISTRY.put(source.getPlayer().getUUID(), container);
|
VaultContainer.VAULT_REGISTRY.put(play.getUUID(), container);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import dev.zontreck.otemod.implementation.vault.VaultContainer;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.SimpleMenuProvider;
|
import net.minecraft.world.SimpleMenuProvider;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
@ -31,12 +32,13 @@ public class VaultCommand {
|
||||||
private static int vault(CommandSourceStack source, int i) {
|
private static int vault(CommandSourceStack source, int i) {
|
||||||
//VaultContainer cont = new VaultContainer(i, source.getPlayer().getUUID());
|
//VaultContainer cont = new VaultContainer(i, source.getPlayer().getUUID());
|
||||||
//cont.startOpen(source.getPlayer());
|
//cont.startOpen(source.getPlayer());
|
||||||
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(i <0)
|
if(i <0)
|
||||||
{
|
{
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range")), source.getServer());
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range")), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
doOpen(source.getPlayer(), i);
|
doOpen(play, i);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -46,7 +48,7 @@ public class VaultCommand {
|
||||||
|
|
||||||
VaultContainer container = new VaultContainer(p, i);
|
VaultContainer container = new VaultContainer(p, i);
|
||||||
|
|
||||||
NetworkHooks.openScreen(p, new SimpleMenuProvider(container.serverMenu, Component.literal("Vault "+i)));
|
NetworkHooks.openGui(p, new SimpleMenuProvider(container.serverMenu, new TextComponent("Vault "+i)));
|
||||||
|
|
||||||
// Add to the master vault registry
|
// Add to the master vault registry
|
||||||
if(VaultContainer.VAULT_REGISTRY.containsKey(p.getUUID()))VaultContainer.VAULT_REGISTRY.remove(p.getUUID());
|
if(VaultContainer.VAULT_REGISTRY.containsKey(p.getUUID()))VaultContainer.VAULT_REGISTRY.remove(p.getUUID());
|
||||||
|
|
|
@ -16,6 +16,8 @@ import dev.zontreck.otemod.database.TeleportDestination;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -34,12 +36,7 @@ public class DelWarpCommand {
|
||||||
|
|
||||||
private static int setWarp(CommandSourceStack source, String string) {
|
private static int setWarp(CommandSourceStack source, String string) {
|
||||||
|
|
||||||
if(! source.isPlayer())
|
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||||
{
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + OTEMod.ONLY_PLAYER), source.getServer());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ServerPlayer p = source.getPlayer();
|
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
|
@ -56,13 +53,13 @@ public class DelWarpCommand {
|
||||||
pstat.execute();
|
pstat.execute();
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.GREEN).append(Component.translatable("dev.zontreck.otemod.msgs.warps.del.success")), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.GREEN).append(new TranslatableComponent("dev.zontreck.otemod.msgs.warps.del.success")), source.getServer());
|
||||||
|
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.DARK_RED).append(Component.translatable("dev.zontreck.otemod.msgs.warps.del.fail")), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.DARK_RED).append(new TranslatableComponent("dev.zontreck.otemod.msgs.warps.del.fail")), source.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -16,6 +16,8 @@ import dev.zontreck.otemod.database.TeleportDestination;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -34,14 +36,7 @@ public class RTPWarpCommand {
|
||||||
|
|
||||||
private static int setWarp(CommandSourceStack source, String string) {
|
private static int setWarp(CommandSourceStack source, String string) {
|
||||||
|
|
||||||
if(! source.isPlayer())
|
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + OTEMod.ONLY_PLAYER), source.getServer());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ServerPlayer p = source.getPlayer();
|
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
|
@ -60,13 +55,13 @@ public class RTPWarpCommand {
|
||||||
pstat.execute();
|
pstat.execute();
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.GREEN).append(Component.translatable("dev.zontreck.otemod.msgs.warps.set.success")), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.GREEN).append(new TranslatableComponent("dev.zontreck.otemod.msgs.warps.set.success")), source.getServer());
|
||||||
|
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.DARK_RED).append(Component.translatable("dev.zontreck.otemod.msgs.warps.set.fail")), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.DARK_RED).append(new TranslatableComponent("dev.zontreck.otemod.msgs.warps.set.fail")), source.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -16,6 +16,8 @@ import dev.zontreck.otemod.database.TeleportDestination;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -34,13 +36,7 @@ public class SetWarpCommand {
|
||||||
|
|
||||||
private static int setWarp(CommandSourceStack source, String string) {
|
private static int setWarp(CommandSourceStack source, String string) {
|
||||||
|
|
||||||
if(! source.isPlayer())
|
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||||
{
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + OTEMod.ONLY_PLAYER), source.getServer());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ServerPlayer p = source.getPlayer();
|
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try {
|
try {
|
||||||
con.beginRequest();
|
con.beginRequest();
|
||||||
|
@ -59,13 +55,13 @@ public class SetWarpCommand {
|
||||||
pstat.execute();
|
pstat.execute();
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.GREEN).append(Component.translatable("dev.zontreck.otemod.msgs.warps.set.success")), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.GREEN).append(new TranslatableComponent("dev.zontreck.otemod.msgs.warps.set.success")), source.getServer());
|
||||||
|
|
||||||
con.endRequest();
|
con.endRequest();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.DARK_RED).append(Component.translatable("dev.zontreck.otemod.msgs.warps.set.fail")), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.DARK_RED).append(new TranslatableComponent("dev.zontreck.otemod.msgs.warps.set.fail")), source.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
|
||||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||||
import dev.zontreck.libzontreck.chat.Clickable;
|
import dev.zontreck.libzontreck.chat.Clickable;
|
||||||
|
import dev.zontreck.libzontreck.exceptions.InvalidSideException;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import dev.zontreck.otemod.commands.teleport.RTPCommand;
|
import dev.zontreck.otemod.commands.teleport.RTPCommand;
|
||||||
|
@ -18,8 +19,8 @@ import dev.zontreck.otemod.database.TeleportDestination;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
@ -36,13 +37,8 @@ public class WarpCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int warp(CommandSourceStack source, String string) {
|
private static int warp(CommandSourceStack source, String string) {
|
||||||
if(!source.isPlayer()){
|
|
||||||
|
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + OTEMod.ONLY_PLAYER), source.getServer());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerPlayer p = source.getPlayer();
|
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
String SQL = "";
|
String SQL = "";
|
||||||
try{
|
try{
|
||||||
|
@ -59,8 +55,13 @@ public class WarpCommand {
|
||||||
TeleportDestination dest = new TeleportDestination(NbtUtils.snbtToStructure(rs.getString("teleporter")));
|
TeleportDestination dest = new TeleportDestination(NbtUtils.snbtToStructure(rs.getString("teleporter")));
|
||||||
|
|
||||||
|
|
||||||
ServerLevel dimL = dest.getActualDimension();
|
ServerLevel dimL = null;
|
||||||
|
try{
|
||||||
|
dimL=(ServerLevel) dest.getActualDimension();
|
||||||
|
}catch(InvalidSideException e)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
final int type = rs.getInt("warptype");
|
final int type = rs.getInt("warptype");
|
||||||
final ServerLevel f_dim = dimL;
|
final ServerLevel f_dim = dimL;
|
||||||
|
@ -79,7 +80,7 @@ public class WarpCommand {
|
||||||
});
|
});
|
||||||
tx.start();
|
tx.start();
|
||||||
}else {
|
}else {
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.DARK_RED+"No such warp"), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.DARK_RED+"No such warp"), source.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +92,8 @@ public class WarpCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int nowarp(CommandSourceStack source) {
|
private static int nowarp(CommandSourceStack source) {
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(ChatColor.DARK_RED + "You must supply the warp name. If you need to know what warps are available, please use the warps command, or click this message.").withStyle(Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(Clickable.command("/warps"))), source.getServer());
|
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||||
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(ChatColor.DARK_RED + "You must supply the warp name. If you need to know what warps are available, please use the warps command, or click this message.").withStyle(Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(Clickable.command("/warps"))), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.network.chat.ClickEvent;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.HoverEvent;
|
import net.minecraft.network.chat.HoverEvent;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class WarpsCommand {
|
public class WarpsCommand {
|
||||||
|
@ -33,13 +34,9 @@ public class WarpsCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int warps(CommandSourceStack source) {
|
private static int warps(CommandSourceStack source) {
|
||||||
if(!source.isPlayer())
|
|
||||||
{
|
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), Component.literal(OTEMod.OTEPrefix + OTEMod.ONLY_PLAYER), source.getServer());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerPlayer p = source.getPlayer();
|
ServerPlayer p = (ServerPlayer)source.getEntity();
|
||||||
Connection con = OTEMod.DB.getConnection();
|
Connection con = OTEMod.DB.getConnection();
|
||||||
try{
|
try{
|
||||||
// Begin
|
// Begin
|
||||||
|
@ -54,7 +51,7 @@ public class WarpsCommand {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
rs=pstat.executeQuery();// Reset the query
|
rs=pstat.executeQuery();// Reset the query
|
||||||
ChatServerOverride.broadcastTo(p.getUUID(), Component.literal(OTEMod.OTEPrefix + " "+ChatColor.resetChat() + "There are "+count+" warps available"), source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix + " "+ChatColor.resetChat() + "There are "+count+" warps available"), source.getServer());
|
||||||
|
|
||||||
while(rs.next())
|
while(rs.next())
|
||||||
{
|
{
|
||||||
|
@ -69,16 +66,16 @@ public class WarpsCommand {
|
||||||
ClickEvent click = Clickable.command("/warp "+warpName);
|
ClickEvent click = Clickable.command("/warp "+warpName);
|
||||||
Style S = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(hover).withClickEvent(click);
|
Style S = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(hover).withClickEvent(click);
|
||||||
|
|
||||||
Component warpMsg = Component.literal(ChatColor.GREEN + warpName + ChatColor.resetChat()).withStyle(S);
|
Component warpMsg = new TextComponent(ChatColor.GREEN + warpName + ChatColor.resetChat()).withStyle(S);
|
||||||
|
|
||||||
// Now, display the warp name, along with the warp's owner information
|
// Now, display the warp name, along with the warp's owner information
|
||||||
HoverEvent h2 = HoverTip.get(prof.name_color+prof.nickname+ChatColor.resetChat()+ChatColor.AQUA+" is the owner of this warp");
|
HoverEvent h2 = HoverTip.get(prof.name_color+prof.nickname+ChatColor.resetChat()+ChatColor.AQUA+" is the owner of this warp");
|
||||||
S = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(h2);
|
S = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(h2);
|
||||||
Component ownerInfo = Component.literal(ChatColor.GOLD+ " [Hover to see the warp's info]").withStyle(S);
|
Component ownerInfo = new TextComponent(ChatColor.GOLD+ " [Hover to see the warp's info]").withStyle(S);
|
||||||
|
|
||||||
// Combine the two
|
// Combine the two
|
||||||
warpMsg = Component.literal("").append(warpMsg).append(ownerInfo);
|
warpMsg = new TextComponent("").append(warpMsg).append(ownerInfo);
|
||||||
ChatServerOverride.broadcastTo(source.getPlayer().getUUID(), warpMsg, source.getServer());
|
ChatServerOverride.broadcastTo(p.getUUID(), warpMsg, source.getServer());
|
||||||
}
|
}
|
||||||
}catch (Exception E)
|
}catch (Exception E)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraftforge.fml.loading.FMLConfig;
|
import net.minecraftforge.fml.loading.FMLConfig;
|
||||||
|
@ -46,9 +46,9 @@ public class LoadSchem {
|
||||||
|
|
||||||
private static int loadSchematic(CommandSourceStack source, String name) {
|
private static int loadSchematic(CommandSourceStack source, String name) {
|
||||||
// Perform sanity checks
|
// Perform sanity checks
|
||||||
if(!source.isPlayer())return 1;
|
|
||||||
|
|
||||||
ServerPlayer play = source.getPlayer();
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
|
|
||||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_load)){
|
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_load)){
|
||||||
|
@ -115,17 +115,17 @@ public class LoadSchem {
|
||||||
MemoryHolder.setBlocks(play, blocks);
|
MemoryHolder.setBlocks(play, blocks);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!No such ZSchem exists!")), source.getServer());
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!No such ZSchem exists!")), source.getServer());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem loaded from disk!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem loaded from disk!")), OTEMod.THE_SERVER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(ChatColor.doColors("!Dark_Red! You must set the first position")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors("!Dark_Red! You must set the first position")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -134,9 +134,9 @@ public class LoadSchem {
|
||||||
{
|
{
|
||||||
String usage = OTEMod.OTEPrefix;
|
String usage = OTEMod.OTEPrefix;
|
||||||
usage += ChatColor.doColors("!gold! /loadzschem [string:name]");
|
usage += ChatColor.doColors("!gold! /loadzschem [string:name]");
|
||||||
ServerPlayer play=source.getPlayer();
|
ServerPlayer play=(ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(usage), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(usage), OTEMod.THE_SERVER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import dev.zontreck.otemod.zschem.MemoryHolder.Container;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
// 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.
|
// 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.
|
||||||
|
@ -34,7 +35,7 @@ public class Place {
|
||||||
|
|
||||||
private static int place(CommandSourceStack source) {
|
private static int place(CommandSourceStack source) {
|
||||||
|
|
||||||
ServerPlayer play = source.getPlayer();
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
|
|
||||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_place)){
|
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_place)){
|
||||||
|
@ -44,7 +45,7 @@ public class Place {
|
||||||
|
|
||||||
if(!MemoryHolder.hasPlayerCached(play)){
|
if(!MemoryHolder.hasPlayerCached(play)){
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -65,13 +66,13 @@ public class Place {
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import dev.zontreck.otemod.zschem.MemoryHolder.Container;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public class PlaceAsAir {
|
||||||
|
|
||||||
private static int place(CommandSourceStack source) {
|
private static int place(CommandSourceStack source) {
|
||||||
|
|
||||||
ServerPlayer play = source.getPlayer();
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
|
|
||||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_air)){
|
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_air)){
|
||||||
|
@ -47,7 +48,7 @@ public class PlaceAsAir {
|
||||||
|
|
||||||
if(!MemoryHolder.hasPlayerCached(play)){
|
if(!MemoryHolder.hasPlayerCached(play)){
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -72,13 +73,13 @@ public class PlaceAsAir {
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraftforge.fml.loading.FMLConfig;
|
import net.minecraftforge.fml.loading.FMLConfig;
|
||||||
import net.minecraftforge.fml.loading.FMLPaths;
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
|
@ -43,9 +44,8 @@ public class SaveSchem {
|
||||||
|
|
||||||
private static int saveSchematic(CommandSourceStack source, String name) {
|
private static int saveSchematic(CommandSourceStack source, String name) {
|
||||||
// Perform sanity checks
|
// Perform sanity checks
|
||||||
if(!source.isPlayer())return 1;
|
|
||||||
|
|
||||||
ServerPlayer play = source.getPlayer();
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
|
|
||||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_save)){
|
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_save)){
|
||||||
|
@ -107,12 +107,12 @@ public class SaveSchem {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem saved to disk!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem saved to disk!")), OTEMod.THE_SERVER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(ChatColor.doColors("!Dark_Red! You must first set the positions")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors("!Dark_Red! You must first set the positions")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -121,9 +121,9 @@ public class SaveSchem {
|
||||||
{
|
{
|
||||||
String usage = OTEMod.OTEPrefix;
|
String usage = OTEMod.OTEPrefix;
|
||||||
usage += ChatColor.doColors("!gold! /savezschem [string:name]");
|
usage += ChatColor.doColors("!gold! /savezschem [string:name]");
|
||||||
ServerPlayer play=source.getPlayer();
|
ServerPlayer play=(ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(usage), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(usage), OTEMod.THE_SERVER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class SetPos1 {
|
public class SetPos1 {
|
||||||
|
@ -28,7 +29,7 @@ public class SetPos1 {
|
||||||
|
|
||||||
private static int setzPos1(CommandSourceStack source) {
|
private static int setzPos1(CommandSourceStack source) {
|
||||||
|
|
||||||
ServerPlayer play = source.getPlayer();
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
|
|
||||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_pos1)){
|
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_pos1)){
|
||||||
|
@ -38,7 +39,7 @@ public class SetPos1 {
|
||||||
MemoryHolder.setPos1(play, new Vector3(source.getPosition()));
|
MemoryHolder.setPos1(play, new Vector3(source.getPosition()));
|
||||||
MemoryHolder.setLevel(play, source.getLevel());
|
MemoryHolder.setLevel(play, source.getLevel());
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 1 set!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 1 set!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import dev.zontreck.otemod.zschem.MemoryHolder;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public class SetPos2 {
|
public class SetPos2 {
|
||||||
|
@ -27,7 +28,7 @@ public class SetPos2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int setzPos2(CommandSourceStack source) {
|
private static int setzPos2(CommandSourceStack source) {
|
||||||
ServerPlayer play = source.getPlayer();
|
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||||
if(play==null)return 1;
|
if(play==null)return 1;
|
||||||
|
|
||||||
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_pos2)){
|
if(!LuckPermsHelper.hasGroupOrPerm(play, Permissions.zschem, Permissions.zschem_pos2)){
|
||||||
|
@ -38,7 +39,7 @@ public class SetPos2 {
|
||||||
MemoryHolder.setPos2(play, new Vector3(source.getPosition()));
|
MemoryHolder.setPos2(play, new Vector3(source.getPosition()));
|
||||||
MemoryHolder.setLevel(play, source.getLevel());
|
MemoryHolder.setLevel(play, source.getLevel());
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 2 set!")), OTEMod.THE_SERVER);
|
ChatServerOverride.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 2 set!")), OTEMod.THE_SERVER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package dev.zontreck.otemod.enchantments;
|
package dev.zontreck.otemod.enchantments;
|
||||||
|
|
||||||
|
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
@ -44,7 +45,7 @@ public class FlightEnchantment extends Enchantment
|
||||||
|
|
||||||
boolean hasFlight = false;
|
boolean hasFlight = false;
|
||||||
|
|
||||||
if(feet.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get())>0)hasFlight=true;
|
if(ItemUtils.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get(), feet)>0)hasFlight=true;
|
||||||
|
|
||||||
Abilities playerAbilities = sp.getAbilities();
|
Abilities playerAbilities = sp.getAbilities();
|
||||||
if(playerAbilities.mayfly == false)
|
if(playerAbilities.mayfly == false)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package dev.zontreck.otemod.enchantments;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||||
import net.minecraft.util.RandomSource;
|
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.SwordItem;
|
import net.minecraft.world.item.SwordItem;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
public class ModEntityTypes {
|
public class ModEntityTypes {
|
||||||
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, OTEMod.MOD_ID);
|
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, 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()));
|
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()));
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import dev.zontreck.otemod.networking.ModMessages;
|
||||||
import dev.zontreck.otemod.networking.packets.OpenVaultC2SPacket;
|
import dev.zontreck.otemod.networking.packets.OpenVaultC2SPacket;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.client.event.InputEvent;
|
import net.minecraftforge.client.event.InputEvent;
|
||||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ public class ClientEvents {
|
||||||
{
|
{
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onKeyInput(InputEvent.Key event)
|
public static void onKeyInput(InputEvent.ClickInputEvent event)
|
||||||
{
|
{
|
||||||
//OTEMod.LOGGER.info("KEY PRESS: "+event.getKey());
|
//OTEMod.LOGGER.info("KEY PRESS: "+event.getKey());
|
||||||
if(KeyBindings.OPEN_VAULT.consumeClick())
|
if(KeyBindings.OPEN_VAULT.consumeClick())
|
||||||
|
@ -30,10 +29,5 @@ public class ClientEvents {
|
||||||
public static class ClientModBus
|
public static class ClientModBus
|
||||||
{
|
{
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void onKeyRegister(RegisterKeyMappingsEvent event)
|
|
||||||
{
|
|
||||||
event.register(KeyBindings.OPEN_VAULT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,21 @@
|
||||||
package dev.zontreck.otemod.events;
|
package dev.zontreck.otemod.events;
|
||||||
|
|
||||||
|
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
|
||||||
import dev.zontreck.otemod.enchantments.MobEggEnchantment;
|
import dev.zontreck.otemod.enchantments.MobEggEnchantment;
|
||||||
import dev.zontreck.otemod.enchantments.ModEnchantments;
|
import dev.zontreck.otemod.enchantments.ModEnchantments;
|
||||||
import dev.zontreck.otemod.entities.ModEntityTypes;
|
|
||||||
import dev.zontreck.otemod.entities.monsters.PossumEntity;
|
|
||||||
import dev.zontreck.otemod.items.tags.ItemStatType;
|
import dev.zontreck.otemod.items.tags.ItemStatType;
|
||||||
import dev.zontreck.otemod.items.tags.ItemStatistics;
|
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
import net.minecraftforge.common.ForgeSpawnEggItem;
|
import net.minecraftforge.common.ForgeSpawnEggItem;
|
||||||
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
|
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid=OTEMod.MOD_ID)
|
@Mod.EventBusSubscriber(modid=OTEMod.MOD_ID)
|
||||||
|
@ -41,10 +35,10 @@ public class EventHandler {
|
||||||
if(ent instanceof Player)
|
if(ent instanceof Player)
|
||||||
{
|
{
|
||||||
ServerPlayer play = (ServerPlayer)ent;
|
ServerPlayer play = (ServerPlayer)ent;
|
||||||
LivingEntity killed = ev.getEntity();
|
LivingEntity killed = ev.getEntityLiving();
|
||||||
|
|
||||||
ItemStack stack = play.getMainHandItem();
|
ItemStack stack = play.getMainHandItem();
|
||||||
int levelOfEgging = stack.getEnchantmentLevel(ModEnchantments.MOB_EGGING_ENCHANTMENT.get());
|
int levelOfEgging = ItemUtils.getEnchantmentLevel(ModEnchantments.MOB_EGGING_ENCHANTMENT.get(),stack);
|
||||||
|
|
||||||
if(levelOfEgging==0)return;
|
if(levelOfEgging==0)return;
|
||||||
CompoundTag tag = stack.getTag();
|
CompoundTag tag = stack.getTag();
|
||||||
|
@ -57,7 +51,7 @@ public class EventHandler {
|
||||||
tag.putInt(MobEggEnchantment.TAG_BIAS, bias);
|
tag.putInt(MobEggEnchantment.TAG_BIAS, bias);
|
||||||
// .25% chance
|
// .25% chance
|
||||||
// Check enchantment level for looting
|
// Check enchantment level for looting
|
||||||
int level = stack.getEnchantmentLevel(Enchantments.MOB_LOOTING);
|
int level = ItemUtils.getEnchantmentLevel (Enchantments.MOB_LOOTING,stack);
|
||||||
if(level==3){
|
if(level==3){
|
||||||
ItemStack egg = new ItemStack(ForgeSpawnEggItem.fromEntityType(killed.getType()));
|
ItemStack egg = new ItemStack(ForgeSpawnEggItem.fromEntityType(killed.getType()));
|
||||||
ev.getDrops().add(new ItemEntity(killed.level, killed.getX(), killed.getY(), killed.getZ(), egg));
|
ev.getDrops().add(new ItemEntity(killed.level, killed.getX(), killed.getY(), killed.getZ(), egg));
|
||||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.event.level.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
|
@ -35,7 +35,7 @@ public class LoreHandlers {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBlockMined(BlockEvent.BreakEvent ev)
|
public void onBlockMined(BlockEvent.BreakEvent ev)
|
||||||
{
|
{
|
||||||
if(ev.getLevel().isClientSide())return;
|
if(ev.getWorld().isClientSide())return;
|
||||||
|
|
||||||
ServerPlayer sp = (ServerPlayer)ev.getPlayer();
|
ServerPlayer sp = (ServerPlayer)ev.getPlayer();
|
||||||
ItemStack itemUsed = sp.getItemInHand(InteractionHand.MAIN_HAND);
|
ItemStack itemUsed = sp.getItemInHand(InteractionHand.MAIN_HAND);
|
||||||
|
@ -55,7 +55,7 @@ public class LoreHandlers {
|
||||||
public void onBlock(BlockEvent.BlockToolModificationEvent ev)
|
public void onBlock(BlockEvent.BlockToolModificationEvent ev)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(ev.getLevel().isClientSide())return;
|
if(ev.getWorld().isClientSide())return;
|
||||||
|
|
||||||
// Check the block right clicked, and the item in hand
|
// Check the block right clicked, and the item in hand
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class LoreHandlers {
|
||||||
public void onShears(PlayerInteractEvent.EntityInteract ev)
|
public void onShears(PlayerInteractEvent.EntityInteract ev)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(ev.getLevel().isClientSide)return;
|
if(ev.getWorld().isClientSide)return;
|
||||||
if(ev.getCancellationResult() == InteractionResult.PASS)
|
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
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.Rect2i;
|
import net.minecraft.client.renderer.Rect2i;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -32,7 +33,7 @@ public class EnergyInfoArea extends InfoArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Component> getTooltips() {
|
public List<Component> getTooltips() {
|
||||||
return List.of(Component.literal(energy.getEnergyStored()+"/"+energy.getMaxEnergyStored()+" FE"));
|
return List.of(new TextComponent(energy.getEnergyStored()+"/"+energy.getMaxEnergyStored()+" FE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
public final class ModMenuTypes
|
public final class ModMenuTypes
|
||||||
{
|
{
|
||||||
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OTEMod.MOD_ID);
|
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, OTEMod.MOD_ID);
|
||||||
|
|
||||||
public static final RegistryObject <MenuType <VaultMenu>> VAULT = CONTAINERS.register("vault", ()-> new MenuType<>(VaultMenu::new));
|
public static final RegistryObject <MenuType <VaultMenu>> VAULT = CONTAINERS.register("vault", ()-> new MenuType<>(VaultMenu::new));
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
|
|
||||||
public class ItemScrubberMenu extends AbstractContainerMenu
|
public class ItemScrubberMenu extends AbstractContainerMenu
|
||||||
|
@ -40,10 +40,10 @@ public class ItemScrubberMenu extends AbstractContainerMenu
|
||||||
addPlayerInventory(inv);
|
addPlayerInventory(inv);
|
||||||
addPlayerHotbar(inv);
|
addPlayerHotbar(inv);
|
||||||
|
|
||||||
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
|
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).ifPresent(handler->{
|
||||||
addSlot(new SlotItemHandler(handler, 0, 16, 41));
|
addSlot(new SlotItemHandler(handler, 0, 16, 41));
|
||||||
});
|
});
|
||||||
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
|
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN).ifPresent(handler->{
|
||||||
addSlot(new SlotItemHandler(handler, 0, 177, 41));
|
addSlot(new SlotItemHandler(handler, 0, 177, 41));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
|
|
||||||
public class MagicalScrubberMenu extends AbstractContainerMenu
|
public class MagicalScrubberMenu extends AbstractContainerMenu
|
||||||
|
@ -40,10 +40,10 @@ public class MagicalScrubberMenu extends AbstractContainerMenu
|
||||||
addPlayerInventory(inv);
|
addPlayerInventory(inv);
|
||||||
addPlayerHotbar(inv);
|
addPlayerHotbar(inv);
|
||||||
|
|
||||||
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
|
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).ifPresent(handler->{
|
||||||
addSlot(new SlotItemHandler(handler, 0, 16, 41));
|
addSlot(new SlotItemHandler(handler, 0, 16, 41));
|
||||||
});
|
});
|
||||||
this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
|
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN).ifPresent(handler->{
|
||||||
addSlot(new SlotItemHandler(handler, 0, 177, 41));
|
addSlot(new SlotItemHandler(handler, 0, 177, 41));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.inventory.MenuConstructor;
|
import net.minecraft.world.inventory.MenuConstructor;
|
||||||
|
@ -72,7 +73,7 @@ public class VaultContainer
|
||||||
{
|
{
|
||||||
if(VAULT_NUMBER == -1)return; // We have no need to save the trash
|
if(VAULT_NUMBER == -1)return; // We have no need to save the trash
|
||||||
CompoundTag saved = myInventory.serializeNBT();
|
CompoundTag saved = myInventory.serializeNBT();
|
||||||
ChatServerOverride.broadcastToAbove(owner, Component.literal(ChatColor.BOLD+ChatColor.DARK_GREEN+"Saving the vault's contents..."), server);
|
ChatServerOverride.broadcastToAbove(owner, new TextComponent(ChatColor.BOLD+ChatColor.DARK_GREEN+"Saving the vault's contents..."), server);
|
||||||
|
|
||||||
String toSave= NbtUtils.structureToSnbt(saved);
|
String toSave= NbtUtils.structureToSnbt(saved);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.client.gui.font.TextFieldHelper;
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
@ -69,13 +70,13 @@ public class VaultScreen extends AbstractContainerScreen <VaultMenu>
|
||||||
super.init();
|
super.init();
|
||||||
// This is where custom controls would be added!
|
// This is where custom controls would be added!
|
||||||
|
|
||||||
this.addWidget(new Button(this.leftPos+7,this.topPos+84,16,16,Component.literal(""), (button)->{
|
this.addWidget(new Button(this.leftPos+7,this.topPos+84,16,16,new TextComponent(""), (button)->{
|
||||||
thePlayer.closeContainer();
|
thePlayer.closeContainer();
|
||||||
|
|
||||||
ModMessages.sendToServer(new OpenVaultC2SPacket(0,true,-1));
|
ModMessages.sendToServer(new OpenVaultC2SPacket(0,true,-1));
|
||||||
} ));
|
} ));
|
||||||
|
|
||||||
this.addWidget(new Button(this.leftPos+187,this.topPos+84,16,16,Component.literal(""), (button)->{
|
this.addWidget(new Button(this.leftPos+187,this.topPos+84,16,16,new TextComponent(""), (button)->{
|
||||||
thePlayer.closeContainer();
|
thePlayer.closeContainer();
|
||||||
ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, 1));
|
ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, 1));
|
||||||
} ));
|
} ));
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
package dev.zontreck.otemod.integrations;
|
package dev.zontreck.otemod.integrations;
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
import net.minecraftforge.client.settings.KeyConflictContext;
|
import net.minecraftforge.client.ClientRegistry;
|
||||||
|
|
||||||
public class KeyBindings {
|
public class KeyBindings {
|
||||||
public static final String KEY_CATEGORY_OTEMOD = "key.category.otemod";
|
public static final String KEY_CATEGORY_OTEMOD = "key.category.otemod";
|
||||||
public static final String KEY_OPEN_VAULT = "key.otemod.open_vault";
|
public static final String KEY_OPEN_VAULT = "key.otemod.open_vault";
|
||||||
|
|
||||||
public static final KeyMapping OPEN_VAULT = new KeyMapping(KEY_OPEN_VAULT, KeyConflictContext.IN_GAME, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_V, KEY_CATEGORY_OTEMOD);
|
public static final KeyMapping OPEN_VAULT = registerKeyMapping(KEY_OPEN_VAULT, InputConstants.KEY_V | InputConstants.KEY_LSHIFT, KEY_CATEGORY_OTEMOD);
|
||||||
|
|
||||||
|
private static KeyMapping registerKeyMapping(String name, int keycode, String category){
|
||||||
|
final KeyMapping key = new KeyMapping(name, keycode, category);
|
||||||
|
ClientRegistry.registerKeyBinding(key);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import dev.zontreck.libzontreck.chat.ChatColor;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
@ -34,6 +35,6 @@ public class LuckPermsHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendNoPermissionsMessage(ServerPlayer play, String perm, String group) {
|
public static void sendNoPermissionsMessage(ServerPlayer play, String perm, String group) {
|
||||||
ChatServerOverride.broadcastTo(play.getUUID(), Component.literal(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);
|
ChatServerOverride.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,13 @@ public class ModMessages {
|
||||||
net.messageBuilder(OpenVaultC2SPacket.class, id(), NetworkDirection.PLAY_TO_SERVER)
|
net.messageBuilder(OpenVaultC2SPacket.class, id(), NetworkDirection.PLAY_TO_SERVER)
|
||||||
.decoder(OpenVaultC2SPacket::new)
|
.decoder(OpenVaultC2SPacket::new)
|
||||||
.encoder(OpenVaultC2SPacket::toBytes)
|
.encoder(OpenVaultC2SPacket::toBytes)
|
||||||
.consumerMainThread(OpenVaultC2SPacket::handle)
|
.consumer(OpenVaultC2SPacket::handle)
|
||||||
.add();
|
.add();
|
||||||
|
|
||||||
net.messageBuilder(EnergySyncS2CPacket.class, id(), NetworkDirection.PLAY_TO_CLIENT)
|
net.messageBuilder(EnergySyncS2CPacket.class, id(), NetworkDirection.PLAY_TO_CLIENT)
|
||||||
.decoder(EnergySyncS2CPacket::new)
|
.decoder(EnergySyncS2CPacket::new)
|
||||||
.encoder(EnergySyncS2CPacket::toBytes)
|
.encoder(EnergySyncS2CPacket::toBytes)
|
||||||
.consumerMainThread(EnergySyncS2CPacket::handle)
|
.consumer(EnergySyncS2CPacket::handle)
|
||||||
.add();
|
.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.ListIterator;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
import dev.zontreck.libzontreck.exceptions.InvalidSideException;
|
||||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -75,7 +76,13 @@ public class BlockContainerList {
|
||||||
storedBlock.tick();
|
storedBlock.tick();
|
||||||
if(storedBlock.isExpired()){
|
if(storedBlock.isExpired()){
|
||||||
WorldPosition wp = storedBlock.getWorldPosition();
|
WorldPosition wp = storedBlock.getWorldPosition();
|
||||||
BlockState bs = wp.getActualDimension().getBlockState(wp.Position.asBlockPos());
|
BlockState bs=null;
|
||||||
|
try {
|
||||||
|
bs = wp.getActualDimension().getBlockState(wp.Position.asBlockPos());
|
||||||
|
} catch (InvalidSideException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if(bs.is(storedBlock.getState().getBlock()) || storedBlock.getTries() >= OTEServerConfig.MAX_TRIES_HEAL.get())
|
if(bs.is(storedBlock.getState().getBlock()) || storedBlock.getTries() >= OTEServerConfig.MAX_TRIES_HEAL.get())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraftforge.event.TickEvent;
|
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.server.ServerStoppingEvent;
|
||||||
|
import net.minecraftforge.event.world.ExplosionEvent;
|
||||||
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class EventHandler {
|
public class EventHandler {
|
||||||
|
@ -18,17 +18,17 @@ public class EventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onDetonate(ExplosionEvent.Detonate ev)
|
public void onDetonate(ExplosionEvent.Detonate ev)
|
||||||
{
|
{
|
||||||
if(ev.getLevel().isClientSide)return;
|
if(ev.getWorld().isClientSide)return;
|
||||||
|
|
||||||
//Entity explodes = ev.getExplosion().getSourceMob();
|
//Entity explodes = ev.getExplosion().getSourceMob();
|
||||||
// Register blocks to be healed
|
// Register blocks to be healed
|
||||||
WorldPosition wpos = new WorldPosition(new Vector3(ev.getExplosion().getPosition()), (ServerLevel) ev.getLevel());
|
WorldPosition wpos = new WorldPosition(new Vector3(ev.getExplosion().getPosition()), (ServerLevel) ev.getWorld());
|
||||||
|
|
||||||
if(OTEServerConfig.EXCLUDE_DIMS.get().contains(wpos.Dimension)){
|
if(OTEServerConfig.EXCLUDE_DIMS.get().contains(wpos.Dimension)){
|
||||||
// Dimension is on the exclusion list. Do not process.
|
// Dimension is on the exclusion list. Do not process.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WorldProp wp = WorldProp.acquire((ServerLevel)ev.getLevel());
|
WorldProp wp = WorldProp.acquire((ServerLevel)ev.getWorld());
|
||||||
|
|
||||||
if(wp!=null){
|
if(wp!=null){
|
||||||
wp.onDetonate(ev);
|
wp.onDetonate(ev);
|
||||||
|
@ -44,21 +44,21 @@ public class EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLoadLevel(LevelEvent.Load ev)
|
public void onLoadLevel(WorldEvent.Load ev)
|
||||||
{
|
{
|
||||||
if(!ev.getLevel().isClientSide() && ev.getLevel() instanceof ServerLevel)
|
if(!ev.getWorld().isClientSide() && ev.getWorld() instanceof ServerLevel)
|
||||||
{
|
{
|
||||||
healers.put((ServerLevel)ev.getLevel(), WorldProp.acquire((ServerLevel)ev.getLevel()));
|
healers.put((ServerLevel)ev.getWorld(), WorldProp.acquire((ServerLevel)ev.getWorld()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onUnload(LevelEvent.Unload ev)
|
public void onUnload(WorldEvent.Unload ev)
|
||||||
{
|
{
|
||||||
if(!ev.getLevel().isClientSide())
|
if(!ev.getWorld().isClientSide())
|
||||||
{
|
{
|
||||||
healers.remove(ev.getLevel());
|
healers.remove(ev.getWorld());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,16 +69,16 @@ public class EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onSaving(LevelEvent.Save ev)
|
public void onSaving(WorldEvent.Save ev)
|
||||||
{
|
{
|
||||||
WorldProp.SaveAll();
|
WorldProp.SaveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLevelTick(TickEvent.LevelTickEvent ev)
|
public void onLevelTick(TickEvent.WorldTickEvent ev)
|
||||||
{
|
{
|
||||||
if(!ev.level.isClientSide){
|
if(!ev.world.isClientSide){
|
||||||
WorldProp wp = WorldProp.acquire((ServerLevel)ev.level);
|
WorldProp wp = WorldProp.acquire((ServerLevel)ev.world);
|
||||||
if(wp!=null){
|
if(wp!=null){
|
||||||
wp.onTick();
|
wp.onTick();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package dev.zontreck.otemod.zschem;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import dev.zontreck.libzontreck.exceptions.InvalidSideException;
|
||||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
@ -23,7 +24,12 @@ public class HealRunner implements Runnable
|
||||||
BlockToSet = sb;
|
BlockToSet = sb;
|
||||||
}
|
}
|
||||||
public static void scheduleHeal(StoredBlock sb){
|
public static void scheduleHeal(StoredBlock sb){
|
||||||
sb.getWorldPosition().getActualDimension().getServer().execute(new HealRunner(sb));
|
try {
|
||||||
|
sb.getWorldPosition().getActualDimension().getServer().execute(new HealRunner(sb));
|
||||||
|
} catch (InvalidSideException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -32,7 +38,14 @@ public class HealRunner implements Runnable
|
||||||
//BlockSnapshot bs = BlockSnapshot.create(level.dimension(), level, sb.getPos());
|
//BlockSnapshot bs = BlockSnapshot.create(level.dimension(), level, sb.getPos());
|
||||||
|
|
||||||
//BlockState current = level.getBlockState(sb.getPos());
|
//BlockState current = level.getBlockState(sb.getPos());
|
||||||
final ServerLevel level = BlockToSet.getWorldPosition().getActualDimension();
|
ServerLevel level=null;
|
||||||
|
try {
|
||||||
|
level = (ServerLevel) BlockToSet.getWorldPosition().getActualDimension();
|
||||||
|
} catch (InvalidSideException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BlockState nState = Block.updateFromNeighbourShapes(BlockToSet.getState(), level, BlockToSet.getPos());
|
BlockState nState = Block.updateFromNeighbourShapes(BlockToSet.getState(), level, BlockToSet.getPos());
|
||||||
level.setBlock(BlockToSet.getPos(), nState, Block.UPDATE_CLIENTS); // no update?
|
level.setBlock(BlockToSet.getPos(), nState, Block.UPDATE_CLIENTS); // no update?
|
||||||
|
|
|
@ -14,6 +14,7 @@ import dev.zontreck.libzontreck.vectors.Vector3;
|
||||||
import dev.zontreck.otemod.OTEMod;
|
import dev.zontreck.otemod.OTEMod;
|
||||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ public class MemoryHolder {
|
||||||
if(c.isExpired()){
|
if(c.isExpired()){
|
||||||
imeuc.remove();
|
imeuc.remove();
|
||||||
|
|
||||||
ChatServerOverride.broadcastTo(entry.getKey(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!ZSchem Session expired")), c.lvl.getServer());
|
ChatServerOverride.broadcastTo(entry.getKey(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!ZSchem Session expired")), c.lvl.getServer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}finally{
|
}finally{
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.event.level.ExplosionEvent;
|
import net.minecraftforge.event.world.ExplosionEvent;
|
||||||
|
|
||||||
public class WorldProp implements Supplier<Object>
|
public class WorldProp implements Supplier<Object>
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ public class WorldProp implements Supplier<Object>
|
||||||
|
|
||||||
public void onDetonate(ExplosionEvent.Detonate ev)
|
public void onDetonate(ExplosionEvent.Detonate ev)
|
||||||
{
|
{
|
||||||
Level w = ev.getLevel();
|
Level w = ev.getWorld();
|
||||||
//int maxTicks = 0;
|
//int maxTicks = 0;
|
||||||
|
|
||||||
for(BlockPos p : ev.getAffectedBlocks())
|
for(BlockPos p : ev.getAffectedBlocks())
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||||
modLoader="javafml" #mandatory
|
modLoader="javafml" #mandatory
|
||||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||||
loaderVersion="[43,]" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
loaderVersion="[40,]" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
license="GPL 2.0"
|
license="GPL 2.0"
|
||||||
|
@ -19,7 +19,7 @@ modId="otemod" #mandatory
|
||||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||||
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||||
# see the associated build.gradle script for how to populate this completely automatically during a build
|
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||||
version="1.3.7.2" #mandatory
|
version="1.3.7.3" #mandatory
|
||||||
# A display name for the mod
|
# A display name for the mod
|
||||||
displayName="OTEMod" #mandatory
|
displayName="OTEMod" #mandatory
|
||||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||||
|
@ -40,7 +40,7 @@ This mod is a work in progress and is planned to add a procedural adventure syst
|
||||||
# Does this dependency have to exist - if not, ordering below must be specified
|
# Does this dependency have to exist - if not, ordering below must be specified
|
||||||
mandatory=true #mandatory
|
mandatory=true #mandatory
|
||||||
# The version range of the dependency
|
# The version range of the dependency
|
||||||
versionRange="[43,]" #mandatory
|
versionRange="[40,]" #mandatory
|
||||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||||
|
@ -50,12 +50,12 @@ This mod is a work in progress and is planned to add a procedural adventure syst
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||||
versionRange="[1.19.2,]"
|
versionRange="[1.18.2,1.19]"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
[[dependencies.otemod]]
|
[[dependencies.otemod]]
|
||||||
modId="libzontreck"
|
modId="libzontreck"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[1.0.3.7,]"
|
versionRange="[1.0.4.9,1.0.5.0]"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"pack": {
|
"pack": {
|
||||||
"description": "OTEMod",
|
"description": "OTEMod",
|
||||||
"pack_format": 10
|
"pack_format": 9
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue