Add tip and creaking block state properties for 1.21.2

This commit is contained in:
booky10 committed 2024-10-21 01:36:03 +02:00
1 parent 6b2d3cbc7e
commit d11a0bade5
3 files changed
+51 -1

No files matched your search

@@ -15,6 +15,7 @@ import com.github.retrooper.packetevents.protocol.world.BlockFace;
import com.github.retrooper.packetevents.protocol.world.states.enums.Attachment;
import com.github.retrooper.packetevents.protocol.world.states.enums.Axis;
import com.github.retrooper.packetevents.protocol.world.states.enums.Bloom;
import com.github.retrooper.packetevents.protocol.world.states.enums.CreakingHeartState;
import com.github.retrooper.packetevents.protocol.world.states.enums.East;
import com.github.retrooper.packetevents.protocol.world.states.enums.Face;
import com.github.retrooper.packetevents.protocol.world.states.enums.Half;
@@ -941,6 +942,16 @@ public class WrappedBlockState {
checkIsStillValid();
}
public boolean isTip() {
return (boolean) data.get(StateValue.TIP);
}
public void setTip(boolean tip) {
checkIfCloneNeeded();
data.put(StateValue.TIP, tip);
checkIsStillValid();
}
public boolean isLocked() {
return (boolean) data.get(StateValue.LOCKED);
}
@@ -1371,6 +1382,16 @@ public class WrappedBlockState {
checkIsStillValid();
}
public CreakingHeartState getCreaking() {
return (CreakingHeartState) data.get(StateValue.CREAKING);
}
public void setCreaking(CreakingHeartState creakingHeartState) {
checkIfCloneNeeded();
data.put(StateValue.CREAKING, creakingHeartState);
checkIsStillValid();
}
// End all block data types
/**
@@ -0,0 +1,26 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2024 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.world.states.enums;
public enum CreakingHeartState {
DISABLED,
DORMANT,
ACTIVE,
}
@@ -21,6 +21,7 @@ package com.github.retrooper.packetevents.protocol.world.states.type;
import com.github.retrooper.packetevents.protocol.world.BlockFace;
import com.github.retrooper.packetevents.protocol.world.states.enums.Attachment;
import com.github.retrooper.packetevents.protocol.world.states.enums.Axis;
import com.github.retrooper.packetevents.protocol.world.states.enums.CreakingHeartState;
import com.github.retrooper.packetevents.protocol.world.states.enums.East;
import com.github.retrooper.packetevents.protocol.world.states.enums.Face;
import com.github.retrooper.packetevents.protocol.world.states.enums.Half;
@@ -93,6 +94,7 @@ public enum StateValue {
LEAVES("leaves", Leaves.class, Leaves::valueOf),
LEVEL("level", int.class, Integer::parseInt),
LIT("lit", boolean.class, Boolean::parseBoolean),
TIP("tip", boolean.class, Boolean::parseBoolean),
LOCKED("locked", boolean.class, Boolean::parseBoolean),
MODE("mode", Mode.class, Mode::valueOf),
MOISTURE("moisture", int.class, Integer::parseInt),
@@ -132,7 +134,8 @@ public enum StateValue {
VAULT_STATE("vault_state", VaultState.class, VaultState::valueOf),
VERTICAL_DIRECTION("vertical_direction", VerticalDirection.class, VerticalDirection::valueOf),
WATERLOGGED("waterlogged", boolean.class, Boolean::parseBoolean),
WEST("west", West.class, West::valueOf);
WEST("west", West.class, West::valueOf),
CREAKING("creaking", CreakingHeartState.class, CreakingHeartState::valueOf);
public static final Index<String, StateValue> NAME_INDEX = Index.create(
StateValue.class, StateValue::getName);