Skip to content

Commit

Permalink
Add tip and creaking block state properties for 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
booky10 committed Oct 20, 2024
1 parent 6b2d3cb commit d11a0ba
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand Down Expand Up @@ -941,6 +942,16 @@ public void setLit(boolean lit) {
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);
}
Expand Down Expand Up @@ -1371,6 +1382,16 @@ public void setTrialSpawnerState(TrialSpawnerState trialSpawnerState) {
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

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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.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;
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d11a0ba

Please sign in to comment.