diff --git a/api/src/main/java/com/github/retrooper/packetevents/protocol/world/states/type/StateTypes.java b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/states/type/StateTypes.java index 5783debaca..4c2702954c 100644 --- a/api/src/main/java/com/github/retrooper/packetevents/protocol/world/states/type/StateTypes.java +++ b/api/src/main/java/com/github/retrooper/packetevents/protocol/world/states/type/StateTypes.java @@ -1155,8 +1155,8 @@ public static StateType.Mapped getMappedById(ClientVersion version, int id) { public static StateType TRIAL_SPAWNER = StateTypes.builder().name("TRIAL_SPAWNER").blastResistance(50.0f).hardness(50.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build(); // 1.20.5 added types - public static StateType VAULT = StateTypes.builder().name("vault").blastResistance(50.0f).hardness(50.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).build(); - public static StateType HEAVY_CORE = StateTypes.builder().name("heavy_core").blastResistance(1200.0f).hardness(10.0f).isBlocking(true).requiresCorrectTool(false).isSolid(false).build(); + public static StateType VAULT = StateTypes.builder().name("vault").blastResistance(50.0f).hardness(50.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build(); + public static StateType HEAVY_CORE = StateTypes.builder().name("heavy_core").blastResistance(1200.0f).hardness(10.0f).isBlocking(true).requiresCorrectTool(false).isSolid(false).setMaterial(MaterialType.METAL).build(); static { TYPES_BUILDER.unloadFileMappings(); diff --git a/api/src/test/java/com/github/retrooper/packetevents/test/EnsureValidStateTypesTest.java b/api/src/test/java/com/github/retrooper/packetevents/test/EnsureValidStateTypesTest.java new file mode 100644 index 0000000000..1ea226aa64 --- /dev/null +++ b/api/src/test/java/com/github/retrooper/packetevents/test/EnsureValidStateTypesTest.java @@ -0,0 +1,39 @@ +/* + * 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 . + */ + +package com.github.retrooper.packetevents.test; + +import com.github.retrooper.packetevents.protocol.world.states.type.StateType; +import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes; +import com.github.retrooper.packetevents.test.base.BaseDummyAPITest; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class EnsureValidStateTypesTest extends BaseDummyAPITest { + + @Test + @DisplayName("Verify non-null material type") + public void testStateTypesMaterialType() { + for (StateType stateType : StateTypes.values()) { + assertNotNull(stateType.getMaterialType(), + () -> stateType.getName() + " has no material type"); + } + } +}