mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Fix easy place make CoralFans waterlogged
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.leavesmc.leaves.protocol;
|
package org.leavesmc.leaves.protocol;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
@@ -22,6 +23,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class LitematicaEasyPlaceProtocol {
|
public class LitematicaEasyPlaceProtocol {
|
||||||
|
|
||||||
@@ -49,9 +51,9 @@ public class LitematicaEasyPlaceProtocol {
|
|||||||
BlockStateProperties.ROTATION_16
|
BlockStateProperties.ROTATION_16
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final ImmutableSet<Property<?>> BLACKLISTED_PROPERTIES = ImmutableSet.of(
|
public static final ImmutableMap<Property<?>, ?> BLACKLISTED_PROPERTIES = ImmutableMap.of(
|
||||||
BlockStateProperties.WATERLOGGED,
|
BlockStateProperties.WATERLOGGED, false,
|
||||||
BlockStateProperties.POWERED
|
BlockStateProperties.POWERED, false
|
||||||
);
|
);
|
||||||
|
|
||||||
public static BlockState applyPlacementProtocol(BlockState state, BlockPlaceContext context) {
|
public static BlockState applyPlacementProtocol(BlockState state, BlockPlaceContext context) {
|
||||||
@@ -95,7 +97,7 @@ public class LitematicaEasyPlaceProtocol {
|
|||||||
if (property != null && property.equals(p)) {
|
if (property != null && property.equals(p)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!WHITELISTED_PROPERTIES.contains(p) || BLACKLISTED_PROPERTIES.contains(p)) {
|
if (!WHITELISTED_PROPERTIES.contains(p) || BLACKLISTED_PROPERTIES.containsKey(p)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,11 +129,9 @@ public class LitematicaEasyPlaceProtocol {
|
|||||||
LeavesLogger.LOGGER.warning("Exception trying to apply placement protocol value", e);
|
LeavesLogger.LOGGER.warning("Exception trying to apply placement protocol value", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Property<?> p : BLACKLISTED_PROPERTIES) {
|
for (Map.Entry<Property<?>, ?> p : BLACKLISTED_PROPERTIES.entrySet()) {
|
||||||
if (state.hasProperty(p)) {
|
if (state.hasProperty(p.getKey())) {
|
||||||
Property<T> prop = (Property<T>) p;
|
state = state.setValue((Property<T>) p.getKey(), (T) p.getValue());
|
||||||
BlockState def = state.getBlock().defaultBlockState();
|
|
||||||
state = state.setValue(prop, def.getValue(prop));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user