mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-20 03:59:34 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ff5e9a726 | ||
|
|
2d923d32e7 | ||
|
|
d87191339a | ||
|
|
3050dd086f | ||
|
|
5a767add80 | ||
|
|
0f3a2677bf | ||
|
|
c06c687eb4 | ||
|
|
092a12136d | ||
|
|
01c1a0c50b | ||
|
|
c5562f532e | ||
|
|
7582c5e11a | ||
|
|
2ebc05bcc1 | ||
|
|
69c4be6419 | ||
|
|
d1dec41c11 | ||
|
|
fa1dca35b9 | ||
|
|
e5f3ad873e |
No files matched your search
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("com.github.GTNewHorizons:GTNHLib:0.5.22:dev")
|
api("com.github.GTNewHorizons:GTNHLib:0.3.2:dev")
|
||||||
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.51-GTNH:dev")
|
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev")
|
||||||
|
|
||||||
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
||||||
testImplementation('org.junit.jupiter:junit-jupiter')
|
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||||
|
|||||||
+4
-15
@@ -50,10 +50,10 @@ enableGenericInjection = true
|
|||||||
# Generate a class with a String field for the mod version named as defined below.
|
# Generate a class with a String field for the mod version named as defined below.
|
||||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||||
generateGradleTokenClass = com.gtnewhorizon.structurelib.Tags
|
generateGradleTokenClass =
|
||||||
|
|
||||||
# Name of the token containing the project's current version to generate/replace.
|
# Name of the token containing the project's current version to generate/replace.
|
||||||
gradleTokenVersion = VERSION
|
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||||
|
|
||||||
# [DEPRECATED] Mod ID replacement token.
|
# [DEPRECATED] Mod ID replacement token.
|
||||||
gradleTokenModId =
|
gradleTokenModId =
|
||||||
@@ -70,7 +70,7 @@ gradleTokenGroupName =
|
|||||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||||
# version in @Mod([...], version = VERSION, [...]).
|
# version in @Mod([...], version = VERSION, [...]).
|
||||||
# Leave these properties empty to skip individual token replacements.
|
# Leave these properties empty to skip individual token replacements.
|
||||||
replaceGradleTokenInFile =
|
replaceGradleTokenInFile = StructureLib.java
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
# leave this property empty.
|
# leave this property empty.
|
||||||
@@ -85,11 +85,6 @@ accessTransformersFile =
|
|||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = true
|
usesMixins = true
|
||||||
|
|
||||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
|
||||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
|
||||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
|
||||||
separateMixinSourceSet =
|
|
||||||
|
|
||||||
# Adds some debug arguments like verbose output and class export.
|
# Adds some debug arguments like verbose output and class export.
|
||||||
usesMixinDebug = false
|
usesMixinDebug = false
|
||||||
|
|
||||||
@@ -122,15 +117,9 @@ minimizeShadowedDependencies = true
|
|||||||
# If disabled, won't rename the shadowed classes.
|
# If disabled, won't rename the shadowed classes.
|
||||||
relocateShadowedDependencies = true
|
relocateShadowedDependencies = true
|
||||||
|
|
||||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||||
includeWellKnownRepositories = true
|
includeWellKnownRepositories = true
|
||||||
|
|
||||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
|
||||||
# list of strings, with the acceptable keys being(case does not matter):
|
|
||||||
# cursemaven
|
|
||||||
# modrinth
|
|
||||||
excludeWellKnownRepositories =
|
|
||||||
|
|
||||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -86,8 +84,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
' "$PWD" ) || exit
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|||||||
Vendored
-2
@@ -13,8 +13,6 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
@rem SPDX-License-Identifier: Apache-2.0
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
@Mod(
|
@Mod(
|
||||||
modid = StructureLibAPI.MOD_ID,
|
modid = StructureLibAPI.MOD_ID,
|
||||||
name = "StructureLib",
|
name = "StructureLib",
|
||||||
version = Tags.VERSION,
|
version = "GRADLETOKEN_VERSION",
|
||||||
acceptableRemoteVersions = "*",
|
acceptableRemoteVersions = "*",
|
||||||
guiFactory = "com.gtnewhorizon.structurelib.GuiFactory")
|
guiFactory = "com.gtnewhorizon.structurelib.GuiFactory")
|
||||||
public class StructureLib {
|
public class StructureLib {
|
||||||
@@ -100,8 +100,6 @@ public class StructureLib {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static boolean isGTLoaded;
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent e) {
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
ConfigurationHandler.INSTANCE.init(e.getSuggestedConfigurationFile());
|
ConfigurationHandler.INSTANCE.init(e.getSuggestedConfigurationFile());
|
||||||
@@ -120,8 +118,6 @@ public class StructureLib {
|
|||||||
if (Loader.isModLoaded(STRUCTURECOMPAT_MODID)) {
|
if (Loader.isModLoaded(STRUCTURECOMPAT_MODID)) {
|
||||||
COMPAT = Loader.instance().getIndexedModList().get(STRUCTURECOMPAT_MODID).getMod();
|
COMPAT = Loader.instance().getIndexedModList().get(STRUCTURECOMPAT_MODID).getMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
isGTLoaded = Loader.isModLoaded("gregtech");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class StructureLibAPI {
|
|||||||
*/
|
*/
|
||||||
public static void enableInstrument(Object identifier) {
|
public static void enableInstrument(Object identifier) {
|
||||||
if (isInstrumentEnabled()) throw new IllegalStateException();
|
if (isInstrumentEnabled()) throw new IllegalStateException();
|
||||||
instrument.set(identifier);
|
instrument.set(instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,15 +25,6 @@ import com.gtnewhorizon.structurelib.gui.GuiScrollableList.IGuiScreen;
|
|||||||
|
|
||||||
public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen {
|
public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen {
|
||||||
|
|
||||||
private static final int ADD_BTN = 0;
|
|
||||||
private static final int UNSET_BTN = 1;
|
|
||||||
private static final int WIPE_BTN = 2;
|
|
||||||
private static final int SHOW_ERROR_BTN = 3;
|
|
||||||
private static final int GT_NO_HATCH_BTN = 4;
|
|
||||||
|
|
||||||
private static final String SHOW_ERROR_CHANNEL = "show_error";
|
|
||||||
private static final String GT_NO_HATCH_CHANNEL = "gt_no_hatch";
|
|
||||||
|
|
||||||
private static final int KEY_MAX_WIDTH = 50;
|
private static final int KEY_MAX_WIDTH = 50;
|
||||||
private final ItemStack trigger;
|
private final ItemStack trigger;
|
||||||
private final GuiChannelsList list;
|
private final GuiChannelsList list;
|
||||||
@@ -137,7 +128,7 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
|
|
||||||
addButton(
|
addButton(
|
||||||
new GuiButton(
|
new GuiButton(
|
||||||
ADD_BTN,
|
0,
|
||||||
guiLeft + 12,
|
guiLeft + 12,
|
||||||
guiTop + 157,
|
guiTop + 157,
|
||||||
47,
|
47,
|
||||||
@@ -145,7 +136,7 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
I18n.format("item.structurelib.constructableTrigger.gui.add")));
|
I18n.format("item.structurelib.constructableTrigger.gui.add")));
|
||||||
addButton(
|
addButton(
|
||||||
new GuiButton(
|
new GuiButton(
|
||||||
UNSET_BTN,
|
1,
|
||||||
guiLeft + 65,
|
guiLeft + 65,
|
||||||
guiTop + 157,
|
guiTop + 157,
|
||||||
47,
|
47,
|
||||||
@@ -153,27 +144,13 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
I18n.format("item.structurelib.constructableTrigger.gui.unset")));
|
I18n.format("item.structurelib.constructableTrigger.gui.unset")));
|
||||||
addButton(
|
addButton(
|
||||||
new GuiButton(
|
new GuiButton(
|
||||||
WIPE_BTN,
|
2,
|
||||||
guiLeft + 118,
|
guiLeft + 118,
|
||||||
guiTop + 157,
|
guiTop + 157,
|
||||||
47,
|
47,
|
||||||
20,
|
20,
|
||||||
I18n.format("item.structurelib.constructableTrigger.gui.wipe")));
|
I18n.format("item.structurelib.constructableTrigger.gui.wipe")));
|
||||||
|
|
||||||
addButton(
|
|
||||||
new GuiButton(
|
|
||||||
SHOW_ERROR_BTN,
|
|
||||||
StructureLib.isGTLoaded ? guiLeft + 12 : guiLeft + 52,
|
|
||||||
guiTop + 180,
|
|
||||||
73,
|
|
||||||
20,
|
|
||||||
""));
|
|
||||||
|
|
||||||
// only show GT hatch button if GT is loaded
|
|
||||||
if (StructureLib.isGTLoaded) {
|
|
||||||
addButton(new GuiButton(GT_NO_HATCH_BTN, guiLeft + 92, guiTop + 180, 73, 20, ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +171,7 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getYSize() {
|
public int getYSize() {
|
||||||
return 211;
|
return 188;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -273,27 +250,10 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
// STACKOVERFLOW!
|
// STACKOVERFLOW!
|
||||||
String keyText = key.getText();
|
String keyText = key.getText();
|
||||||
boolean existing = !StringUtils.isEmpty(keyText) && ChannelDataAccessor.hasSubChannel(trigger, keyText);
|
boolean existing = !StringUtils.isEmpty(keyText) && ChannelDataAccessor.hasSubChannel(trigger, keyText);
|
||||||
getButtonList().get(ADD_BTN).displayString = existing
|
getButtonList().get(0).displayString = existing ? I18n.format("item.structurelib.constructableTrigger.gui.set")
|
||||||
? I18n.format("item.structurelib.constructableTrigger.gui.set")
|
|
||||||
: I18n.format("item.structurelib.constructableTrigger.gui.add");
|
: I18n.format("item.structurelib.constructableTrigger.gui.add");
|
||||||
getButtonList().get(ADD_BTN).enabled = !StringUtils.isBlank(value.getText());
|
getButtonList().get(0).enabled = !StringUtils.isBlank(value.getText());
|
||||||
getButtonList().get(UNSET_BTN).enabled = existing && !StringUtils.isBlank(value.getText());
|
getButtonList().get(1).enabled = existing && !StringUtils.isBlank(value.getText());
|
||||||
|
|
||||||
if (ChannelDataAccessor.hasSubChannel(trigger, SHOW_ERROR_CHANNEL)) {
|
|
||||||
getButtonList().get(SHOW_ERROR_BTN).displayString = "Hide Errors";
|
|
||||||
} else {
|
|
||||||
getButtonList().get(SHOW_ERROR_BTN).displayString = "Show Errors";
|
|
||||||
}
|
|
||||||
|
|
||||||
// this button only exists if GT is loaded.
|
|
||||||
if (StructureLib.isGTLoaded) {
|
|
||||||
if (ChannelDataAccessor.hasSubChannel(trigger, GT_NO_HATCH_CHANNEL)) {
|
|
||||||
getButtonList().get(GT_NO_HATCH_BTN).displayString = "Hatches";
|
|
||||||
} else {
|
|
||||||
getButtonList().get(GT_NO_HATCH_BTN).displayString = "No Hatch";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getValue() {
|
private int getValue() {
|
||||||
@@ -308,35 +268,18 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
protected void actionPerformed(GuiButton btn) {
|
protected void actionPerformed(GuiButton btn) {
|
||||||
if (btn == null) return;
|
if (btn == null) return;
|
||||||
switch (btn.id) {
|
switch (btn.id) {
|
||||||
case ADD_BTN:
|
case 0:
|
||||||
int value = getValue();
|
int value = getValue();
|
||||||
if (value <= 0) return;
|
if (value <= 0) return;
|
||||||
ChannelDataAccessor.setChannelData(trigger, key.getText(), value);
|
ChannelDataAccessor.setChannelData(trigger, key.getText(), value);
|
||||||
break;
|
break;
|
||||||
case UNSET_BTN:
|
case 1:
|
||||||
ChannelDataAccessor.unsetChannelData(trigger, key.getText());
|
ChannelDataAccessor.unsetChannelData(trigger, key.getText());
|
||||||
break;
|
break;
|
||||||
case WIPE_BTN:
|
case 2:
|
||||||
ChannelDataAccessor.wipeChannelData(trigger);
|
ChannelDataAccessor.wipeChannelData(trigger);
|
||||||
break;
|
break;
|
||||||
case SHOW_ERROR_BTN:
|
|
||||||
if (ChannelDataAccessor.hasSubChannel(trigger, SHOW_ERROR_CHANNEL)) {
|
|
||||||
ChannelDataAccessor.unsetChannelData(trigger, SHOW_ERROR_CHANNEL);
|
|
||||||
} else {
|
|
||||||
ChannelDataAccessor.setChannelData(trigger, SHOW_ERROR_CHANNEL, 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GT_NO_HATCH_BTN:
|
|
||||||
if (ChannelDataAccessor.hasSubChannel(trigger, GT_NO_HATCH_CHANNEL)) {
|
|
||||||
ChannelDataAccessor.unsetChannelData(trigger, GT_NO_HATCH_CHANNEL);
|
|
||||||
} else {
|
|
||||||
ChannelDataAccessor.setChannelData(trigger, GT_NO_HATCH_CHANNEL, 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtons();
|
|
||||||
|
|
||||||
super.actionPerformed(btn);
|
super.actionPerformed(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,7 +350,6 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
|||||||
Entry<String, Integer> e = getElementAt(elementIndex);
|
Entry<String, Integer> e = getElementAt(elementIndex);
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
ChannelDataAccessor.unsetChannelData(trigger, e.getKey());
|
ChannelDataAccessor.unsetChannelData(trigger, e.getKey());
|
||||||
updateButtons();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
import com.gtnewhorizon.structurelib.StructureLib;
|
import com.gtnewhorizon.structurelib.StructureLib;
|
||||||
import com.gtnewhorizon.structurelib.StructureLibAPI;
|
import com.gtnewhorizon.structurelib.StructureLibAPI;
|
||||||
import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor;
|
|
||||||
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
|
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
|
||||||
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
|||||||
* itself.</li>
|
* itself.</li>
|
||||||
* <li>The "C" position would be the number of blocks between you and controller, not counting controller itself.</li>
|
* <li>The "C" position would be the number of blocks between you and controller, not counting controller itself.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param <T> Type of the context object. Usually this will be the multiblock controller.
|
* @param <T> Type of the context object. Usually this will be the multiblock controller.
|
||||||
*/
|
*/
|
||||||
public interface IStructureDefinition<T> {
|
public interface IStructureDefinition<T> {
|
||||||
@@ -73,7 +72,7 @@ public interface IStructureDefinition<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a structure check.
|
* Run a structure check.
|
||||||
*
|
*
|
||||||
* @param object context object. usually multiblock controller.
|
* @param object context object. usually multiblock controller.
|
||||||
* @param piece the structure piece's string identifier.
|
* @param piece the structure piece's string identifier.
|
||||||
* @param world the world object this check takes place in.
|
* @param world the world object this check takes place in.
|
||||||
@@ -108,7 +107,7 @@ public interface IStructureDefinition<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawn hint particles. Should not be called on server side.
|
* Spawn hint particles. Should not be called on server side.
|
||||||
*
|
*
|
||||||
* @param object context object. usually multiblock controller.
|
* @param object context object. usually multiblock controller.
|
||||||
* @param piece the structure piece's string identifier.
|
* @param piece the structure piece's string identifier.
|
||||||
* @param world the world object this check takes place in.
|
* @param world the world object this check takes place in.
|
||||||
@@ -321,7 +320,7 @@ public interface IStructureDefinition<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Low level utility.
|
* Low level utility.
|
||||||
*
|
*
|
||||||
* @param object context object. usually multiblock controller.
|
* @param object context object. usually multiblock controller.
|
||||||
* @param trigger The trigger item that contains channel data.
|
* @param trigger The trigger item that contains channel data.
|
||||||
* @param elements the structure piece
|
* @param elements the structure piece
|
||||||
@@ -395,10 +394,6 @@ public interface IStructureDefinition<T> {
|
|||||||
basePositionC,
|
basePositionC,
|
||||||
ignoreBlockUnloaded((e, w, x, y, z, a, b, c) -> {
|
ignoreBlockUnloaded((e, w, x, y, z, a, b, c) -> {
|
||||||
e.spawnHint(object, world, x, y, z, trigger);
|
e.spawnHint(object, world, x, y, z, trigger);
|
||||||
if (ChannelDataAccessor.hasSubChannel(trigger, "show_error")
|
|
||||||
&& !e.couldBeValid(object, world, x, y, z, trigger)) {
|
|
||||||
StructureLibAPI.markHintParticleError(StructureLib.getCurrentPlayer(), world, x, y, z);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
"spawnHint");
|
"spawnHint");
|
||||||
@@ -425,7 +420,7 @@ public interface IStructureDefinition<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of builder.
|
* Create a new instance of builder.
|
||||||
*
|
*
|
||||||
* @param <T> type of context object
|
* @param <T> type of context object
|
||||||
*/
|
*/
|
||||||
static <T> StructureDefinition.Builder<T> builder() {
|
static <T> StructureDefinition.Builder<T> builder() {
|
||||||
|
|||||||
@@ -32,16 +32,6 @@ public interface IStructureElement<T> {
|
|||||||
|
|
||||||
boolean check(T t, World world, int x, int y, int z);
|
boolean check(T t, World world, int x, int y, int z);
|
||||||
|
|
||||||
/**
|
|
||||||
* Pure (stateless and side effect free) function to test if current block could be valid. Used to give user hints
|
|
||||||
* about incorrectly placed blocks given a controller and trigger item. If couldBeValid(...) == false for a set of
|
|
||||||
* channels, with those same tiers, check(...) == false. Not required, defaults to true which is always safe but
|
|
||||||
* won't give the user error hints.
|
|
||||||
*/
|
|
||||||
default boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger);
|
boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger);
|
||||||
|
|
||||||
boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger);
|
boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger);
|
||||||
@@ -195,11 +185,6 @@ public interface IStructureElement<T> {
|
|||||||
return IStructureElement.this.check(t, world, x, y, z);
|
return IStructureElement.this.check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return IStructureElement.this.couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return IStructureElement.this.spawnHint(t, world, x, y, z, trigger);
|
return IStructureElement.this.spawnHint(t, world, x, y, z, trigger);
|
||||||
|
|||||||
@@ -31,16 +31,6 @@ public interface IStructureElementChain<T> extends IStructureElement<T> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
for (IStructureElement<T> fallback : fallbacks()) {
|
|
||||||
if (fallback.couldBeValid(t, world, x, y, z, trigger)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
for (IStructureElement<T> fallback : fallbacks()) {
|
for (IStructureElement<T> fallback : fallbacks()) {
|
||||||
@@ -72,8 +62,7 @@ public interface IStructureElementChain<T> extends IStructureElement<T> {
|
|||||||
if (e == null) continue;
|
if (e == null) continue;
|
||||||
if (predicate == null) predicate = e.getPredicate();
|
if (predicate == null) predicate = e.getPredicate();
|
||||||
else predicate = predicate.or(e.getPredicate());
|
else predicate = predicate.or(e.getPredicate());
|
||||||
Iterable<ItemStack> stacks = e.getStacks();
|
is.add(e.getStacks());
|
||||||
if (stacks != null) is.add(stacks);
|
|
||||||
}
|
}
|
||||||
if (predicate == null) return null;
|
if (predicate == null) return null;
|
||||||
return new BlocksToPlace(predicate, Iterables.concat(is));
|
return new BlocksToPlace(predicate, Iterables.concat(is));
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ public interface IStructureElementCheckOnly<T> extends IStructureElement<T> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ interface IStructureNavigate<T> extends IStructureElement<T> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ class LazyStructureElement<T> implements IStructureElementDeferred<T> {
|
|||||||
return get(t).check(t, world, x, y, z);
|
return get(t).check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return get(t).couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return get(t).placeBlock(t, world, x, y, z, trigger);
|
return get(t).placeBlock(t, world, x, y, z, trigger);
|
||||||
|
|||||||
@@ -155,11 +155,6 @@ public class StructureUtility {
|
|||||||
return world.isAirBlock(x, y, z);
|
return world.isAirBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(Object t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 13);
|
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 13);
|
||||||
@@ -191,11 +186,6 @@ public class StructureUtility {
|
|||||||
return !world.isAirBlock(x, y, z);
|
return !world.isAirBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(Object t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 14);
|
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 14);
|
||||||
@@ -235,11 +225,6 @@ public class StructureUtility {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(Object t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 15);
|
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 15);
|
||||||
@@ -494,11 +479,6 @@ public class StructureUtility {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), meta);
|
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), meta);
|
||||||
@@ -519,11 +499,6 @@ public class StructureUtility {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, icons.get());
|
StructureLibAPI.hintParticle(world, x, y, z, icons.get());
|
||||||
@@ -544,11 +519,6 @@ public class StructureUtility {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticleTinted(world, x, y, z, icons.get(), RGBa);
|
StructureLibAPI.hintParticleTinted(world, x, y, z, icons.get(), RGBa);
|
||||||
@@ -697,23 +667,9 @@ public class StructureUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Pair<Block, Integer> getHint(ItemStack trigger) {
|
private Pair<Block, Integer> getHint(ItemStack trigger) {
|
||||||
if (hints.isEmpty()) return null;
|
|
||||||
return hints.get(Math.min(Math.max(trigger.stackSize, 1), hints.size()) - 1);
|
return hints.get(Math.min(Math.max(trigger.stackSize, 1), hints.size()) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
Pair<Block, Integer> hint = getHint(trigger);
|
|
||||||
if (hint == null) return true;
|
|
||||||
TIER hintTier = tierExtractor.convert(hint.getKey(), hint.getValue());
|
|
||||||
Block block = world.getBlock(x, y, z);
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
TIER worldTier = tierExtractor.convert(block, meta);
|
|
||||||
|
|
||||||
// if the block is in the same tier as the hint block, this could be valid
|
|
||||||
return Objects.equals(hintTier, worldTier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
Pair<Block, Integer> hint = getHint(trigger);
|
Pair<Block, Integer> hint = getHint(trigger);
|
||||||
@@ -811,11 +767,6 @@ public class StructureUtility {
|
|||||||
return world.getBlock(x, y, z) == getBlock() && (wildcard || world.getBlockMetadata(x, y, z) == meta);
|
return world.getBlock(x, y, z) == getBlock() && (wildcard || world.getBlockMetadata(x, y, z) == meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
if (getBlock() == null) return error().spawnHint(t, world, x, y, z, trigger);
|
if (getBlock() == null) return error().spawnHint(t, world, x, y, z, trigger);
|
||||||
@@ -890,16 +841,10 @@ public class StructureUtility {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean check(T t, World world, int x, int y, int z) {
|
public boolean check(T t, World world, int x, int y, int z) {
|
||||||
if (init()) return world.getBlock(x, y, z) == block && world.getBlockMetadata(x, y, z) == meta;
|
if (init()) return world.getBlock(x, y, z) != block && world.getBlockMetadata(x, y, z) == meta;
|
||||||
else return fallback.check(t, world, x, y, z);
|
else return fallback.check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
if (init()) return world.getBlock(x, y, z) == block && world.getBlockMetadata(x, y, z) == meta;
|
|
||||||
else return fallback.couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
if (init()) {
|
if (init()) {
|
||||||
@@ -976,11 +921,6 @@ public class StructureUtility {
|
|||||||
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
|
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
||||||
@@ -1018,11 +958,6 @@ public class StructureUtility {
|
|||||||
.contains(worldBlock.getDamageValue(world, x, y, z));
|
.contains(worldBlock.getDamageValue(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
||||||
@@ -1047,11 +982,6 @@ public class StructureUtility {
|
|||||||
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
|
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
||||||
@@ -1086,13 +1016,6 @@ public class StructureUtility {
|
|||||||
return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
|
return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
// calling iBlockAdder can potentially modify external state
|
|
||||||
// therefore we assume this can always be valid.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
||||||
@@ -1126,11 +1049,6 @@ public class StructureUtility {
|
|||||||
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
|
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
||||||
@@ -1175,11 +1093,6 @@ public class StructureUtility {
|
|||||||
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
|
return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
||||||
@@ -1245,11 +1158,6 @@ public class StructureUtility {
|
|||||||
.contains(worldBlock.getDamageValue(world, x, y, z));
|
.contains(worldBlock.getDamageValue(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
||||||
@@ -1295,11 +1203,6 @@ public class StructureUtility {
|
|||||||
.contains(worldBlock.getDamageValue(world, x, y, z));
|
.contains(worldBlock.getDamageValue(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
||||||
@@ -1357,11 +1260,6 @@ public class StructureUtility {
|
|||||||
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
|
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
||||||
@@ -1389,11 +1287,6 @@ public class StructureUtility {
|
|||||||
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
|
return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
||||||
@@ -1430,11 +1323,6 @@ public class StructureUtility {
|
|||||||
return block == world.getBlock(x, y, z);
|
return block == world.getBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
||||||
@@ -1462,11 +1350,6 @@ public class StructureUtility {
|
|||||||
return block == world.getBlock(x, y, z);
|
return block == world.getBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return check(t, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
||||||
@@ -1533,13 +1416,6 @@ public class StructureUtility {
|
|||||||
return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
|
return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
// calling iBlockAdder can potentially modify external state
|
|
||||||
// therefore we assume this can always be valid.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta);
|
||||||
@@ -1579,13 +1455,6 @@ public class StructureUtility {
|
|||||||
return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
|
return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
// calling iBlockAdder can potentially modify external state
|
|
||||||
// therefore we assume this can always be valid.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
world.setBlock(x, y, z, defaultBlock, defaultMeta, 2);
|
||||||
@@ -1641,13 +1510,6 @@ public class StructureUtility {
|
|||||||
return iTileAdder.apply(t, tileEntity);
|
return iTileAdder.apply(t, tileEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
// calling iTileAdder can potentially modify external state
|
|
||||||
// therefore we assume this can always be valid.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
||||||
@@ -1674,13 +1536,6 @@ public class StructureUtility {
|
|||||||
return tileClass.isInstance(tileEntity) && iTileAdder.test(t, tileClass.cast(tileEntity));
|
return tileClass.isInstance(tileEntity) && iTileAdder.test(t, tileClass.cast(tileEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
// calling iTileAdder can potentially modify external state
|
|
||||||
// therefore we assume this can always be valid.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
StructureLibAPI.hintParticle(world, x, y, z, hintBlock, hintMeta);
|
||||||
@@ -1714,11 +1569,6 @@ public class StructureUtility {
|
|||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return element.couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return element.placeBlock(t, world, x, y, z, trigger);
|
return element.placeBlock(t, world, x, y, z, trigger);
|
||||||
@@ -1770,11 +1620,6 @@ public class StructureUtility {
|
|||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return element.couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return element.placeBlock(t, world, x, y, z, trigger);
|
return element.placeBlock(t, world, x, y, z, trigger);
|
||||||
@@ -1833,13 +1678,6 @@ public class StructureUtility {
|
|||||||
return predicate.test(t) && downstream.check(t, world, x, y, z);
|
return predicate.test(t) && downstream.check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
// this COULD potentially impact external state
|
|
||||||
// but predicate really should not have side effects
|
|
||||||
return predicate.test(t) && downstream.couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return predicate.test(t) && downstream.spawnHint(t, world, x, y, z, trigger);
|
return predicate.test(t) && downstream.spawnHint(t, world, x, y, z, trigger);
|
||||||
@@ -1936,11 +1774,6 @@ public class StructureUtility {
|
|||||||
return elem.check(t.getCurrentContext(), world, x, y, z);
|
return elem.check(t.getCurrentContext(), world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return elem.couldBeValid(t.getCurrentContext(), world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return elem.spawnHint(t.getCurrentContext(), world, x, y, z, trigger);
|
return elem.spawnHint(t.getCurrentContext(), world, x, y, z, trigger);
|
||||||
@@ -2028,11 +1861,6 @@ public class StructureUtility {
|
|||||||
return to.get().check(t, world, x, y, z);
|
return to.get().check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return to.get().couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return to.get().placeBlock(t, world, x, y, z, trigger);
|
return to.get().placeBlock(t, world, x, y, z, trigger);
|
||||||
@@ -2086,11 +1914,6 @@ public class StructureUtility {
|
|||||||
return to.apply(t).check(t, world, x, y, z);
|
return to.apply(t).check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return to.apply(t).couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return to.apply(t).placeBlock(t, world, x, y, z, trigger);
|
return to.apply(t).placeBlock(t, world, x, y, z, trigger);
|
||||||
@@ -2303,11 +2126,6 @@ public class StructureUtility {
|
|||||||
return to.apply(t, null).check(t, world, x, y, z);
|
return to.apply(t, null).check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return to.apply(t, trigger).couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger);
|
return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger);
|
||||||
@@ -2500,11 +2318,6 @@ public class StructureUtility {
|
|||||||
return toCheck.apply(t).check(t, world, x, y, z);
|
return toCheck.apply(t).check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
return to.apply(t, trigger).couldBeValid(t, world, x, y, z, trigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger);
|
return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger);
|
||||||
@@ -2749,11 +2562,6 @@ public class StructureUtility {
|
|||||||
return backing.check(t, world, x, y, z);
|
return backing.check(t, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean couldBeValid(T t, World world, int x, int y, int z, ItemStack trigger) {
|
|
||||||
ItemStack newTrigger = ChannelDataAccessor.withChannel(trigger, channel);
|
|
||||||
return backing.couldBeValid(t, world, x, y, z, newTrigger);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||||
ItemStack newTrigger = ChannelDataAccessor.withChannel(trigger, channel);
|
ItemStack newTrigger = ChannelDataAccessor.withChannel(trigger, channel);
|
||||||
// We know spawnHint will only be called on client side, so the lack of player isn't quite an issue
|
// We know spawnHint will only be called on client side, so the lack of player isn't quite an issue
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.gtnewhorizon.structurelib.util;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.NavigableMap;
|
|
||||||
import java.util.Spliterator;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class SortedRegistry<V> implements Iterable<V> {
|
|
||||||
|
|
||||||
private final NavigableMap<String, V> store = new TreeMap<>();
|
|
||||||
/**
|
|
||||||
* Store stuff in an array for faster iteration access than a red black tree
|
|
||||||
*/
|
|
||||||
private List<V> baked = Collections.emptyList();
|
|
||||||
|
|
||||||
public void register(String key, V val) {
|
|
||||||
if (key == null || val == null) throw new NullPointerException();
|
|
||||||
V old = store.putIfAbsent(key, val);
|
|
||||||
if (old != null) {
|
|
||||||
throw new IllegalArgumentException("Duplicate key: " + key);
|
|
||||||
}
|
|
||||||
// TODO allow a user to edit the order with a configuration file
|
|
||||||
baked = new ArrayList<>(store.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int size() {
|
|
||||||
return store.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return store.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean containsKey(String key) {
|
|
||||||
return store.containsKey(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean containsValue(V value) {
|
|
||||||
return store.containsValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public V get(String key) {
|
|
||||||
return store.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<V> iterator() {
|
|
||||||
return baked.iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void forEach(Consumer<? super V> action) {
|
|
||||||
baked.forEach(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Spliterator<V> spliterator() {
|
|
||||||
return baked.spliterator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
tile.structurelib.blockhint.name=Hint
|
|
||||||
tile.structurelib.blockhint.0.name=Hint 1 dot
|
tile.structurelib.blockhint.0.name=Hint 1 dot
|
||||||
tile.structurelib.blockhint.1.name=Hint 2 dots
|
tile.structurelib.blockhint.1.name=Hint 2 dots
|
||||||
tile.structurelib.blockhint.2.name=Hint 3 dots
|
tile.structurelib.blockhint.2.name=Hint 3 dots
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
tile.structurelib.blockhint.name=提示方块
|
|
||||||
tile.structurelib.blockhint.0.name=提示方块:1号
|
tile.structurelib.blockhint.0.name=提示方块:1号
|
||||||
tile.structurelib.blockhint.1.name=提示方块:2号
|
tile.structurelib.blockhint.1.name=提示方块:2号
|
||||||
tile.structurelib.blockhint.2.name=提示方块:3号
|
tile.structurelib.blockhint.2.name=提示方块:3号
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 6.6 KiB |
Reference in new issue
Block a user