3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Allow ability to replace piston extension block to prevent crashing.

Dieser Commit ist enthalten in:
Myles 2016-06-22 23:34:32 +01:00
Ursprung 4af98b220c
Commit 26fcdfe3bc
5 geänderte Dateien mit 38 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -150,6 +150,16 @@ public class ViaConfig implements ViaVersionConfig {
return plugin.getConfig().getBoolean("nms-player-ticking", true);
}
@Override
public boolean isReplacePistons() {
return plugin.getConfig().getBoolean("replace-pistons", false);
}
@Override
public int getPistonReplacementId() {
return plugin.getConfig().getInt("replacement-piston-id", 0);
}
public boolean isAutoTeam() {
// Collision has to be enabled first
return isPreventCollision() && plugin.getConfig().getBoolean("auto-team", true);

Datei anzeigen

@ -172,4 +172,18 @@ public interface ViaVersionConfig {
* @return if true, enabled
*/
boolean isNMSPlayerTicking();
/**
* Replace extended pistons on 1.10 chunk loading.
*
* @return True if to replace them
*/
boolean isReplacePistons();
/**
* Get the id for replacing extended pistons.
*
* @return The integer id
*/
int getPistonReplacementId();
}

Datei anzeigen

@ -1,10 +1,9 @@
package us.myles.ViaVersion.api.data;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter(AccessLevel.PROTECTED)
@Getter
@AllArgsConstructor
public class StoredObject {
private UserConnection user;

Datei anzeigen

@ -3,10 +3,13 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.types;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.bukkit.Bukkit;
import us.myles.ViaVersion.api.ViaVersion;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.type.PartialType;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.minecraft.BaseChunkType;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chunks.Chunk1_9to1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chunks.ChunkSection1_9to1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
@ -46,6 +49,9 @@ public class ChunkType extends PartialType<Chunk, ClientChunks> {
@Override
public Chunk read(ByteBuf input, ClientChunks param) throws Exception {
boolean replacePistons = param.getUser().get(ProtocolInfo.class).getPipeline().contains(Protocol1_10To1_9_3_4.class) && ViaVersion.getConfig().isReplacePistons();
int replacementId = ViaVersion.getConfig().getPistonReplacementId();
int chunkX = input.readInt();
int chunkZ = input.readInt();
long chunkHash = toLong(chunkX, chunkZ);
@ -93,7 +99,8 @@ public class ChunkType extends PartialType<Chunk, ClientChunks> {
int mask = blockBuf.get();
int type = mask >> 4;
int data = mask & 0xF;
if (replacePistons && type == 36)
type = replacementId;
section.setBlock(j, type, data);
}
}

Datei anzeigen

@ -71,3 +71,7 @@ use-new-deathmessages: false
item-cache: true
# Patch the Anti xray to work on 1.9 & 1.10 (If your server is 1.8) This can cost more performance, so disable it if you don't use it.
anti-xray-patch: true
# Should we replace extended pistons to fix 1.10.1 (Only on chunk load)
replace-pistons: false
# What id should we replace with, default is air. (careful of players getting stuck standing on them)
replacement-piston-id: 0