Merge branch 'development'

This commit is contained in:
Christian Koop 2024-10-02 20:56:54 +02:00
commit 0ce5b23cc3
No known key found for this signature in database
GPG Key ID: 6A4A09E8ED946113
70 changed files with 832 additions and 1549 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-Compatibility</artifactId>

View File

@ -0,0 +1,85 @@
package com.craftaro.core.compatibility.crops;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.cryptomorin.xseries.XBlock;
import com.cryptomorin.xseries.XMaterial;
import org.bukkit.block.Block;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class CompatibleCrop {
private static final boolean USE_LEGACY_IMPLEMENTATION;
static {
boolean useLegacy = false;
try {
Class.forName("org.bukkit.block.data.Ageable");
} catch (ClassNotFoundException ignore) {
useLegacy = true;
}
USE_LEGACY_IMPLEMENTATION = useLegacy;
}
public static boolean isCrop(@Nullable Block block) {
if (block == null) {
return false;
}
XMaterial material = CompatibleMaterial.getMaterial(block.getType()).get();
return isCrop(material);
}
public static boolean isCrop(@Nullable XMaterial material) {
return material != null && XBlock.isCrop(material);
}
public static boolean isCropFullyGrown(@NotNull Block crop) {
return getCropAge(crop) >= getCropMaxAge(crop);
}
public static int getCropAge(@NotNull Block crop) {
if (!USE_LEGACY_IMPLEMENTATION) {
return CompatibleCropModern.getCropAge(crop);
}
return crop.getData();
}
public static int getCropMaxAge(@NotNull Block crop) {
if (!USE_LEGACY_IMPLEMENTATION) {
return CompatibleCropModern.getCropMaxAge(crop);
}
switch (CompatibleMaterial.getMaterial(crop.getType()).get()) {
case BEETROOTS:
case NETHER_WART:
return 3;
default:
return 7;
}
}
public static void resetCropAge(@NotNull Block crop) {
setCropAge(crop, 0);
}
public static void incrementCropAge(@NotNull Block crop) {
setCropAge(crop, getCropAge(crop) + 1);
}
private static void setCropAge(Block block, int stage) {
if (stage > getCropMaxAge(block)) {
return;
}
if (!USE_LEGACY_IMPLEMENTATION) {
CompatibleCropModern.setGrowthStage(block, stage);
return;
}
try {
Block.class.getDeclaredMethod("setData", byte.class).invoke(block, (byte) stage);
} catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
}

View File

@ -0,0 +1,23 @@
package com.craftaro.core.compatibility.crops;
import org.bukkit.block.Block;
import org.bukkit.block.data.Ageable;
import org.bukkit.block.data.BlockData;
class CompatibleCropModern {
static int getCropAge(Block block) {
BlockData blockData = block.getBlockData();
return ((Ageable) blockData).getAge();
}
static int getCropMaxAge(Block block) {
BlockData blockData = block.getBlockData();
return ((Ageable) blockData).getMaximumAge();
}
static void setGrowthStage(Block block, int stage) {
Ageable blockData = (Ageable) block.getBlockData();
blockData.setAge(stage);
block.setBlockData(blockData);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore</artifactId>

View File

@ -11,11 +11,8 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import net.kyori.adventure.title.Title;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.Plugin;
@ -25,12 +22,10 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class AdventureUtils {
private static Method displayNameMethod = null;

View File

@ -5,7 +5,6 @@ import com.craftaro.core.chat.AdventureUtils;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

View File

@ -8,7 +8,6 @@ import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -13,7 +13,6 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.LivingEntity;

View File

@ -4,16 +4,11 @@ import com.craftaro.core.SongodaCore;
import com.craftaro.core.chat.AdventureUtils;
import com.craftaro.core.chat.MiniMessagePlaceholder;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.utils.TextUtils;
import net.kyori.adventure.Adventure;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
/**
* The Message object. This holds the message to be sent
@ -138,8 +133,11 @@ public class Message {
* @return the message
*/
public List<Component> getMessageLines() {
//return Arrays.asList(ChatColor.translateAlternateColorCodes('&', this.message.toText()).split("[\n|]"));
return AdventureUtils.splitComponent(this.message, '\n');
return getMessageLines('\n');
}
public List<Component> getMessageLines(char splitChar) {
return AdventureUtils.splitComponent(this.message, splitChar);
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -1,371 +0,0 @@
package com.craftaro.core.utils;
import com.craftaro.core.SongodaCore;
import com.craftaro.core.compatibility.ClassMapping;
import com.craftaro.core.compatibility.MethodMapping;
import com.craftaro.core.compatibility.ServerVersion;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Ageable;
import org.bukkit.block.data.AnaloguePowerable;
import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Powerable;
import org.bukkit.block.data.type.Door;
import org.bukkit.block.data.type.Gate;
import org.bukkit.block.data.type.Switch;
import org.bukkit.block.data.type.TrapDoor;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @deprecated This class will be removed in the future and replaced with a more maintainable system.
*/
@Deprecated
public class BlockUtilsModern {
protected static void _updatePressurePlateModern(Block plate, int power) {
BlockData blockData = plate.getBlockData();
boolean update = false;
if (blockData instanceof AnaloguePowerable) {
AnaloguePowerable a = (AnaloguePowerable) blockData;
int toPower = Math.min(a.getMaximumPower(), power);
if ((update = toPower != a.getPower())) {
a.setPower(toPower);
plate.setBlockData(a);
}
} else if (blockData instanceof Powerable) {
Powerable p = (Powerable) blockData;
if ((update = p.isPowered() != (power != 0))) {
p.setPowered(power != 0);
plate.setBlockData(p);
}
}
if (update) {
_updateRedstoneNeighbours(plate);
}
}
protected static void _toggleLeverModern(Block lever) {
BlockData blockData = lever.getBlockData();
if (blockData instanceof Switch) {
Switch s = (Switch) blockData;
s.setPowered(!s.isPowered());
lever.setBlockData(s);
_updateRedstoneNeighbours(lever);
}
}
protected static void _pressButtonModern(Block button) {
BlockData blockData = button.getBlockData();
if (blockData instanceof Switch) {
Switch s = (Switch) blockData;
s.setPowered(true);
button.setBlockData(s);
_updateRedstoneNeighbours(button);
}
}
static void _releaseButtonModern(Block button) {
BlockData blockData = button.getBlockData();
if (blockData instanceof Switch) {
Switch s = (Switch) blockData;
s.setPowered(false);
button.setBlockData(s);
_updateRedstoneNeighbours(button);
}
}
private static Class<?> clazzCraftWorld;
private static Class<?> clazzCraftBlock;
private static Class<?> clazzLeverBlock;
private static Class<?> clazzButtonBlock;
private static Class<?> clazzPressurePlateBlock;
private static Method craftWorld_getHandle, craftBlock_getNMS, craftBlock_getPostition, craftBlockData_getState,
nmsLever_updateNeighbours, nmsButton_updateNeighbours, nmsPlate_updateNeighbours, nmsBlockData_getBlock;
static {
try {
// Cache reflection.
clazzCraftWorld = ClassMapping.CRAFT_WORLD.getClazz();
clazzCraftBlock = ClassMapping.CRAFT_BLOCK.getClazz();
craftWorld_getHandle = MethodMapping.CB_GENERIC__GET_HANDLE.getMethod(clazzCraftWorld);
craftBlock_getPostition = MethodMapping.CB_BLOCK__GET_POSITION.getMethod(clazzCraftBlock);
craftBlock_getNMS = MethodMapping.CB_BLOCK__GET_NMS.getMethod(clazzCraftBlock);
Class<?> clazzBlockData = ClassMapping.BLOCK_BASE.getClazz("BlockData");
nmsBlockData_getBlock = MethodMapping.I_BLOCK_DATA__GET_BLOCK.getMethod(clazzBlockData);
Class<?> clazzCraftBlockData = ClassMapping.CRAFT_BLOCK_DATA.getClazz();
craftBlockData_getState = MethodMapping.CB_BLOCK_DATA__GET_STATE.getMethod(clazzCraftBlockData);
Class<?> clazzWorld = ClassMapping.WORLD.getClazz();
Class<?> clazzBlockState = ClassMapping.I_BLOCK_DATA.getClazz();
Class<?> clazzBlockPos = ClassMapping.BLOCK_POSITION.getClazz();
clazzLeverBlock = ClassMapping.BLOCK_LEVER.getClazz();
clazzButtonBlock = ClassMapping.BLOCK_BUTTON_ABSTRACT.getClazz();
clazzPressurePlateBlock = ClassMapping.BLOCK_PRESSURE_PLATE_ABSTRACT.getClazz();
nmsLever_updateNeighbours = clazzLeverBlock.getDeclaredMethod(ServerVersion.isServerVersionAbove(ServerVersion.V1_13)
? "e" : "b", clazzBlockState, clazzWorld, clazzBlockPos);
nmsLever_updateNeighbours.setAccessible(true);
nmsButton_updateNeighbours = clazzButtonBlock.getDeclaredMethod(ServerVersion.isServerVersionAbove(ServerVersion.V1_13)
? "f" : "c", clazzBlockState, clazzWorld, clazzBlockPos);
nmsButton_updateNeighbours.setAccessible(true);
nmsPlate_updateNeighbours = clazzPressurePlateBlock.getDeclaredMethod("a", clazzWorld, clazzBlockPos);
nmsPlate_updateNeighbours.setAccessible(true);
} catch (Throwable ex) {
Logger.getLogger(BlockUtilsModern.class.getName()).log(Level.SEVERE, null, ex);
}
}
static void _updateRedstoneNeighbours(Block block) {
try {
// spigot made some changes to how data updates work in 1.13+
// updating the data value of a redstone power source
// does NOT update attatched block power,
// even if you update the block state. (Still broken last I checked in 1.15.2)
// so now we're going to manually call the updateNeighbours block method
// invoke and cast objects.
Object cworld = clazzCraftWorld.cast(block.getWorld());
Object mworld = craftWorld_getHandle.invoke(cworld);
Object cblock = clazzCraftBlock.cast(block);
Object mblock = nmsBlockData_getBlock.invoke(craftBlock_getNMS.invoke(cblock));
Object mpos = craftBlock_getPostition.invoke(cblock);
// now for testing stuff
if (clazzLeverBlock.isAssignableFrom(mblock.getClass())) {
final Object mstate = craftBlockData_getState.invoke(block.getBlockData());
nmsLever_updateNeighbours.invoke(mblock, mstate, mworld, mpos);
} else if (clazzButtonBlock.isAssignableFrom(mblock.getClass())) {
final Object mstate = craftBlockData_getState.invoke(block.getBlockData());
nmsButton_updateNeighbours.invoke(mblock, mstate, mworld, mpos);
} else if (clazzPressurePlateBlock.isAssignableFrom(mblock.getClass())) {
nmsPlate_updateNeighbours.invoke(mblock, mworld, mpos);
} else {
SongodaCore.getLogger().warning("Unknown redstone: " + mblock.getClass().getName());
}
//
// if(mblock instanceof net.minecraft.server.v1_15_R1.BlockLever) {
// Method updateNeighbours = net.minecraft.server.v1_15_R1.BlockLever.class.getDeclaredMethod("e", net.minecraft.server.v1_15_R1.IBlockData.class, net.minecraft.server.v1_15_R1.World.class, net.minecraft.server.v1_15_R1.BlockPosition.class);
// updateNeighbours.setAccessible(true);
// // IBlockData = block state after being powered
//
// updateNeighbours.invoke(mblock,
// ((org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData) block.getBlockData()).getState(),
// mworld,
// mpos);
// } else if(mblock instanceof net.minecraft.server.v1_15_R1.BlockButtonAbstract) {
// Method updateNeighbours = net.minecraft.server.v1_15_R1.BlockButtonAbstract.class.getDeclaredMethod("f", net.minecraft.server.v1_15_R1.IBlockData.class, net.minecraft.server.v1_15_R1.World.class, net.minecraft.server.v1_15_R1.BlockPosition.class);
// updateNeighbours.setAccessible(true);
// // IBlockData = block state after being powered
//
// updateNeighbours.invoke(mblock,
// ((org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData) block.getBlockData()).getState(),
// mworld,
// mpos);
// } else if(mblock instanceof net.minecraft.server.v1_15_R1.BlockPressurePlateAbstract) {
// Method updateNeighbours = net.minecraft.server.v1_15_R1.BlockPressurePlateAbstract.class.getDeclaredMethod("a", net.minecraft.server.v1_15_R1.World.class, net.minecraft.server.v1_15_R1.BlockPosition.class);
// updateNeighbours.setAccessible(true);
// // IBlockData = block state after being powered
//
// updateNeighbours.invoke(mblock,
// mworld,
// mpos);
// }
} catch (Throwable ex) {
Logger.getLogger(BlockUtilsModern.class.getName()).log(Level.SEVERE, null, ex);
}
}
protected static void _toggleDoorStatesModern(boolean allowDoorToOpen, Block... doors) {
for (Block door : doors) {
BlockData blockData;
if (door == null || !((blockData = door.getBlockData()) instanceof Door)) {
continue;
}
Door data = (Door) blockData;
if (!allowDoorToOpen && !data.isOpen()) {
continue;
}
// The lower half of the door contains the open/close state
if (data.getHalf() == Bisected.Half.TOP) {
Block lowerHalf = door.getRelative(BlockFace.DOWN);
if (lowerHalf.getBlockData() instanceof Door) {
Door lowerData = (Door) lowerHalf.getBlockData();
lowerData.setOpen(!data.isOpen());
lowerHalf.setBlockData(lowerData);
}
} else {
data.setOpen(!data.isOpen());
door.setBlockData(data);
}
// Play the door open/close sound
door.getWorld().playEffect(door.getLocation(), Effect.DOOR_TOGGLE, 0);
}
}
protected static Block _getDoubleDoorModern(Block block) {
BlockData bd = block.getBlockData();
Block door = null;
if (bd instanceof Door) {
final Door d = (Door) bd;
final BlockFace face = d.getFacing();
if (face.getModX() == 0) {
if (d.getHinge() == Door.Hinge.RIGHT) {
door = block.getRelative(face.getModZ(), 0, 0);
} else {
door = block.getRelative(-face.getModZ(), 0, 0);
}
} else {
if (d.getHinge() == Door.Hinge.RIGHT) {
door = block.getRelative(0, 0, -face.getModX());
} else {
door = block.getRelative(0, 0, face.getModX());
}
}
}
return door != null && door.getBlockData() instanceof Door
&& ((Door) door.getBlockData()).getHinge() != ((Door) bd).getHinge() ? door : null;
}
protected static BlockFace _getDoorClosedDirectionModern(Block door) {
if (BlockUtils.DOORS.contains(door.getType())) {
BlockData bd = door.getBlockData();
if (bd instanceof Door) {
Door d = (Door) bd;
// The lower half of the door contains the open/close state
if (d.getHalf() == Bisected.Half.TOP) {
door = door.getRelative(BlockFace.DOWN);
if (door.getBlockData() instanceof Door) {
d = (Door) door.getBlockData();
} else {
return null;
}
}
final BlockFace face = d.getFacing();
// now we /could/ also correct for the hinge (top block), it's not needed information
if (face.getModX() == 0) {
return d.isOpen() ? BlockFace.EAST : BlockFace.SOUTH;
} else {
return d.isOpen() ? BlockFace.SOUTH : BlockFace.EAST;
}
}
} else if (BlockUtils.FENCE_GATES.contains(door.getType())) {
BlockData bd = door.getBlockData();
if (bd instanceof Gate) {
Gate g = (Gate) bd;
final BlockFace face = g.getFacing();
if (face.getModX() == 0) {
return g.isOpen() ? BlockFace.EAST : BlockFace.SOUTH;
} else {
return g.isOpen() ? BlockFace.SOUTH : BlockFace.EAST;
}
}
} else if (BlockUtils.TRAP_DOORS.contains(door.getType())) {
BlockData bd = door.getBlockData();
if (bd instanceof TrapDoor) {
TrapDoor t = (TrapDoor) bd;
if (!t.isOpen()) {
return BlockFace.UP;
} else {
return t.getFacing();
}
}
}
return null;
}
protected static boolean _isCropFullyGrown(Block block) {
BlockData data = block.getBlockData();
if (data instanceof Ageable) {
return ((Ageable) data).getAge() == ((Ageable) data).getMaximumAge();
}
return false;
}
protected static int _getMaxGrowthStage(Block block) {
BlockData data = block.getBlockData();
if (data instanceof Ageable) {
return ((Ageable) data).getMaximumAge();
}
return -1;
}
protected static int _getMaxGrowthStage(Material material) {
BlockData data = material.createBlockData();
if (data instanceof Ageable) {
return ((Ageable) data).getMaximumAge();
}
return -1;
}
public static void _setGrowthStage(Block block, int stage) {
BlockData data = block.getBlockData();
if (data instanceof Ageable) {
((Ageable) data).setAge(Math.max(0, Math.min(stage, ((Ageable) data).getMaximumAge())));
block.setBlockData(data);
}
}
public static void _incrementGrowthStage(Block block) {
BlockData data = block.getBlockData();
if (data instanceof Ageable) {
final int max = ((Ageable) data).getMaximumAge();
final int age = ((Ageable) data).getAge();
if (age < max) {
((Ageable) data).setAge(age + 1);
block.setBlockData(data);
}
}
}
public static void _resetGrowthStage(Block block) {
BlockData data = block.getBlockData();
if (data instanceof Ageable) {
((Ageable) data).setAge(0);
block.setBlockData(data);
}
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-API</artifactId>

View File

@ -36,6 +36,10 @@ public interface WorldCore {
void updateAdjacentComparators(@NotNull Block bukkitBlock);
void toggleLever(@NotNull Block bukkitBlock);
void pressButton(@NotNull Block bukkitBlock);
/**
* Ticks all inactive spawners in a specific chunk ignoring the minimum required players within a specific range.<br>
* A spawner is deemed inactive if no player is within its activation range.

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_10_R1</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_10_R1.Block;
import net.minecraft.server.v1_10_R1.BlockButtonAbstract;
import net.minecraft.server.v1_10_R1.BlockLever;
import net.minecraft.server.v1_10_R1.BlockPosition;
import net.minecraft.server.v1_10_R1.Chunk;
import net.minecraft.server.v1_10_R1.ChunkSection;
@ -99,4 +101,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_11_R1</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_11_R1.Block;
import net.minecraft.server.v1_11_R1.BlockButtonAbstract;
import net.minecraft.server.v1_11_R1.BlockLever;
import net.minecraft.server.v1_11_R1.BlockPosition;
import net.minecraft.server.v1_11_R1.Chunk;
import net.minecraft.server.v1_11_R1.ChunkSection;
@ -99,4 +101,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_12_R1</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_12_R1.Block;
import net.minecraft.server.v1_12_R1.BlockButtonAbstract;
import net.minecraft.server.v1_12_R1.BlockLever;
import net.minecraft.server.v1_12_R1.BlockPosition;
import net.minecraft.server.v1_12_R1.Chunk;
import net.minecraft.server.v1_12_R1.ChunkSection;
@ -99,4 +101,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_13_R1</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_13_R1.BlockButtonAbstract;
import net.minecraft.server.v1_13_R1.BlockLever;
import net.minecraft.server.v1_13_R1.BlockPosition;
import net.minecraft.server.v1_13_R1.Chunk;
import net.minecraft.server.v1_13_R1.ChunkSection;
@ -20,6 +22,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_13_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_13_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_13_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -100,4 +103,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).interact(iBlockData, world, blockposition, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).interact(iBlockData, world, blockposition, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_13_R2</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_13_R2.BlockButtonAbstract;
import net.minecraft.server.v1_13_R2.BlockLever;
import net.minecraft.server.v1_13_R2.BlockPosition;
import net.minecraft.server.v1_13_R2.Chunk;
import net.minecraft.server.v1_13_R2.ChunkSection;
@ -20,6 +22,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_13_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_13_R2.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).interact(iBlockData, world, blockposition, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).interact(iBlockData, world, blockposition, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_14_R1</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_14_R1.BlockButtonAbstract;
import net.minecraft.server.v1_14_R1.BlockLever;
import net.minecraft.server.v1_14_R1.BlockPosition;
import net.minecraft.server.v1_14_R1.Chunk;
import net.minecraft.server.v1_14_R1.ChunkCoordIntPair;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_14_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_14_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -104,4 +107,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).interact(iBlockData, world, blockposition, null, null, null);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).interact(iBlockData, world, blockposition, null, null, null);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_15_R1</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_15_R1.BlockButtonAbstract;
import net.minecraft.server.v1_15_R1.BlockLever;
import net.minecraft.server.v1_15_R1.BlockPosition;
import net.minecraft.server.v1_15_R1.Chunk;
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_15_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_16_R1</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_16_R1.BlockButtonAbstract;
import net.minecraft.server.v1_16_R1.BlockLever;
import net.minecraft.server.v1_16_R1.BlockPosition;
import net.minecraft.server.v1_16_R1.Chunk;
import net.minecraft.server.v1_16_R1.ChunkCoordIntPair;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_16_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_16_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_16_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -108,4 +111,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_16_R2</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_16_R2.BlockButtonAbstract;
import net.minecraft.server.v1_16_R2.BlockLever;
import net.minecraft.server.v1_16_R2.BlockPosition;
import net.minecraft.server.v1_16_R2.Chunk;
import net.minecraft.server.v1_16_R2.ChunkCoordIntPair;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_16_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_16_R2.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -108,4 +111,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_16_R3</artifactId>

View File

@ -7,6 +7,8 @@ import com.craftaro.core.nms.world.SItemStack;
import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_16_R3.BlockButtonAbstract;
import net.minecraft.server.v1_16_R3.BlockLever;
import net.minecraft.server.v1_16_R3.BlockPosition;
import net.minecraft.server.v1_16_R3.Chunk;
import net.minecraft.server.v1_16_R3.ChunkCoordIntPair;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_16_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -109,4 +112,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_17_R1</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.WorldServer;
import net.minecraft.util.profiling.GameProfilerFiller;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.MobSpawnerAbstract;
import net.minecraft.world.level.block.BlockButtonAbstract;
import net.minecraft.world.level.block.BlockLever;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.Chunk;
import net.minecraft.world.level.chunk.ChunkSection;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_17_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateAdjacentComparators(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockLever) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
IBlockData iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPosition blockposition = craftBlock.getPosition();
WorldServer world = craftBlock.getCraftWorld().getHandle();
((BlockButtonAbstract) craftBlock.getNMS().getBlock()).d(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_18_R1</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_18_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -104,4 +107,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_18_R2</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_18_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -103,4 +106,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_0</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_19_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -101,4 +104,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_R1</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_19_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -101,4 +104,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_R2</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
@ -22,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_19_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_19_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -101,4 +104,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_19_R3</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
@ -23,6 +25,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_19_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -102,4 +105,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R1</artifactId>

View File

@ -13,6 +13,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
@ -24,6 +26,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_20_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R2</artifactId>

View File

@ -13,6 +13,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
@ -24,6 +26,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_20_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R3</artifactId>

View File

@ -13,6 +13,8 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
@ -24,6 +26,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_20_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_20_R4</artifactId>

View File

@ -12,6 +12,8 @@ import net.minecraft.core.SectionPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
@ -24,6 +26,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_20_R4.CraftChunk;
import org.bukkit.craftbukkit.v1_20_R4.block.CraftBlock;
import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_21_R1</artifactId>

View File

@ -14,9 +14,7 @@ import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.inventory.MenuType;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftAbstractInventoryView;
import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.v1_21_R1.inventory.view.CraftAnvilView;
import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;

View File

@ -12,6 +12,8 @@ import net.minecraft.core.SectionPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.LeverBlock;
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
@ -24,6 +26,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.v1_21_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_21_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_21_R1.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -107,4 +110,26 @@ public class WorldCoreImpl implements WorldCore {
serverLevel.updateNeighbourForOutputSignal(craftBlock.getPosition(), craftBlock.getNMS().getBlock());
}
@Override
public void toggleLever(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((LeverBlock) craftBlock.getNMS().getBlock()).pull(iBlockData, world, blockposition, null);
}
@Override
public void pressButton(@NotNull Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockState iBlockData = ((CraftBlockData) craftBlock.getBlockData()).getState();
BlockPos blockposition = craftBlock.getPosition();
ServerLevel world = craftBlock.getCraftWorld().getHandle();
((ButtonBlock) craftBlock.getNMS().getBlock()).press(iBlockData, world, blockposition, null);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_8_R1</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_8_R1.Block;
import net.minecraft.server.v1_8_R1.BlockButtonAbstract;
import net.minecraft.server.v1_8_R1.BlockLever;
import net.minecraft.server.v1_8_R1.BlockPosition;
import net.minecraft.server.v1_8_R1.Chunk;
import net.minecraft.server.v1_8_R1.ChunkSection;
@ -101,4 +103,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_8_R2</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_8_R2.Block;
import net.minecraft.server.v1_8_R2.BlockButtonAbstract;
import net.minecraft.server.v1_8_R2.BlockLever;
import net.minecraft.server.v1_8_R2.BlockPosition;
import net.minecraft.server.v1_8_R2.Chunk;
import net.minecraft.server.v1_8_R2.ChunkSection;
@ -101,4 +103,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_8_R3</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.BlockButtonAbstract;
import net.minecraft.server.v1_8_R3.BlockLever;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.Chunk;
import net.minecraft.server.v1_8_R3.ChunkSection;
@ -100,4 +102,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_9_R1</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_9_R1.Block;
import net.minecraft.server.v1_9_R1.BlockButtonAbstract;
import net.minecraft.server.v1_9_R1.BlockLever;
import net.minecraft.server.v1_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.Chunk;
import net.minecraft.server.v1_9_R1.ChunkSection;
@ -100,4 +102,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS-v1_9_R2</artifactId>

View File

@ -8,6 +8,8 @@ import com.craftaro.core.nms.world.SSpawner;
import com.craftaro.core.nms.world.SWorld;
import com.craftaro.core.nms.world.WorldCore;
import net.minecraft.server.v1_9_R2.Block;
import net.minecraft.server.v1_9_R2.BlockButtonAbstract;
import net.minecraft.server.v1_9_R2.BlockLever;
import net.minecraft.server.v1_9_R2.BlockPosition;
import net.minecraft.server.v1_9_R2.Chunk;
import net.minecraft.server.v1_9_R2.ChunkSection;
@ -99,4 +101,28 @@ public class WorldCoreImpl implements WorldCore {
Block nmsBlock = CraftMagicNumbers.getBlock(bukkitBlock.getType());
serverLevel.updateAdjacentComparators(blockPos, nmsBlock);
}
@Override
public void toggleLever(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockLever leverBlock = (BlockLever) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = leverBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
leverBlock.interact(world, blockposition, iBlockData, null, null, null, null, 0, 0, 0);
}
@Override
public void pressButton(@NotNull org.bukkit.block.Block bukkitBlock) {
CraftBlock craftBlock = (CraftBlock) bukkitBlock;
BlockButtonAbstract buttonBlock = (BlockButtonAbstract) CraftMagicNumbers.getBlock(craftBlock);
IBlockData iBlockData = buttonBlock.getBlockData();
BlockPosition blockposition = new BlockPosition(craftBlock.getX(), craftBlock.getY(), craftBlock.getZ());
WorldServer world = ((CraftWorld) craftBlock.getWorld()).getHandle();
buttonBlock.interact(world, blockposition, iBlockData, null, null, null, null, 0, 0, 0);
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CraftaroCore-NMS</artifactId>

View File

@ -6,7 +6,7 @@
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore-Modules</artifactId>
<version>3.5.0-SNAPSHOT</version>
<version>3.6.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- Run 'mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.Y.Z' to update version recursively -->