Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
import org.spongepowered.api.world.ChunkRegenerateFlag;
import org.spongepowered.api.world.HeightType;
import org.spongepowered.api.world.LightType;
import org.spongepowered.api.world.SignalType;
import org.spongepowered.api.world.WorldType;
import org.spongepowered.api.world.biome.Biome;
import org.spongepowered.api.world.biome.climate.GrassColorModifier;
Expand Down Expand Up @@ -491,6 +492,8 @@ public final class RegistryTypes {

public static final DefaultedRegistryType<SelectorType> SELECTOR_TYPE = RegistryTypes.spongeKeyInGame("selector_type");

public static final DefaultedRegistryType<SignalType> SIGNAL_TYPE = RegistryTypes.spongeKeyInGame("signal_type");

public static final DefaultedRegistryType<SkinPart> SKIN_PART = RegistryTypes.spongeKeyInGame("skin_part");

public static final DefaultedRegistryType<SlabPortion> SLAB_PORTION = RegistryTypes.spongeKeyInGame("slab_portion");
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/org/spongepowered/api/world/SignalType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This file is part of SpongeAPI, 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.api.world;

import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.util.annotation.CatalogedBy;
import org.spongepowered.api.world.volume.game.SignalAwareVolume;

/**
* Represents a type of the signal in the {@link SignalAwareVolume}.
*/
@CatalogedBy(SignalTypes.class)
public interface SignalType extends DefaultedRegistryValue {
}
74 changes: 74 additions & 0 deletions src/main/java/org/spongepowered/api/world/SignalTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* This file is part of SpongeAPI, 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.api.world;

import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.registry.DefaultedRegistryReference;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.api.world.volume.game.SignalAwareVolume;

@RegistryScopes(scopes = RegistryScope.GAME)
public final class SignalTypes {

/**
* Powers neighbours.
*/
public static final DefaultedRegistryReference<SignalType> DIRECT = SignalTypes.key(ResourceKey.sponge("direct"));

/**
* Goes through neighbours powering their neighbours.
*/
public static final DefaultedRegistryReference<SignalType> INDIRECT = SignalTypes.key(ResourceKey.sponge("indirect"));

/**
* The combination of {@link #DIRECT} and {@link #INDIRECT} signals.<br>
* Usually depends on block properties to choose between these two signals
* (e.g. if the block {@link SignalAwareVolume#canConductSignal(int, int, int)}).
*/
public static final DefaultedRegistryReference<SignalType> COMPOSITE = SignalTypes.key(ResourceKey.sponge("composite"));

/**
* Doesn't directly power anything but can be extracted
* by some blocks (e.g. {@link BlockTypes#COMPARATOR}).
*/
public static final DefaultedRegistryReference<SignalType> ANALOG = SignalTypes.key(ResourceKey.sponge("analog"));

private SignalTypes() {
}

public static Registry<SignalType> registry() {
return Sponge.game().registry(RegistryTypes.SIGNAL_TYPE);
}

private static DefaultedRegistryReference<SignalType> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.SIGNAL_TYPE, location).asDefaultedReference(Sponge::game);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

public interface Region<R extends Region<R>> extends
EnvironmentalVolume,
SignalAwareVolume,
BiomeVolume.Streamable<R>,
BlockVolume.Streamable<R>,
BlockEntityVolume.Streamable<R>,
Expand Down
Loading
Loading