forked from Realizedd/DE-ArenaRegen
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ include 'v1_15_R1' | |
include 'v1_16_R3' | ||
include 'v1_17_R1' | ||
include 'v1_18_R1' | ||
include 'v1_18_R2' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dependencies { | ||
implementation 'org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT' | ||
implementation project(':nms') | ||
} |
42 changes: 42 additions & 0 deletions
42
v1_18_R2/src/main/java/me/realized/de/arenaregen/nms/v1_18_R1/NMSHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package me.realized.de.arenaregen.nms.v1_18_R1; | ||
|
||
import me.realized.de.arenaregen.nms.NMS; | ||
import net.minecraft.core.BlockPosition; | ||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; | ||
import net.minecraft.world.level.World; | ||
import net.minecraft.world.level.block.state.IBlockData; | ||
import net.minecraft.world.level.chunk.Chunk; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.craftbukkit.v1_18_R2.CraftChunk; | ||
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld; | ||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer; | ||
import org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers; | ||
import org.bukkit.entity.Player; | ||
|
||
public class NMSHandler implements NMS { | ||
|
||
@Override | ||
public void sendChunkUpdate(final Player player, final org.bukkit.Chunk chunk) { | ||
final Chunk nmsChunk = ((CraftChunk) chunk).getHandle(); | ||
((CraftPlayer) player).getHandle().b.a(new ClientboundLevelChunkWithLightPacket(nmsChunk, nmsChunk.q.l_(), null, null, true)); | ||
} | ||
|
||
@Override | ||
public void setBlockFast(final Block bukkitBlock, final Material material, final int data) { | ||
final int x = bukkitBlock.getX(), y = bukkitBlock.getY(), z = bukkitBlock.getZ(); | ||
final BlockPosition position = new BlockPosition(x, y, z); | ||
final Chunk chunk = ((CraftChunk) bukkitBlock.getChunk()).getHandle(); | ||
final net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material); | ||
final IBlockData blockData = block.n(); | ||
chunk.a(position, blockData, true); | ||
} | ||
|
||
@Override | ||
public void updateLighting(Block bukkitBlock) { | ||
final int x = bukkitBlock.getX(), y = bukkitBlock.getY(), z = bukkitBlock.getZ(); | ||
final BlockPosition position = new BlockPosition(x, y, z); | ||
final World world = ((CraftWorld) bukkitBlock.getWorld()).getHandle(); | ||
world.K().n().a(position); | ||
} | ||
} |