Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ef1d760ed | ||
|
|
70be6418e0 | ||
|
|
9d779a4879 | ||
|
|
f23495ecdd | ||
|
|
89b81a3288 |
No files matched your search
+10
-6
@@ -9,6 +9,7 @@ import io.github.togar2.pvp.events.FinalAttackEvent;
|
|||||||
import io.github.togar2.pvp.events.PrepareAttackEvent;
|
import io.github.togar2.pvp.events.PrepareAttackEvent;
|
||||||
import io.github.togar2.pvp.feature.CombatFeatures;
|
import io.github.togar2.pvp.feature.CombatFeatures;
|
||||||
import io.github.togar2.pvp.feature.knockback.KnockbackSettings;
|
import io.github.togar2.pvp.feature.knockback.KnockbackSettings;
|
||||||
|
import net.minestom.server.ServerFlag;
|
||||||
import net.minestom.server.coordinate.Pos;
|
import net.minestom.server.coordinate.Pos;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.event.instance.InstanceTickEvent;
|
import net.minestom.server.event.instance.InstanceTickEvent;
|
||||||
@@ -51,15 +52,18 @@ class HighGround extends StatelessGame {
|
|||||||
|
|
||||||
this.eventNode().addListener(
|
this.eventNode().addListener(
|
||||||
EntityKnockbackEvent.class,
|
EntityKnockbackEvent.class,
|
||||||
entityKnockbackEvent -> entityKnockbackEvent.setSettings(
|
entityKnockbackEvent -> {
|
||||||
|
double tps = ServerFlag.SERVER_TICKS_PER_SECOND;
|
||||||
|
entityKnockbackEvent.setSettings(
|
||||||
KnockbackSettings.builder()
|
KnockbackSettings.builder()
|
||||||
.horizontal(1.1)
|
.horizontal(1.1)
|
||||||
.vertical(KnockbackSettings.DEFAULT.vertical())
|
.vertical(KnockbackSettings.DEFAULT.vertical() / tps)
|
||||||
.verticalLimit(KnockbackSettings.DEFAULT.verticalLimit())
|
.verticalLimit(KnockbackSettings.DEFAULT.verticalLimit() / tps)
|
||||||
.extraHorizontal(KnockbackSettings.DEFAULT.extraHorizontal())
|
.extraHorizontal(KnockbackSettings.DEFAULT.extraHorizontal() / tps)
|
||||||
.extraVertical(KnockbackSettings.DEFAULT.extraVertical())
|
.extraVertical(KnockbackSettings.DEFAULT.extraVertical() / tps)
|
||||||
.build()
|
.build()
|
||||||
)
|
);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.eventNode().addListener(InstanceTickEvent.class, instanceTickEvent -> {
|
this.eventNode().addListener(InstanceTickEvent.class, instanceTickEvent -> {
|
||||||
|
|||||||
+1
-2
@@ -147,10 +147,10 @@ class Tetris extends StatelessGame {
|
|||||||
|
|
||||||
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
TetrisGame tetrisGame = this.tetrisGames.get(p);
|
||||||
|
|
||||||
p.teleport(tetrisGame.getPlayerSpawnPosition());
|
|
||||||
tetrisGame.sidebar.addViewer(p);
|
tetrisGame.sidebar.addViewer(p);
|
||||||
|
|
||||||
MinecraftServer.getSchedulerManager().scheduleTask(() -> {
|
MinecraftServer.getSchedulerManager().scheduleTask(() -> {
|
||||||
|
p.teleport(tetrisGame.getPlayerSpawnPosition());
|
||||||
Entity ghostBlock = new Entity(EntityType.BLOCK_DISPLAY);
|
Entity ghostBlock = new Entity(EntityType.BLOCK_DISPLAY);
|
||||||
((BlockDisplayMeta) ghostBlock.getEntityMeta()).setBlockState(Block.AIR);
|
((BlockDisplayMeta) ghostBlock.getEntityMeta()).setBlockState(Block.AIR);
|
||||||
ghostBlock.setNoGravity(true);
|
ghostBlock.setNoGravity(true);
|
||||||
@@ -159,7 +159,6 @@ class Tetris extends StatelessGame {
|
|||||||
return TaskSchedule.stop();
|
return TaskSchedule.stop();
|
||||||
}, TaskSchedule.nextTick());
|
}, TaskSchedule.nextTick());
|
||||||
|
|
||||||
|
|
||||||
return super.onPlayerJoin(p);
|
return super.onPlayerJoin(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ public class TetrisGame {
|
|||||||
int standardTickDelay = 40;
|
int standardTickDelay = 40;
|
||||||
if(this.isFast) standardTickDelay = 20;
|
if(this.isFast) standardTickDelay = 20;
|
||||||
|
|
||||||
TaskSchedule nextTick = TaskSchedule.tick(Math.round((float) standardTickDelay / this.level));
|
TaskSchedule nextTick = TaskSchedule.tick(Math.max(Math.round((float) standardTickDelay / this.level), 1));
|
||||||
if(this.paused) return nextTick;
|
if(this.paused) return nextTick;
|
||||||
this.tick();
|
this.tick();
|
||||||
return nextTick;
|
return nextTick;
|
||||||
|
|||||||
Reference in new issue
Block a user