mirror of
https://github.com/xoo0524tw/OpenMBedwars.git
synced 2026-12-05 22:06:02 +02:00
Initial commit: MBedwars 5.5.9.1 reconstructed Maven & IDEA-ready codebase
This commit is contained in:
commit
a8fad81ea0
1609 files changed
+239964
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>de.marcely.bedwars</groupId>
|
||||
<artifactId>mbedwars-nms</artifactId>
|
||||
<version>5.5.9.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mbedwars-nms-legacy</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>de.marcely.bedwars</groupId>
|
||||
<artifactId>mbedwars-common</artifactId>
|
||||
<version>5.5.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.marcely.bedwars.stubs</groupId>
|
||||
<artifactId>provided-api-stubs</artifactId>
|
||||
<version>5.5.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../../deps/provided-api-stubs.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.marcely.bedwars.stubs</groupId>
|
||||
<artifactId>stubs-mbedwars-nms-legacy</artifactId>
|
||||
<version>5.5.9.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../../deps/stubs-mbedwars-nms-legacy.jar</systemPath>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,182 @@
|
||||
package de.marcely.bedwars.nms.legacy;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import de.marcely.bedwars.libraries.org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.Map.Entry;
|
||||
import lombok.Generated;
|
||||
import net.minecraft.server.v1_8_R3.NBTBase;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagByteArray;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagIntArray;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagList;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagString;
|
||||
import net.minecraft.server.v1_8_R3.NBTBase.NBTNumber;
|
||||
import de.marcely.bedwars.nbt.CompoundBase;
|
||||
import de.marcely.bedwars.nbt.ValueBase;
|
||||
import de.marcely.bedwars.nbt.ValueType;
|
||||
|
||||
public final class NBTMirrorR3_8 {
|
||||
public static ValueBase wrapValue(NBTBase var0) {
|
||||
switch (var0.getTypeId()) {
|
||||
case 10:
|
||||
return new NBTMirrorR3_8.CompoundMirror((NBTTagCompound)var0);
|
||||
default:
|
||||
return new NBTMirrorR3_8.ValueMirror(var0);
|
||||
}
|
||||
}
|
||||
|
||||
public static CompoundBase wrapCompound(NBTTagCompound var0) {
|
||||
return new NBTMirrorR3_8.CompoundMirror(var0);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static NBTBase unwrapValue(ValueBase var0) {
|
||||
return var0 instanceof NBTMirrorR3_8.ValueMirror ? ((NBTMirrorR3_8.ValueMirror)var0).tag : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static NBTTagCompound unwrapCompound(CompoundBase var0) {
|
||||
return var0 instanceof NBTMirrorR3_8.CompoundMirror ? ((NBTMirrorR3_8.CompoundMirror)var0).compound : null;
|
||||
}
|
||||
|
||||
public static final class CompoundMirror extends CompoundBase.AbstractCompound {
|
||||
private final NBTTagCompound compound;
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.compound.isEmpty();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.compound.c().size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ValueBase get(String var1) {
|
||||
NBTBase var2 = this.compound.get(var1);
|
||||
return var2 != null ? NBTMirrorR3_8.wrapValue(var2) : null;
|
||||
}
|
||||
|
||||
public void put(String var1, ValueBase var2) {
|
||||
this.compound.set(var1, R3_8.toNmsNbtTag(var2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(String var1) {
|
||||
this.compound.remove(var1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ValueBase removeAndGet(String var1) {
|
||||
NBTBase var2 = this.compound.get(var1);
|
||||
if (var2 == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.compound.remove(var1);
|
||||
return NBTMirrorR3_8.wrapValue(var2);
|
||||
}
|
||||
|
||||
public Iterator<Entry<String, ValueBase>> iterator() {
|
||||
return Iterators.transform(this.compound.c().iterator(), var1 -> new SimpleEntry<>(var1, NBTMirrorR3_8.wrapValue(this.compound.get(var1))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.compound.toString();
|
||||
}
|
||||
|
||||
@Generated
|
||||
public CompoundMirror(NBTTagCompound var1) {
|
||||
this.compound = var1;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ValueMirror extends ValueBase.AbstractValue {
|
||||
private final NBTBase tag;
|
||||
|
||||
public ValueType getType() {
|
||||
return ValueType.fromNbtId(this.tag.getTypeId());
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return ((NBTNumber)this.tag).f();
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return ((NBTNumber)this.tag).e();
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return ((NBTNumber)this.tag).d();
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return ((NBTNumber)this.tag).c();
|
||||
}
|
||||
|
||||
public float asFloat() {
|
||||
return ((NBTNumber)this.tag).h();
|
||||
}
|
||||
|
||||
public double asDouble() {
|
||||
return ((NBTNumber)this.tag).g();
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return ((NBTTagString)this.tag).a_();
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return this.asByte() == 1;
|
||||
}
|
||||
|
||||
public <T2 extends ValueBase> List<T2> asList() {
|
||||
NBTTagList var1 = (NBTTagList)this.tag;
|
||||
ArrayList var2 = new ArrayList(var1.size());
|
||||
|
||||
for (int var3 = 0; var3 < var1.size(); var3++) {
|
||||
var2.add(NBTMirrorR3_8.wrapValue(var1.g(var3)));
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public List<String> asStringList() {
|
||||
NBTTagList var1 = (NBTTagList)this.tag;
|
||||
if (var1.f() != 8) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
ArrayList var2 = new ArrayList(var1.size());
|
||||
|
||||
for (int var3 = 0; var3 < var1.size(); var3++) {
|
||||
var2.add(((NBTTagString)var1.g(var3)).a_());
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
public byte[] asByteArray() {
|
||||
return ((NBTTagByteArray)this.tag).c();
|
||||
}
|
||||
|
||||
public int[] asIntArray() {
|
||||
return ((NBTTagIntArray)this.tag).c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.tag.toString();
|
||||
}
|
||||
|
||||
@Generated
|
||||
public ValueMirror(NBTBase var1) {
|
||||
this.tag = var1;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user