Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Update physics on attached block when setting data of attachable blocks
Dieser Commit ist enthalten in:
Ursprung
11e8c6d338
Commit
5c23262f15
@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -10,11 +11,14 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.material.Attachable;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.server.EnumDirection;
|
||||
import net.minecraft.server.IBlockData;
|
||||
import net.minecraft.server.TileEntity;
|
||||
|
||||
public class CraftBlockState implements BlockState {
|
||||
@ -159,14 +163,21 @@ public class CraftBlockState implements BlockState {
|
||||
}
|
||||
}
|
||||
|
||||
BlockPosition pos = new BlockPosition(x, y, z);
|
||||
IBlockData newBlock = CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData());
|
||||
block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
|
||||
world.getHandle().notify(
|
||||
new BlockPosition(x, y, z),
|
||||
pos,
|
||||
CraftMagicNumbers.getBlock(block).fromLegacyData(block.getData()),
|
||||
CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData()),
|
||||
newBlock,
|
||||
3
|
||||
);
|
||||
|
||||
// Update levers etc
|
||||
if (applyPhysics && getData() instanceof Attachable) {
|
||||
world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren