Finish implementing creeperheal.
This commit is contained in:
parent
2d525f3c7f
commit
1ada902c26
7 changed files with 104 additions and 63 deletions
|
@ -3,7 +3,7 @@
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
libzontreck=1201.13.042424.0415
|
libzontreck=1201.13.042524.0527
|
||||||
|
|
||||||
## Environment Properties
|
## Environment Properties
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ mod_name=Aria's Essentials
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1201.2.041224.0854
|
mod_version=1201.2.042524.0537
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
|
|
||||||
|
import dev.zontreck.essentials.antiexplode.CreeperHealQueue;
|
||||||
import dev.zontreck.essentials.blocks.ModBlocks;
|
import dev.zontreck.essentials.blocks.ModBlocks;
|
||||||
import dev.zontreck.essentials.client.Keybindings;
|
import dev.zontreck.essentials.client.Keybindings;
|
||||||
import dev.zontreck.essentials.client.renderer.TimeBoostEntityRenderer;
|
import dev.zontreck.essentials.client.renderer.TimeBoostEntityRenderer;
|
||||||
|
@ -16,6 +17,7 @@ import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
||||||
import dev.zontreck.essentials.configs.client.AEClientConfig;
|
import dev.zontreck.essentials.configs.client.AEClientConfig;
|
||||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||||
import dev.zontreck.essentials.entities.ModEntities;
|
import dev.zontreck.essentials.entities.ModEntities;
|
||||||
|
import dev.zontreck.essentials.events.MainEventHandlers;
|
||||||
import dev.zontreck.essentials.events.TeleportEvent;
|
import dev.zontreck.essentials.events.TeleportEvent;
|
||||||
import dev.zontreck.essentials.client.renderer.HeartsRenderer;
|
import dev.zontreck.essentials.client.renderer.HeartsRenderer;
|
||||||
import dev.zontreck.essentials.imc.Events;
|
import dev.zontreck.essentials.imc.Events;
|
||||||
|
@ -26,16 +28,26 @@ import dev.zontreck.essentials.rtp.RTPCaches;
|
||||||
import dev.zontreck.essentials.rtp.RTPCachesEventHandlers;
|
import dev.zontreck.essentials.rtp.RTPCachesEventHandlers;
|
||||||
import dev.zontreck.essentials.util.BackPositionCaches;
|
import dev.zontreck.essentials.util.BackPositionCaches;
|
||||||
import dev.zontreck.essentials.util.CommandCooldowns;
|
import dev.zontreck.essentials.util.CommandCooldowns;
|
||||||
|
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueue;
|
||||||
|
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueueRegistry;
|
||||||
|
import dev.zontreck.libzontreck.memory.world.SavedBlock;
|
||||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||||
|
import dev.zontreck.libzontreck.util.SNbtIo;
|
||||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||||
|
import dev.zontreck.libzontreck.vectors.Vector3i;
|
||||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.NbtUtils;
|
||||||
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;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
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.RegisterKeyMappingsEvent;
|
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
|
import net.minecraftforge.event.level.ExplosionEvent;
|
||||||
import net.minecraftforge.eventbus.api.EventPriority;
|
import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -63,7 +75,7 @@ public class AriasEssentials {
|
||||||
public static boolean ALIVE;
|
public static boolean ALIVE;
|
||||||
public static Map<UUID, Homes> player_homes = new HashMap<>();
|
public static Map<UUID, Homes> player_homes = new HashMap<>();
|
||||||
public static boolean DEBUG = true;
|
public static boolean DEBUG = true;
|
||||||
public static ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
public static ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,8 +84,10 @@ public class AriasEssentials {
|
||||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
bus.addListener(this::setup);
|
bus.addListener(this::setup);
|
||||||
|
|
||||||
|
LOGGER.info("/!\\ Loading Aria's Essentials Configuration Files /!\\");
|
||||||
AEServerConfig.loadFromFile();
|
AEServerConfig.loadFromFile();
|
||||||
AEClientConfig.loadFromFile();
|
AEClientConfig.loadFromFile();
|
||||||
|
LOGGER.info("/!\\ DONE LOADING AECONFIG /!\\");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,6 +100,7 @@ public class AriasEssentials {
|
||||||
MinecraftForge.EVENT_BUS.register(new CommandCooldowns());
|
MinecraftForge.EVENT_BUS.register(new CommandCooldowns());
|
||||||
MinecraftForge.EVENT_BUS.register(RTPCachesEventHandlers.class);
|
MinecraftForge.EVENT_BUS.register(RTPCachesEventHandlers.class);
|
||||||
MinecraftForge.EVENT_BUS.register(Events.class);
|
MinecraftForge.EVENT_BUS.register(Events.class);
|
||||||
|
MinecraftForge.EVENT_BUS.register(MainEventHandlers.class);
|
||||||
|
|
||||||
ModItems.register(bus);
|
ModItems.register(bus);
|
||||||
ModBlocks.register(bus);
|
ModBlocks.register(bus);
|
||||||
|
@ -93,6 +108,7 @@ public class AriasEssentials {
|
||||||
CreativeModeTabs.register(bus);
|
CreativeModeTabs.register(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTeleport(TeleportEvent event)
|
public void onTeleport(TeleportEvent event)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +131,9 @@ public class AriasEssentials {
|
||||||
public void onServerStart(final ServerStartedEvent ev)
|
public void onServerStart(final ServerStartedEvent ev)
|
||||||
{
|
{
|
||||||
ALIVE=true;
|
ALIVE=true;
|
||||||
|
// Print out the server config
|
||||||
|
|
||||||
|
LOGGER.debug(NbtUtils.structureToSnbt(AEServerConfig.getInstance().serialize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package dev.zontreck.essentials.antiexplode;
|
package dev.zontreck.essentials.antiexplode;
|
||||||
|
|
||||||
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueue;
|
import dev.zontreck.essentials.AriasEssentials;
|
||||||
import dev.zontreck.libzontreck.memory.world.PrimitiveBlock;
|
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||||
import dev.zontreck.libzontreck.memory.world.SortedBlockQueue;
|
import dev.zontreck.libzontreck.memory.world.*;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class CreeperHealQueue extends BlockRestoreQueue
|
public class CreeperHealQueue extends BlockRestoreQueue
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRestoreQueueName() {
|
public String getRestoreQueueName() {
|
||||||
return "creeperheal";
|
return "creeperheal";
|
||||||
|
@ -18,6 +23,7 @@ public class CreeperHealQueue extends BlockRestoreQueue
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void databaseUpdate(PrimitiveBlock block) {
|
public void databaseUpdate(PrimitiveBlock block) {
|
||||||
|
if(Blocks.AIR == block.blockType) return; // Do not cache air
|
||||||
super.databaseUpdate(block);
|
super.databaseUpdate(block);
|
||||||
notifyDirtyQueue(true);
|
notifyDirtyQueue(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.zontreck.essentials.configs.server;
|
package dev.zontreck.essentials.configs.server;
|
||||||
|
|
||||||
import dev.zontreck.ariaslib.util.Lists;
|
import dev.zontreck.ariaslib.util.Lists;
|
||||||
|
import dev.zontreck.essentials.AriasEssentials;
|
||||||
import dev.zontreck.essentials.configs.server.sections.*;
|
import dev.zontreck.essentials.configs.server.sections.*;
|
||||||
import dev.zontreck.essentials.util.EssentialsDatastore;
|
import dev.zontreck.essentials.util.EssentialsDatastore;
|
||||||
import dev.zontreck.essentials.util.Maps;
|
import dev.zontreck.essentials.util.Maps;
|
||||||
|
@ -29,26 +30,33 @@ public class AEServerConfig
|
||||||
public static AEServerConfig deserialize(CompoundTag tag)
|
public static AEServerConfig deserialize(CompoundTag tag)
|
||||||
{
|
{
|
||||||
AEServerConfig config = new AEServerConfig();
|
AEServerConfig config = new AEServerConfig();
|
||||||
config.costs = Costs.deserialize(tag.getCompound(Costs.TAG_NAME));
|
try {
|
||||||
config.limits = Limitations.deserialize(tag.getCompound(Limitations.TAG_NAME));
|
AriasEssentials.LOGGER.info("Loading Aria's Essentials configuration for - Server");
|
||||||
config.cooldowns = new HashMap<>();
|
config.costs = Costs.deserialize(tag.getCompound(Costs.TAG_NAME));
|
||||||
ListTag cools = tag.getList(Cooldown.TAG_NAME, ListTag.TAG_COMPOUND);
|
config.limits = Limitations.deserialize(tag.getCompound(Limitations.TAG_NAME));
|
||||||
for(Tag cooldown : cools)
|
config.cooldowns = new HashMap<>();
|
||||||
{
|
ListTag cools = tag.getList(Cooldown.TAG_NAME, ListTag.TAG_COMPOUND);
|
||||||
Cooldown cd = Cooldown.deserialize((CompoundTag) cooldown);
|
for(Tag cooldown : cools)
|
||||||
config.cooldowns.put(cd.Command, cd);
|
{
|
||||||
}
|
Cooldown cd = Cooldown.deserialize((CompoundTag) cooldown);
|
||||||
config.back = Back.deserialize(tag.getCompound(Back.TAG_NAME));
|
config.cooldowns.put(cd.Command, cd);
|
||||||
config.teleport = Teleportation.deserialize(tag.getCompound(Teleportation.TAG_NAME));
|
}
|
||||||
config.messages = Messages.deserialize(tag.getCompound(Messages.TAG_NAME));
|
config.back = Back.deserialize(tag.getCompound(Back.TAG_NAME));
|
||||||
if(tag.contains(Bottles.TAG_NAME))
|
config.teleport = Teleportation.deserialize(tag.getCompound(Teleportation.TAG_NAME));
|
||||||
{
|
config.messages = Messages.deserialize(tag.getCompound(Messages.TAG_NAME));
|
||||||
config.bottles = Bottles.deserialize(tag.getCompound(Bottles.TAG_NAME));
|
if(tag.contains(Bottles.TAG_NAME))
|
||||||
} else config.bottles = new Bottles();
|
{
|
||||||
|
config.bottles = Bottles.deserialize(tag.getCompound(Bottles.TAG_NAME));
|
||||||
|
} else config.bottles = new Bottles();
|
||||||
|
|
||||||
if(tag.contains(CreeperHeal.TAG_NAME))
|
if(tag.contains(CreeperHeal.TAG_NAME))
|
||||||
{
|
{
|
||||||
config.creeperHeal = CreeperHeal.deserialize(tag.getCompound(CreeperHeal.TAG_NAME));
|
config.creeperHeal = CreeperHeal.deserialize(tag.getCompound(CreeperHeal.TAG_NAME));
|
||||||
|
} else config.creeperHeal = new CreeperHeal();
|
||||||
|
|
||||||
|
AriasEssentials.LOGGER.info("Aria's Essentials Server Configuration Loaded");
|
||||||
|
} catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +65,7 @@ public class AEServerConfig
|
||||||
|
|
||||||
public static void loadFromFile()
|
public static void loadFromFile()
|
||||||
{
|
{
|
||||||
Path serverConfig = EssentialsDatastore.of("server.snbt");
|
Path serverConfig = EssentialsDatastore.of("server.snbt",false);
|
||||||
if(serverConfig.toFile().exists())
|
if(serverConfig.toFile().exists())
|
||||||
{
|
{
|
||||||
inst = deserialize(SNbtIo.loadSnbt(serverConfig));
|
inst = deserialize(SNbtIo.loadSnbt(serverConfig));
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package dev.zontreck.essentials.configs.server.sections;
|
package dev.zontreck.essentials.configs.server.sections;
|
||||||
|
|
||||||
|
import dev.zontreck.ariaslib.util.Lists;
|
||||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||||
|
import dev.zontreck.libzontreck.util.TagUtils;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
|
@ -13,22 +15,16 @@ public class CreeperHeal
|
||||||
{
|
{
|
||||||
public static final String TAG_NAME = "creeper_heal";
|
public static final String TAG_NAME = "creeper_heal";
|
||||||
public static final String TAG_BLACKLIST = "blacklisted_dims";
|
public static final String TAG_BLACKLIST = "blacklisted_dims";
|
||||||
public static final String TAG_VERSION = "version";
|
|
||||||
public static final String TAG_DURATION = "duration";
|
public static final String TAG_DURATION = "duration";
|
||||||
|
|
||||||
|
|
||||||
public List<String> blacklistedDimensions = new ArrayList<>();
|
public List<String> blacklistedDimensions = Lists.of("minecraft:the_nether", "minecraft:the_end");
|
||||||
public int version = 0;
|
|
||||||
|
|
||||||
public int duration = 40; // Once every 2 seconds
|
public int duration = 40; // Once every 2 seconds
|
||||||
|
|
||||||
|
|
||||||
public static final int VERSION = 1;
|
|
||||||
|
|
||||||
public CompoundTag serialize()
|
public CompoundTag serialize()
|
||||||
{
|
{
|
||||||
CompoundTag tag = new CompoundTag();
|
CompoundTag tag = new CompoundTag();
|
||||||
tag.putInt(TAG_VERSION, version);
|
|
||||||
ListTag blacklist = new ListTag();
|
ListTag blacklist = new ListTag();
|
||||||
for(String dimension : blacklistedDimensions)
|
for(String dimension : blacklistedDimensions)
|
||||||
{
|
{
|
||||||
|
@ -43,22 +39,13 @@ public class CreeperHeal
|
||||||
public static CreeperHeal deserialize(CompoundTag tag)
|
public static CreeperHeal deserialize(CompoundTag tag)
|
||||||
{
|
{
|
||||||
CreeperHeal heal = new CreeperHeal();
|
CreeperHeal heal = new CreeperHeal();
|
||||||
heal.version = tag.getInt(TAG_VERSION);
|
heal.duration = TagUtils.intOr(tag, TAG_DURATION, 40);
|
||||||
|
|
||||||
if(heal.version == 0){
|
ListTag lst = tag.getList(TAG_BLACKLIST, StringTag.TAG_STRING);
|
||||||
heal.version = VERSION;
|
heal.blacklistedDimensions.clear();
|
||||||
return heal;
|
for(Tag t : lst)
|
||||||
}
|
|
||||||
|
|
||||||
if(heal.version >= 1)
|
|
||||||
{
|
{
|
||||||
|
heal.blacklistedDimensions.add(t.getAsString());
|
||||||
ListTag lst = tag.getList(TAG_BLACKLIST, StringTag.TAG_STRING);
|
|
||||||
for(Tag t : lst)
|
|
||||||
{
|
|
||||||
heal.blacklistedDimensions.add(t.getAsString());
|
|
||||||
}
|
|
||||||
heal.duration = tag.getInt(TAG_DURATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return heal;
|
return heal;
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package dev.zontreck.essentials.events;
|
||||||
|
|
||||||
|
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||||
|
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueue;
|
||||||
|
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueueRegistry;
|
||||||
|
import dev.zontreck.libzontreck.memory.world.SavedBlock;
|
||||||
|
import dev.zontreck.libzontreck.vectors.Vector3i;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraftforge.event.level.ExplosionEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class MainEventHandlers
|
||||||
|
{
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onExplosionEvent(ExplosionEvent event)
|
||||||
|
{
|
||||||
|
for(BlockPos pos : event.getExplosion().getToBlow())
|
||||||
|
{
|
||||||
|
SavedBlock sb = SavedBlock.takeSnapshot(new Vector3i(pos), event.getLevel());
|
||||||
|
|
||||||
|
BlockRestoreQueue queue = BlockRestoreQueueRegistry.getQueue("creeperheal");
|
||||||
|
queue.enqueueBlock(sb);
|
||||||
|
|
||||||
|
event.getLevel().removeBlockEntity(pos);
|
||||||
|
event.getLevel().setBlock(pos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import dev.zontreck.essentials.antiexplode.CreeperHealQueue;
|
||||||
import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
||||||
import dev.zontreck.essentials.commands.teleport.TeleportContainer;
|
import dev.zontreck.essentials.commands.teleport.TeleportContainer;
|
||||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||||
|
import dev.zontreck.essentials.util.BackPositionCaches;
|
||||||
import dev.zontreck.libzontreck.config.ServerConfig;
|
import dev.zontreck.libzontreck.config.ServerConfig;
|
||||||
import dev.zontreck.libzontreck.events.BlockRestoreQueueRegistrationEvent;
|
import dev.zontreck.libzontreck.events.BlockRestoreQueueRegistrationEvent;
|
||||||
import dev.zontreck.libzontreck.events.TeleportEvent;
|
import dev.zontreck.libzontreck.events.TeleportEvent;
|
||||||
|
@ -14,6 +15,8 @@ import dev.zontreck.libzontreck.memory.world.BlockRestoreRunner;
|
||||||
import dev.zontreck.libzontreck.memory.world.SavedBlock;
|
import dev.zontreck.libzontreck.memory.world.SavedBlock;
|
||||||
import dev.zontreck.libzontreck.vectors.Vector3i;
|
import dev.zontreck.libzontreck.vectors.Vector3i;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraftforge.event.level.ExplosionEvent;
|
import net.minecraftforge.event.level.ExplosionEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
@ -33,7 +36,6 @@ public class Events
|
||||||
TeleportContainer container = new TeleportContainer(ev.getPlayer(), ev.getPosition().Position.asMinecraftVector(), Vec2.ZERO, ev.getPosition().getActualDimension());
|
TeleportContainer container = new TeleportContainer(ev.getPlayer(), ev.getPosition().Position.asMinecraftVector(), Vec2.ZERO, ev.getPosition().getActualDimension());
|
||||||
|
|
||||||
TeleportActioner.PerformTeleport(container, false);
|
TeleportActioner.PerformTeleport(container, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@ -41,21 +43,7 @@ public class Events
|
||||||
{
|
{
|
||||||
CreeperHealQueue queue = new CreeperHealQueue();
|
CreeperHealQueue queue = new CreeperHealQueue();
|
||||||
event.register(queue);
|
event.register(queue);
|
||||||
|
queue.schedule(AEServerConfig.getInstance().creeperHeal.duration * 50L, TimeUnit.MILLISECONDS);
|
||||||
BlockRestoreRunner runner = new BlockRestoreRunner(queue);
|
|
||||||
AriasEssentials.executorService.scheduleAtFixedRate(runner, 0, AEServerConfig.getInstance().creeperHeal.duration * 1000 / 20, TimeUnit.MILLISECONDS);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void onExplosionEvent(ExplosionEvent.Detonate event)
|
|
||||||
{
|
|
||||||
for(BlockPos pos : event.getAffectedBlocks())
|
|
||||||
{
|
|
||||||
SavedBlock sb = SavedBlock.takeSnapshot(new Vector3i(pos), event.getLevel());
|
|
||||||
|
|
||||||
BlockRestoreQueue queue = BlockRestoreQueueRegistry.getQueue("creeperheal");
|
|
||||||
queue.enqueueBlock(sb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue