-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set the default value for human DataManager's PlayerModelFlagParameter to be 127 instead of 0. Meaning that sponge human entities show their outer skin layers by default. Also update human DataManager's to reflect a change in which hand is the main one. And added new keys to set sponge human entities to have a specific skin texture (and signature), instead of always using the latest from a specific player UUID.
- Loading branch information
Showing
11 changed files
with
582 additions
and
3 deletions.
There are no files selected for viewing
Submodule SpongeAPI
updated
5 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...ngepowered/common/data/manipulator/immutable/entity/ImmutableSpongeSkinSignatureData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* This file is part of Sponge, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.spongepowered.common.data.manipulator.immutable.entity; | ||
|
||
import org.spongepowered.api.data.DataContainer; | ||
import org.spongepowered.api.data.key.Keys; | ||
import org.spongepowered.api.data.manipulator.immutable.entity.ImmutableSkinSignatureData; | ||
import org.spongepowered.api.data.manipulator.mutable.entity.SkinSignatureData; | ||
import org.spongepowered.api.data.value.immutable.ImmutableValue; | ||
import org.spongepowered.common.data.manipulator.immutable.common.AbstractImmutableSingleData; | ||
import org.spongepowered.common.data.manipulator.mutable.entity.SpongeSkinSignatureData; | ||
import org.spongepowered.common.data.value.immutable.ImmutableSpongeValue; | ||
|
||
public class ImmutableSpongeSkinSignatureData extends AbstractImmutableSingleData<String, ImmutableSkinSignatureData, SkinSignatureData> implements ImmutableSkinSignatureData { | ||
|
||
private final ImmutableSpongeValue<String> skinValue; | ||
|
||
public ImmutableSpongeSkinSignatureData(String value) { | ||
super(ImmutableSkinSignatureData.class, value, Keys.SKIN_SIGNATURE); | ||
this.skinValue = new ImmutableSpongeValue<>(Keys.SKIN_SIGNATURE, value); | ||
} | ||
|
||
@Override | ||
public SkinSignatureData asMutable() { | ||
return new SpongeSkinSignatureData(this.value); | ||
} | ||
|
||
@Override | ||
public DataContainer toContainer() { | ||
return super.toContainer() | ||
.set(Keys.SKIN_SIGNATURE.getQuery(), this.value.toString()); | ||
} | ||
|
||
@Override | ||
public ImmutableValue<String> skinSignature() { | ||
return this.skinValue; | ||
} | ||
|
||
@Override | ||
protected ImmutableValue<?> getValueGetter() { | ||
return skinSignature(); | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
...pongepowered/common/data/manipulator/immutable/entity/ImmutableSpongeSkinTextureData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* This file is part of Sponge, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.spongepowered.common.data.manipulator.immutable.entity; | ||
|
||
import org.spongepowered.api.data.DataContainer; | ||
import org.spongepowered.api.data.key.Keys; | ||
import org.spongepowered.api.data.manipulator.immutable.entity.ImmutableSkinTextureData; | ||
import org.spongepowered.api.data.manipulator.mutable.entity.SkinTextureData; | ||
import org.spongepowered.api.data.value.immutable.ImmutableValue; | ||
import org.spongepowered.common.data.manipulator.immutable.common.AbstractImmutableSingleData; | ||
import org.spongepowered.common.data.manipulator.mutable.entity.SpongeSkinTextureData; | ||
import org.spongepowered.common.data.value.immutable.ImmutableSpongeValue; | ||
|
||
public class ImmutableSpongeSkinTextureData extends AbstractImmutableSingleData<String, ImmutableSkinTextureData, SkinTextureData> implements ImmutableSkinTextureData { | ||
|
||
private final ImmutableSpongeValue<String> skinValue; | ||
|
||
public ImmutableSpongeSkinTextureData(String value) { | ||
super(ImmutableSkinTextureData.class, value, Keys.SKIN_TEXTURE); | ||
this.skinValue = new ImmutableSpongeValue<>(Keys.SKIN_TEXTURE, value); | ||
} | ||
|
||
@Override | ||
public SkinTextureData asMutable() { | ||
return new SpongeSkinTextureData(this.value); | ||
} | ||
|
||
@Override | ||
public DataContainer toContainer() { | ||
return super.toContainer() | ||
.set(Keys.SKIN_TEXTURE.getQuery(), this.value.toString()); | ||
} | ||
|
||
@Override | ||
public ImmutableValue<String> skinTexture() { | ||
return this.skinValue; | ||
} | ||
|
||
@Override | ||
protected ImmutableValue<?> getValueGetter() { | ||
return skinTexture(); | ||
} | ||
|
||
} |
73 changes: 73 additions & 0 deletions
73
...ava/org/spongepowered/common/data/manipulator/mutable/entity/SpongeSkinSignatureData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* This file is part of Sponge, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.spongepowered.common.data.manipulator.mutable.entity; | ||
|
||
import org.spongepowered.api.data.DataContainer; | ||
import org.spongepowered.api.data.key.Keys; | ||
import org.spongepowered.api.data.manipulator.immutable.entity.ImmutableSkinSignatureData; | ||
import org.spongepowered.api.data.manipulator.mutable.entity.SkinSignatureData; | ||
import org.spongepowered.api.data.value.mutable.Value; | ||
import org.spongepowered.common.data.manipulator.immutable.entity.ImmutableSpongeSkinSignatureData; | ||
import org.spongepowered.common.data.manipulator.mutable.common.AbstractSingleData; | ||
import org.spongepowered.common.data.value.mutable.SpongeValue; | ||
import org.spongepowered.common.util.Constants; | ||
|
||
public class SpongeSkinSignatureData extends AbstractSingleData<String, SkinSignatureData, ImmutableSkinSignatureData> implements SkinSignatureData { | ||
|
||
public SpongeSkinSignatureData() { | ||
super(SkinSignatureData.class, "", Keys.SKIN_SIGNATURE); | ||
} | ||
|
||
public SpongeSkinSignatureData(String Signature) { | ||
super(SkinSignatureData.class, Signature, Keys.SKIN_SIGNATURE); | ||
} | ||
|
||
@Override | ||
public SkinSignatureData copy() { | ||
return new SpongeSkinSignatureData(getValue()); | ||
} | ||
|
||
@Override | ||
public ImmutableSkinSignatureData asImmutable() { | ||
return new ImmutableSpongeSkinSignatureData(getValue()); | ||
} | ||
|
||
@Override | ||
public DataContainer toContainer() { | ||
return super.toContainer() | ||
.set(Constants.GameProfile.SKIN_SIGNATURE, getValue()); | ||
} | ||
|
||
@Override | ||
public Value<String> skinSignature() { | ||
return new SpongeValue<>(Keys.SKIN_SIGNATURE, getValue()); | ||
} | ||
|
||
@Override | ||
protected Value<?> getValueGetter() { | ||
return skinSignature(); | ||
} | ||
|
||
} |
73 changes: 73 additions & 0 deletions
73
.../java/org/spongepowered/common/data/manipulator/mutable/entity/SpongeSkinTextureData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* This file is part of Sponge, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.spongepowered.common.data.manipulator.mutable.entity; | ||
|
||
import org.spongepowered.api.data.DataContainer; | ||
import org.spongepowered.api.data.key.Keys; | ||
import org.spongepowered.api.data.manipulator.immutable.entity.ImmutableSkinTextureData; | ||
import org.spongepowered.api.data.manipulator.mutable.entity.SkinTextureData; | ||
import org.spongepowered.api.data.value.mutable.Value; | ||
import org.spongepowered.common.data.manipulator.immutable.entity.ImmutableSpongeSkinTextureData; | ||
import org.spongepowered.common.data.manipulator.mutable.common.AbstractSingleData; | ||
import org.spongepowered.common.data.value.mutable.SpongeValue; | ||
import org.spongepowered.common.util.Constants; | ||
|
||
public class SpongeSkinTextureData extends AbstractSingleData<String, SkinTextureData, ImmutableSkinTextureData> implements SkinTextureData { | ||
|
||
public SpongeSkinTextureData() { | ||
super(SkinTextureData.class, "", Keys.SKIN_TEXTURE); | ||
} | ||
|
||
public SpongeSkinTextureData(String texture) { | ||
super(SkinTextureData.class, texture, Keys.SKIN_TEXTURE); | ||
} | ||
|
||
@Override | ||
public SkinTextureData copy() { | ||
return new SpongeSkinTextureData(getValue()); | ||
} | ||
|
||
@Override | ||
public ImmutableSkinTextureData asImmutable() { | ||
return new ImmutableSpongeSkinTextureData(getValue()); | ||
} | ||
|
||
@Override | ||
public DataContainer toContainer() { | ||
return super.toContainer() | ||
.set(Constants.GameProfile.SKIN_TEXTURE, getValue()); | ||
} | ||
|
||
@Override | ||
public Value<String> skinTexture() { | ||
return new SpongeValue<>(Keys.SKIN_TEXTURE, getValue()); | ||
} | ||
|
||
@Override | ||
protected Value<?> getValueGetter() { | ||
return skinTexture(); | ||
} | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
.../java/org/spongepowered/common/data/processor/data/entity/SkinSignatureDataProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* This file is part of Sponge, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.spongepowered.common.data.processor.data.entity; | ||
|
||
import org.spongepowered.api.data.DataTransactionResult; | ||
import org.spongepowered.api.data.key.Keys; | ||
import org.spongepowered.api.data.manipulator.immutable.entity.ImmutableSkinSignatureData; | ||
import org.spongepowered.api.data.manipulator.mutable.entity.SkinSignatureData; | ||
import org.spongepowered.api.data.value.ValueContainer; | ||
import org.spongepowered.api.data.value.immutable.ImmutableValue; | ||
import org.spongepowered.api.data.value.mutable.Value; | ||
import org.spongepowered.common.data.manipulator.mutable.entity.SpongeSkinSignatureData; | ||
import org.spongepowered.common.data.processor.common.AbstractEntitySingleDataProcessor; | ||
import org.spongepowered.common.data.value.immutable.ImmutableSpongeValue; | ||
import org.spongepowered.common.data.value.mutable.SpongeValue; | ||
import org.spongepowered.common.entity.living.human.EntityHuman; | ||
|
||
import java.util.Optional; | ||
|
||
public class SkinSignatureDataProcessor extends | ||
AbstractEntitySingleDataProcessor<EntityHuman, String, Value<String>, SkinSignatureData, ImmutableSkinSignatureData> { | ||
|
||
public SkinSignatureDataProcessor() { | ||
super(EntityHuman.class, Keys.SKIN_SIGNATURE); | ||
} | ||
|
||
@Override | ||
public DataTransactionResult removeFrom(ValueContainer<?> container) { | ||
if (!(container instanceof EntityHuman)) { | ||
return DataTransactionResult.failNoData(); | ||
} | ||
return ((EntityHuman) container).removeSkinSignature(); | ||
} | ||
|
||
@Override | ||
protected Value<String> constructValue(String actualValue) { | ||
return new SpongeValue<>(Keys.SKIN_SIGNATURE, actualValue); | ||
} | ||
|
||
@Override | ||
protected boolean set(EntityHuman entity, String value) { | ||
return entity.setSkinSignature(value); | ||
} | ||
|
||
@Override | ||
protected Optional<String> getVal(EntityHuman entity) { | ||
return Optional.ofNullable(entity.getSkinSignature()); | ||
} | ||
|
||
@Override | ||
protected ImmutableValue<String> constructImmutableValue(String value) { | ||
return new ImmutableSpongeValue<String>(Keys.SKIN_SIGNATURE, value); | ||
} | ||
|
||
@Override | ||
protected SkinSignatureData createManipulator() { | ||
return new SpongeSkinSignatureData(); | ||
} | ||
|
||
} |
Oops, something went wrong.