com.mojang.datafixers.Dynamic Java Examples

The following examples show how to use com.mojang.datafixers.Dynamic. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WitchWellFeature.java    From the-hallow with MIT License 5 votes vote down vote up
public WitchWellFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> configDeserializer) {
	super(configDeserializer);
	this.slab = HallowedBlocks.TAINTED_SANDSTONE_SLAB.getDefaultState();
	this.wall = HallowedBlocks.TAINTED_SANDSTONE.getDefaultState();
	this.fluid = HallowedBlocks.WITCH_WATER_BLOCK.getDefaultState();
	this.lantern = Blocks.LANTERN.getDefaultState().with(LanternBlock.HANGING, true);
}
 
Example #2
Source File: JungleTempleFeature_creeperMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 4 votes vote down vote up
public JungleTempleFeature_creeperMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> configFactory)
{
    super(configFactory);
}
 
Example #3
Source File: DataConverters_1_13_R2_2.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static NBTTagCompound convert(TypeReference type, NBTTagCompound cmp, int sourceVer, int targetVer) {
    if (sourceVer >= targetVer) {
        return cmp;
    }
    return (NBTTagCompound) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue();
}
 
Example #4
Source File: DataConverters_1_13_R2_2.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static String fixName(String key, int srcVer, TypeReference type) {
    return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, new NBTTagString(key)), srcVer, DATA_VERSION)
            .getStringValue().orElse(key);
}
 
Example #5
Source File: DataConverters_1_13_R2_2.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
private String fixBlockState(String blockState, int srcVer) {
    NBTTagCompound stateNBT = stateToNBT(blockState);
    Dynamic<NBTBase> dynamic = new Dynamic<>(OPS_NBT, stateNBT);
    NBTTagCompound fixed = (NBTTagCompound) INSTANCE.fixer.update(DataConverterTypes.l, dynamic, srcVer, DATA_VERSION).getValue();
    return nbtToState(fixed);
}
 
Example #6
Source File: DataConverters_1_14_R4.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static NBTTagCompound convert(TypeReference type, NBTTagCompound cmp, int sourceVer, int targetVer) {
    if (sourceVer >= targetVer) {
        return cmp;
    }
    return (NBTTagCompound) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue();
}
 
Example #7
Source File: DataConverters_1_14_R4.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static String fixName(String key, int srcVer, TypeReference type) {
    return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, new NBTTagString(key)), srcVer, DATA_VERSION)
            .getValue().asString();
}
 
Example #8
Source File: DataConverters_1_14_R4.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
private String fixBlockState(String blockState, int srcVer) {
    NBTTagCompound stateNBT = stateToNBT(blockState);
    Dynamic<NBTBase> dynamic = new Dynamic<>(OPS_NBT, stateNBT);
    NBTTagCompound fixed = (NBTTagCompound) INSTANCE.fixer.update(DataConverterTypes.m, dynamic, srcVer, DATA_VERSION).getValue();
    return nbtToState(fixed);
}
 
Example #9
Source File: DataConverters_1_15_R2.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static NBTTagCompound convert(TypeReference type, NBTTagCompound cmp, int sourceVer, int targetVer) {
    if (sourceVer >= targetVer) {
        return cmp;
    }
    return (NBTTagCompound) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue();
}
 
Example #10
Source File: DataConverters_1_15_R2.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static String fixName(String key, int srcVer, TypeReference type) {
    return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, NBTTagString.a(key)), srcVer, DATA_VERSION)
            .getValue().asString();
}
 
Example #11
Source File: DataConverters_1_15_R2.java    From worldedit-adapters with GNU Lesser General Public License v3.0 4 votes vote down vote up
private String fixBlockState(String blockState, int srcVer) {
    NBTTagCompound stateNBT = stateToNBT(blockState);
    Dynamic<NBTBase> dynamic = new Dynamic<>(OPS_NBT, stateNBT);
    NBTTagCompound fixed = (NBTTagCompound) INSTANCE.fixer.update(DataConverterTypes.BLOCK_STATE, dynamic, srcVer, DATA_VERSION).getValue();
    return nbtToState(fixed);
}
 
Example #12
Source File: DesertPyramidFeatureMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
public DesertPyramidFeatureMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function_1)
{
    super(function_1);
}
 
Example #13
Source File: EndCityFeatureMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
public EndCityFeatureMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function_1)
{
    super(function_1);
}
 
Example #14
Source File: IglooFeatureMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 4 votes vote down vote up
public IglooFeatureMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> configFactory)
{
    super(configFactory);
}
 
Example #15
Source File: HallowedOreFeatureConfig.java    From the-hallow with MIT License 4 votes vote down vote up
public static HallowedOreFeatureConfig deserialize(Dynamic<?> dynamic) {
	int int_1 = dynamic.get("size").asInt(0);
	BlockState blockState_1 = dynamic.get("state").map(BlockState::deserialize).orElse(Blocks.AIR.getDefaultState());
	return new HallowedOreFeatureConfig(blockState_1, int_1);
}
 
Example #16
Source File: SmallDeadwoodTreeFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public SmallDeadwoodTreeFeature(Function<Dynamic<?>, ? extends BranchedTreeFeatureConfig> function) {
	super(function);
}
 
Example #17
Source File: HallowedOreFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public HallowedOreFeature(Function<Dynamic<?>, ? extends HallowedOreFeatureConfig> function_1) {
	super(function_1);
}
 
Example #18
Source File: LargeDeadwoodTreeFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public LargeDeadwoodTreeFeature(Function<Dynamic<?>, ? extends MegaTreeFeatureConfig> function) {
	super(function);
}
 
Example #19
Source File: RandomizedWildCropFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public RandomizedWildCropFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> featureConfig, RandomBlockSelector choiceSelector) {
	super(featureConfig);
	this.choiceSelector = choiceSelector;
}
 
Example #20
Source File: SmallSkeletalTreeFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public SmallSkeletalTreeFeature(Function<Dynamic<?>, ? extends TreeFeatureConfig> function) {
	super(function);
}
 
Example #21
Source File: DeceasedWildCropFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public DeceasedWildCropFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> featureConfig, BlockState blockState) {
	super(featureConfig);
	this.crop = blockState;
}
 
Example #22
Source File: DeaderBushFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public DeaderBushFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function_1, BlockState state) {
	super(function_1);
	this.state = state;
}
 
Example #23
Source File: LargeSkeletalTreeFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public LargeSkeletalTreeFeature(Function<Dynamic<?>, ? extends TreeFeatureConfig> function) {
	super(function);
}
 
Example #24
Source File: HallowedCactusFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public HallowedCactusFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function) {
	super(function);
}
 
Example #25
Source File: SpiderLairFeature.java    From the-hallow with MIT License 4 votes vote down vote up
public SpiderLairFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function) {
	super(function);
}
 
Example #26
Source File: HallowedOreFeatureConfig.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public <T> Dynamic<T> serialize(DynamicOps<T> dynamicOps) {
	return new Dynamic<T>(dynamicOps, dynamicOps.createMap(ImmutableMap.of(dynamicOps.createString("size"), dynamicOps.createInt(this.size), dynamicOps.createString("state"), BlockState.serialize(dynamicOps, this.state).getValue())));
}