Recipe fixes, replaced spaces with tabs
This commit is contained in:
parent
5ca6a92dd0
commit
d8de624fd1
60 changed files with 1816 additions and 1851 deletions
|
@ -5,10 +5,10 @@ BCLib is a library mod for BetterX team mods, developed for Fabric, MC 1.18
|
|||
## Features:
|
||||
### Rendering
|
||||
* Emissive textures (with _e suffix)
|
||||
* Can be applied to Solid and Transparent blocks;
|
||||
* Can be changed/added with resourcepacks;
|
||||
* Incompatible with Sodium and Canvas (just will be not rendered);
|
||||
* Incompatible with Iris shaders (Iris without shaders works fine).
|
||||
* Can be applied to Solid and Transparent blocks;
|
||||
* Can be changed/added with resourcepacks;
|
||||
* Incompatible with Sodium and Canvas (just will be not rendered);
|
||||
* Incompatible with Iris shaders (Iris without shaders works fine).
|
||||
* Procedural block and item models (from paterns or from code);
|
||||
* Block render interfaces.
|
||||
|
||||
|
|
30
bclib.gradle
30
bclib.gradle
|
@ -3,9 +3,9 @@ buildscript {
|
|||
classpath 'org.kohsuke:github-api:1.114'
|
||||
}
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
@ -15,16 +15,16 @@ version = project.mod_version
|
|||
group = project.maven_group
|
||||
|
||||
repositories {
|
||||
maven { url "https://maven.dblsaiko.net/" }
|
||||
maven { url "https://server.bbkr.space:8081/artifactory/libs-release/" }
|
||||
maven { url "https://maven.dblsaiko.net/" }
|
||||
maven { url "https://server.bbkr.space:8081/artifactory/libs-release/" }
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.shedaniel.me/" }
|
||||
maven { url 'https://maven.blamejared.com' }
|
||||
maven { url 'https://maven.blamejared.com' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/bclib.accesswidener")
|
||||
accessWidenerPath = file("src/main/resources/bclib.accesswidener")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -40,7 +40,7 @@ processResources {
|
|||
println "Version: ${project.mod_version}"
|
||||
inputs.property "version", project.mod_version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.mod_version
|
||||
}
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ processResources {
|
|||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
it.options.release = 17
|
||||
it.options.release = 17
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.tags = [ "reason" ]
|
||||
options.stylesheetFile = new File(projectDir, "javadoc.css");
|
||||
options.stylesheetFile = new File(projectDir, "javadoc.css");
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
|
@ -134,12 +134,12 @@ publishing {
|
|||
}
|
||||
|
||||
configurations {
|
||||
dev {
|
||||
canBeResolved = false
|
||||
canBeConsumed = true
|
||||
}
|
||||
dev {
|
||||
canBeResolved = false
|
||||
canBeConsumed = true
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
dev jar
|
||||
dev jar
|
||||
}
|
||||
|
|
884
javadoc.css
884
javadoc.css
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,9 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class TagAPI {
|
|||
* Get or create {@link Tag.Named}.
|
||||
*
|
||||
* @param containerSupplier - {@link TagCollection} {@link Supplier} tag collection;
|
||||
* @param id - {@link ResourceLocation} tag id.
|
||||
* @param id - {@link ResourceLocation} tag id.
|
||||
* @return {@link Tag.Named}.
|
||||
*/
|
||||
public static <T> Tag.Named<T> makeTag(Supplier<TagCollection<T>> containerSupplier, ResourceLocation id) {
|
||||
|
@ -194,7 +194,7 @@ public class TagAPI {
|
|||
* The call will reserve the Tag. The Tag is added to the blocks once
|
||||
* {@link #apply(String, Map)} was executed.
|
||||
*
|
||||
* @param tag The new Tag
|
||||
* @param tag The new Tag
|
||||
* @param blocks One or more blocks that should receive the Tag.
|
||||
*/
|
||||
public static void addTag(Tag.Named<Block> tag, Block... blocks) {
|
||||
|
@ -282,7 +282,7 @@ public class TagAPI {
|
|||
* In most cases there is no need to call this Method manually.
|
||||
*
|
||||
* @param directory The name of the Tag-directory. Should be either <i>"tags/blocks"</i> or
|
||||
* <i>"tags/items"</i>.
|
||||
* <i>"tags/items"</i>.
|
||||
* @param tagsMap The map that will hold the registered Tags
|
||||
* @return The {@code tagsMap} Parameter.
|
||||
*/
|
||||
|
|
|
@ -27,8 +27,6 @@ import net.minecraft.world.level.levelgen.GenerationStep;
|
|||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.Noises;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules.SequenceRuleSource;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
|
@ -38,7 +36,6 @@ import ru.bclib.util.ColorUtil;
|
|||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.bclib.world.features.BCLFeature;
|
||||
import ru.bclib.world.structures.BCLStructureFeature;
|
||||
import ru.bclib.world.surface.DoubleBlockSurfaceNoiseCondition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -35,7 +35,6 @@ import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Carving;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
|
@ -68,7 +67,6 @@ import ru.bclib.world.structures.BCLStructureFeature;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
@ -182,7 +180,7 @@ public class BiomeAPI {
|
|||
Random random = new Random(biome.getID().hashCode());
|
||||
|
||||
//temperature, humidity, continentalness, erosion, depth, weirdness, offset
|
||||
Climate.ParameterPoint parameters = Climate.parameters(
|
||||
Climate.ParameterPoint parameters = Climate.parameters(
|
||||
MHelper.randRange(-1.5F, 1.5F, random),
|
||||
MHelper.randRange(-1.5F, 1.5F, random),
|
||||
MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18
|
||||
|
|
|
@ -111,7 +111,7 @@ public class DataExchangeAPI extends DataExchange {
|
|||
/**
|
||||
* Registers a File for automatic client syncing.
|
||||
*
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param fileName The name of the File
|
||||
*/
|
||||
public static void addAutoSyncFile(String modID, File fileName) {
|
||||
|
@ -124,9 +124,9 @@ public class DataExchangeAPI extends DataExchange {
|
|||
* The file is synced of the {@link SyncFileHash} on client and server are not equal. This method will not copy the
|
||||
* configs content from the client to the server.
|
||||
*
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param uniqueID A unique Identifier for the File. (see {@link SyncFileHash#uniqueID} for
|
||||
* Details
|
||||
* Details
|
||||
* @param fileName The name of the File
|
||||
*/
|
||||
public static void addAutoSyncFile(String modID, String uniqueID, File fileName) {
|
||||
|
@ -143,8 +143,8 @@ public class DataExchangeAPI extends DataExchange {
|
|||
* if the File needs to be copied. Normally using the {@link SyncFileHash}
|
||||
* for comparison is sufficient.
|
||||
*
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param fileName The name of the File
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param fileName The name of the File
|
||||
* @param needTransfer If the predicate returns true, the file needs to get copied to the server.
|
||||
*/
|
||||
public static void addAutoSyncFile(String modID, File fileName, NeedTransferPredicate needTransfer) {
|
||||
|
@ -161,10 +161,10 @@ public class DataExchangeAPI extends DataExchange {
|
|||
* if the File needs to be copied. Normally using the {@link SyncFileHash}
|
||||
* for comparison is sufficient.
|
||||
*
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param uniqueID A unique Identifier for the File. (see {@link SyncFileHash#uniqueID} for
|
||||
* Details
|
||||
* @param fileName The name of the File
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param uniqueID A unique Identifier for the File. (see {@link SyncFileHash#uniqueID} for
|
||||
* Details
|
||||
* @param fileName The name of the File
|
||||
* @param needTransfer If the predicate returns true, the file needs to get copied to the server.
|
||||
*/
|
||||
public static void addAutoSyncFile(String modID, String uniqueID, File fileName, NeedTransferPredicate needTransfer) {
|
||||
|
|
|
@ -16,93 +16,93 @@ import java.util.Objects;
|
|||
* identical.
|
||||
*/
|
||||
public class SyncFileHash extends AutoSyncID {
|
||||
public final FileHash hash;
|
||||
public final FileHash hash;
|
||||
|
||||
SyncFileHash(String modID, File file, byte[] md5, int size, int value) {
|
||||
this(modID, file.getName(), md5, size, value);
|
||||
}
|
||||
SyncFileHash(String modID, File file, byte[] md5, int size, int value) {
|
||||
this(modID, file.getName(), md5, size, value);
|
||||
}
|
||||
|
||||
SyncFileHash(String modID, String uniqueID, byte[] md5, int size, int value) {
|
||||
this(modID, uniqueID, new FileHash(md5, size, value));
|
||||
}
|
||||
|
||||
SyncFileHash(String modID, File file, FileHash hash) {
|
||||
this(modID, file.getName(), hash);
|
||||
}
|
||||
|
||||
SyncFileHash(String modID, String uniqueID, FileHash hash) {
|
||||
super(modID, uniqueID);
|
||||
this.hash = hash;
|
||||
}
|
||||
SyncFileHash(String modID, String uniqueID, byte[] md5, int size, int value) {
|
||||
this(modID, uniqueID, new FileHash(md5, size, value));
|
||||
}
|
||||
|
||||
SyncFileHash(String modID, File file, FileHash hash) {
|
||||
this(modID, file.getName(), hash);
|
||||
}
|
||||
|
||||
SyncFileHash(String modID, String uniqueID, FileHash hash) {
|
||||
super(modID, uniqueID);
|
||||
this.hash = hash;
|
||||
}
|
||||
|
||||
|
||||
final static NeedTransferPredicate NEED_TRANSFER = (clientHash, serverHash, content)-> !clientHash.equals(serverHash);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString()+": "+hash.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SyncFileHash)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
SyncFileHash that = (SyncFileHash) o;
|
||||
return hash.equals(that.hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the Object to a buffer
|
||||
* @param buf The buffer to write to
|
||||
*/
|
||||
public void serialize(FriendlyByteBuf buf) {
|
||||
hash.serialize(buf);
|
||||
DataHandler.writeString(buf, modID);
|
||||
DataHandler.writeString(buf, uniqueID);
|
||||
}
|
||||
final static NeedTransferPredicate NEED_TRANSFER = (clientHash, serverHash, content)-> !clientHash.equals(serverHash);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString()+": "+hash.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SyncFileHash)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
SyncFileHash that = (SyncFileHash) o;
|
||||
return hash.equals(that.hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the Object to a buffer
|
||||
* @param buf The buffer to write to
|
||||
*/
|
||||
public void serialize(FriendlyByteBuf buf) {
|
||||
hash.serialize(buf);
|
||||
DataHandler.writeString(buf, modID);
|
||||
DataHandler.writeString(buf, uniqueID);
|
||||
}
|
||||
|
||||
/**
|
||||
*Deserialize a Buffer to a new {@link SyncFileHash}-Object
|
||||
* @param buf Thea buffer to read from
|
||||
* @return The received String
|
||||
*/
|
||||
public static SyncFileHash deserialize(FriendlyByteBuf buf){
|
||||
final FileHash hash = FileHash.deserialize(buf);
|
||||
final String modID = DataHandler.readString(buf);
|
||||
final String uniqueID = DataHandler.readString(buf);
|
||||
/**
|
||||
*Deserialize a Buffer to a new {@link SyncFileHash}-Object
|
||||
* @param buf Thea buffer to read from
|
||||
* @return The received String
|
||||
*/
|
||||
public static SyncFileHash deserialize(FriendlyByteBuf buf){
|
||||
final FileHash hash = FileHash.deserialize(buf);
|
||||
final String modID = DataHandler.readString(buf);
|
||||
final String uniqueID = DataHandler.readString(buf);
|
||||
|
||||
return new SyncFileHash(modID, uniqueID, hash);
|
||||
}
|
||||
return new SyncFileHash(modID, uniqueID, hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link SyncFileHash}.
|
||||
* <p>
|
||||
* Will call {@link #create(String, File, String)} using the name of the File as {@code uniqueID}.
|
||||
* @param modID ID of the calling Mod
|
||||
* @param file The input file
|
||||
*
|
||||
* @return A new Instance. You can compare instances using {@link #equals(Object)} to determine if two files are
|
||||
* identical. Will return {@code null} when an error occurs or the File does not exist
|
||||
*/
|
||||
public static SyncFileHash create(String modID, File file){
|
||||
return create(modID, file, file.getName());
|
||||
}
|
||||
/**
|
||||
* Create a new {@link SyncFileHash}.
|
||||
* <p>
|
||||
* Will call {@link #create(String, File, String)} using the name of the File as {@code uniqueID}.
|
||||
* @param modID ID of the calling Mod
|
||||
* @param file The input file
|
||||
*
|
||||
* @return A new Instance. You can compare instances using {@link #equals(Object)} to determine if two files are
|
||||
* identical. Will return {@code null} when an error occurs or the File does not exist
|
||||
*/
|
||||
public static SyncFileHash create(String modID, File file){
|
||||
return create(modID, file, file.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link SyncFileHash}.
|
||||
* @param modID ID of the calling Mod
|
||||
* @param file The input file
|
||||
* @param uniqueID The unique ID that is used for this File (see {@link SyncFileHash#uniqueID} for Details.
|
||||
* @return A new Instance. You can compare instances using {@link #equals(Object)} to determine if two files are
|
||||
* identical. Will return {@code null} when an error occurs or the File does not exist
|
||||
*/
|
||||
public static SyncFileHash create(String modID, File file, String uniqueID){
|
||||
return new SyncFileHash(modID, uniqueID, FileHash.create(file));
|
||||
}
|
||||
/**
|
||||
* Create a new {@link SyncFileHash}.
|
||||
* @param modID ID of the calling Mod
|
||||
* @param file The input file
|
||||
* @param uniqueID The unique ID that is used for this File (see {@link SyncFileHash#uniqueID} for Details.
|
||||
* @return A new Instance. You can compare instances using {@link #equals(Object)} to determine if two files are
|
||||
* identical. Will return {@code null} when an error occurs or the File does not exist
|
||||
*/
|
||||
public static SyncFileHash create(String modID, File file, String uniqueID){
|
||||
return new SyncFileHash(modID, uniqueID, FileHash.create(file));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,15 +68,15 @@ public class AutoSync {
|
|||
/**
|
||||
* Registers a File for automatic client syncing.
|
||||
*
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param needTransfer If the predicate returns true, the file needs to get copied to the server.
|
||||
* @param fileName The name of the File
|
||||
* @param fileName The name of the File
|
||||
* @param requestContent When {@code true} the content of the file is requested for comparison. This will copy the
|
||||
* entire file from the client to the server.
|
||||
* <p>
|
||||
* You should only use this option, if you need to compare parts of the file in order to decide
|
||||
* If the File needs to be copied. Normally using the {@link SyncFileHash}
|
||||
* for comparison is sufficient.
|
||||
* entire file from the client to the server.
|
||||
* <p>
|
||||
* You should only use this option, if you need to compare parts of the file in order to decide
|
||||
* If the File needs to be copied. Normally using the {@link SyncFileHash}
|
||||
* for comparison is sufficient.
|
||||
*/
|
||||
public static void addAutoSyncFileData(String modID, File fileName, boolean requestContent, NeedTransferPredicate needTransfer) {
|
||||
if (!PathUtil.isChildOf(PathUtil.GAME_FOLDER, fileName.toPath())){
|
||||
|
@ -89,17 +89,17 @@ public class AutoSync {
|
|||
/**
|
||||
* Registers a File for automatic client syncing.
|
||||
*
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param uniqueID A unique Identifier for the File. (see {@link SyncFileHash#uniqueID} for
|
||||
* Details
|
||||
* @param modID The ID of the calling Mod
|
||||
* @param uniqueID A unique Identifier for the File. (see {@link SyncFileHash#uniqueID} for
|
||||
* Details
|
||||
* @param needTransfer If the predicate returns true, the file needs to get copied to the server.
|
||||
* @param fileName The name of the File
|
||||
* @param fileName The name of the File
|
||||
* @param requestContent When {@code true} the content of the file is requested for comparison. This will copy the
|
||||
* entire file from the client to the server.
|
||||
* <p>
|
||||
* You should only use this option, if you need to compare parts of the file in order to decide
|
||||
* If the File needs to be copied. Normally using the {@link SyncFileHash}
|
||||
* for comparison is sufficient.
|
||||
* entire file from the client to the server.
|
||||
* <p>
|
||||
* You should only use this option, if you need to compare parts of the file in order to decide
|
||||
* If the File needs to be copied. Normally using the {@link SyncFileHash}
|
||||
* for comparison is sufficient.
|
||||
*/
|
||||
public static void addAutoSyncFileData(String modID, String uniqueID, File fileName, boolean requestContent, NeedTransferPredicate needTransfer) {
|
||||
if (!PathUtil.isChildOf(PathUtil.GAME_FOLDER, fileName.toPath())){
|
||||
|
|
|
@ -120,7 +120,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
final boolean canDownload = size>0 && Configs.SERVER_CONFIG.isOfferingMods() && (Configs.SERVER_CONFIG.isOfferingAllMods() || inmods.contains(modID));
|
||||
buf.writeBoolean(canDownload);
|
||||
|
||||
BCLib.LOGGER.info(" - Listing Mod " + modID + " v" + ver + " (size: " + PathUtil.humanReadableFileSize(size) + ", download="+canDownload+")");
|
||||
BCLib.LOGGER.info(" - Listing Mod " + modID + " v" + ver + " (size: " + PathUtil.humanReadableFileSize(size) + ", download="+canDownload+")");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -140,7 +140,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
buf.writeInt(existingAutoSyncFiles.size());
|
||||
for (AutoFileSyncEntry entry : existingAutoSyncFiles) {
|
||||
entry.serialize(buf);
|
||||
BCLib.LOGGER.info(" - Offering " + (entry.isConfigFile() ? "Config " : "File ") + entry);
|
||||
BCLib.LOGGER.info(" - Offering " + (entry.isConfigFile() ? "Config " : "File ") + entry);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -151,7 +151,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
if (Configs.SERVER_CONFIG.isOfferingFiles()) {
|
||||
buf.writeInt(AutoSync.syncFolderDescriptions.size());
|
||||
AutoSync.syncFolderDescriptions.forEach(desc -> {
|
||||
BCLib.LOGGER.info(" - Offering Folder " + desc.localFolder + " (allowDelete=" + desc.removeAdditionalFiles + ")");
|
||||
BCLib.LOGGER.info(" - Offering Folder " + desc.localFolder + " (allowDelete=" + desc.removeAdditionalFiles + ")");
|
||||
desc.serialize(buf);
|
||||
});
|
||||
}
|
||||
|
@ -238,13 +238,13 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
//desc contains the fileCache sent from the server, load the local version to get hold of the actual file cache on the client
|
||||
SyncFolderDescriptor localDescriptor = AutoSync.getSyncFolderDescriptor(desc.folderID);
|
||||
if (localDescriptor != null) {
|
||||
BCLib.LOGGER.info(" - " + desc.folderID + " (" + desc.localFolder + ", allowRemove=" + desc.removeAdditionalFiles + ")");
|
||||
BCLib.LOGGER.info(" - " + desc.folderID + " (" + desc.localFolder + ", allowRemove=" + desc.removeAdditionalFiles + ")");
|
||||
localDescriptor.invalidateCache();
|
||||
|
||||
desc.relativeFilesStream()
|
||||
.filter(desc::discardChildElements)
|
||||
.forEach(subFile -> {
|
||||
BCLib.LOGGER.warning(" * " + subFile.relPath + " (REJECTED)");
|
||||
BCLib.LOGGER.warning(" * " + subFile.relPath + " (REJECTED)");
|
||||
});
|
||||
|
||||
|
||||
|
@ -256,7 +256,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
.map(absPath -> new AutoSyncID.ForDirectFileRequest(desc.folderID, absPath.toFile()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
additionalFiles.forEach(aid -> BCLib.LOGGER.info(" * " + desc.localFolder.relativize(aid.relFile.toPath()) + " (missing on server)"));
|
||||
additionalFiles.forEach(aid -> BCLib.LOGGER.info(" * " + desc.localFolder.relativize(aid.relFile.toPath()) + " (missing on server)"));
|
||||
filesToRemove.addAll(additionalFiles);
|
||||
}
|
||||
|
||||
|
@ -267,16 +267,16 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
if (localSubFile != null) {
|
||||
//the file exists locally, check if the hashes match
|
||||
if (!localSubFile.hash.equals(subFile.hash)) {
|
||||
BCLib.LOGGER.info(" * " + subFile.relPath + " (changed)");
|
||||
BCLib.LOGGER.info(" * " + subFile.relPath + " (changed)");
|
||||
filesToRequest.add(new AutoSyncID.ForDirectFileRequest(desc.folderID, new File(subFile.relPath)));
|
||||
}
|
||||
else {
|
||||
BCLib.LOGGER.info(" * " + subFile.relPath);
|
||||
BCLib.LOGGER.info(" * " + subFile.relPath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//the file is missing locally
|
||||
BCLib.LOGGER.info(" * " + subFile.relPath + " (missing on client)");
|
||||
BCLib.LOGGER.info(" * " + subFile.relPath + " (missing on client)");
|
||||
filesToRequest.add(new AutoSyncID.ForDirectFileRequest(desc.folderID, new File(subFile.relPath)));
|
||||
}
|
||||
});
|
||||
|
@ -285,7 +285,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
localDescriptor.invalidateCache();
|
||||
}
|
||||
else {
|
||||
BCLib.LOGGER.info(" - " + desc.folderID + " (Failed to find)");
|
||||
BCLib.LOGGER.info(" - " + desc.folderID + " (Failed to find)");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -320,11 +320,11 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
}
|
||||
}
|
||||
|
||||
BCLib.LOGGER.info(" - " + e + ": " + actionString);
|
||||
BCLib.LOGGER.info(" - " + e + ": " + actionString);
|
||||
if (debugHashes) {
|
||||
BCLib.LOGGER.info(" * " + e.serverHash + " (Server)");
|
||||
BCLib.LOGGER.info(" * " + e.localMatch.getFileHash() + " (Client)");
|
||||
BCLib.LOGGER.info(" * local Content " + (contentWrapper.getRawContent() == null));
|
||||
BCLib.LOGGER.info(" * " + e.serverHash + " (Server)");
|
||||
BCLib.LOGGER.info(" * " + e.localMatch.getFileHash() + " (Client)");
|
||||
BCLib.LOGGER.info(" * local Content " + (contentWrapper.getRawContent() == null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
final OfferedModInfo serverInfo = e.getValue();
|
||||
final boolean requestMod = !serverInfo.version.equals(localVersion) && serverInfo.size > 0 && serverInfo.canDownload;
|
||||
|
||||
BCLib.LOGGER.info(" - " + e.getKey() + " (client=" + localVersion + ", server=" + serverInfo.version + ", size=" + PathUtil.humanReadableFileSize(serverInfo.size) + (requestMod ? ", requesting" : "") + (serverInfo.canDownload ? "" :", not offered")+ ")");
|
||||
BCLib.LOGGER.info(" - " + e.getKey() + " (client=" + localVersion + ", server=" + serverInfo.version + ", size=" + PathUtil.humanReadableFileSize(serverInfo.size) + (requestMod ? ", requesting" : "") + (serverInfo.canDownload ? "" :", not offered")+ ")");
|
||||
if (requestMod) {
|
||||
filesToRequest.add(new AutoSyncID.ForModFileRequest(e.getKey(), serverInfo.version));
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
}
|
||||
if (removeFiles) {
|
||||
filesToRemove.forEach(aid -> {
|
||||
BCLib.LOGGER.info(" - " + aid.relFile + " (removing)");
|
||||
BCLib.LOGGER.info(" - " + aid.relFile + " (removing)");
|
||||
aid.relFile.delete();
|
||||
});
|
||||
}
|
||||
|
@ -469,13 +469,13 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
private void processOfferedFile(List<AutoSyncID> requestFiles, AutoSyncID aid) {
|
||||
if (aid instanceof WithContentOverride) {
|
||||
final WithContentOverride aidc = (WithContentOverride) aid;
|
||||
BCLib.LOGGER.info(" - " + aid + " (updating Content)");
|
||||
BCLib.LOGGER.info(" - " + aid + " (updating Content)");
|
||||
|
||||
SendFiles.writeSyncedFile(aid, aidc.contentWrapper.getRawContent(), aidc.localFile);
|
||||
}
|
||||
else {
|
||||
requestFiles.add(aid);
|
||||
BCLib.LOGGER.info(" - " + aid + " (requesting)");
|
||||
BCLib.LOGGER.info(" - " + aid + " (requesting)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.io.File;
|
|||
* This message is sent once a player enters the world. It initiates a sequence of Messages that will sync files between both
|
||||
* client and server.
|
||||
* <table>
|
||||
* <caption>Description</caption>
|
||||
* <caption>Description</caption>
|
||||
* <tr>
|
||||
* <th>Server</th>
|
||||
* <th></th>
|
||||
|
|
|
@ -66,7 +66,7 @@ public class RequestFiles extends DataHandler.FromClient {
|
|||
for (int i = 0; i < size; i++) {
|
||||
AutoSyncID asid = AutoSyncID.deserializeData(buf);
|
||||
files.add(asid);
|
||||
BCLib.LOGGER.info(" - " + asid);
|
||||
BCLib.LOGGER.info(" - " + asid);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
BCLib.LOGGER.info("Sending " + existingFiles.size() + " Files to Client:");
|
||||
for (AutoFileSyncEntry entry : existingFiles) {
|
||||
int length = entry.serializeContent(buf);
|
||||
BCLib.LOGGER.info(" - " + entry + " (" + PathUtil.humanReadableFileSize(length) + ")");
|
||||
BCLib.LOGGER.info(" - " + entry + " (" + PathUtil.humanReadableFileSize(length) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
} else {
|
||||
type = "Ignoring ";
|
||||
}
|
||||
BCLib.LOGGER.info(" - " + type + p.first + " (" + PathUtil.humanReadableFileSize(p.second.length) + ")");
|
||||
BCLib.LOGGER.info(" - " + type + p.first + " (" + PathUtil.humanReadableFileSize(p.second.length) + ")");
|
||||
}
|
||||
else {
|
||||
BCLib.LOGGER.error(" - Failed to receive File " + p.third + ", possibly sent from a Mod that is not installed on the client.");
|
||||
|
@ -173,7 +173,7 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
} while (path.toFile().exists());
|
||||
}
|
||||
|
||||
BCLib.LOGGER.info(" - Writing " + path + " (" + PathUtil.humanReadableFileSize(data.length) + ")");
|
||||
BCLib.LOGGER.info(" - Writing " + path + " (" + PathUtil.humanReadableFileSize(data.length) + ")");
|
||||
try {
|
||||
final File parentFile = path.getParent()
|
||||
.toFile();
|
||||
|
@ -192,7 +192,7 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
collisionFreeName = String.format("%03d", count) + "_" + bakFileName;
|
||||
} while (targetPath.toFile().exists());
|
||||
|
||||
BCLib.LOGGER.info(" - Moving " + removeAfter + " to " +targetPath);
|
||||
BCLib.LOGGER.info(" - Moving " + removeAfter + " to " +targetPath);
|
||||
removeAfter.toFile().renameTo(targetPath.toFile());
|
||||
}
|
||||
AutoSync.didReceiveFile(e, fileName);
|
||||
|
@ -200,7 +200,7 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
|
||||
}
|
||||
catch (IOException ioException) {
|
||||
BCLib.LOGGER.error(" --> Writing " + fileName + " failed: " + ioException);
|
||||
BCLib.LOGGER.error(" --> Writing " + fileName + " failed: " + ioException);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ public class SyncFolderDescriptor {
|
|||
buf.writeBoolean(removeAdditionalFiles);
|
||||
buf.writeInt(fileCache.size());
|
||||
fileCache.forEach(fl -> {
|
||||
BCLib.LOGGER.info(" - " + fl.relPath);
|
||||
BCLib.LOGGER.info(" - " + fl.relPath);
|
||||
if (debugHashes) {
|
||||
BCLib.LOGGER.info(" " + fl.hash);
|
||||
BCLib.LOGGER.info(" " + fl.hash);
|
||||
}
|
||||
fl.serialize(buf);
|
||||
});
|
||||
|
|
|
@ -108,7 +108,7 @@ public class DataFixerAPI {
|
|||
* {@code Minecraft.getInstance().getLevelSource()}
|
||||
* @param levelID The ID of the Level you want to patch
|
||||
* @param showUI {@code true}, if you want to present the user with a Screen that offers to backup the world
|
||||
* before applying the patches
|
||||
* before applying the patches
|
||||
* @param onResume When this method retursn {@code true}, this function will be called when the world is ready
|
||||
* @return {@code true} if the UI was displayed. The UI is only displayed if {@code showUI} was {@code true} and
|
||||
* patches were enabled in the config and the Guardian did find any patches that need to be applied to the world.
|
||||
|
@ -123,7 +123,7 @@ public class DataFixerAPI {
|
|||
*
|
||||
* @param levelStorageAccess The access class of the level you want to patch
|
||||
* @param showUI {@code true}, if you want to present the user with a Screen that offers to backup the world
|
||||
* before applying the patches
|
||||
* before applying the patches
|
||||
* @param onResume When this method retursn {@code true}, this function will be called when the world is ready
|
||||
* @return {@code true} if the UI was displayed. The UI is only displayed if {@code showUI} was {@code true} and
|
||||
* patches were enabled in the config and the Guardian did find any patches that need to be applied to the world.
|
||||
|
|
|
@ -70,12 +70,12 @@ public abstract class Patch {
|
|||
* inconsistencies are found.
|
||||
*
|
||||
* @param modID The ID of the Mod you want to register a patch for. This should be your
|
||||
* ModID only. The ModID can not be {@code null} or an empty String.
|
||||
* ModID only. The ModID can not be {@code null} or an empty String.
|
||||
* @param version The mod-version that introduces the patch. This needs Semantic-Version String
|
||||
* like x.x.x. Developers are responsible for registering their patches in the correct
|
||||
* order (with increasing versions). You are not allowed to register a new
|
||||
* Patch with a version lower or equal than
|
||||
* {@link Patch#maxPatchVersion(String)}
|
||||
* like x.x.x. Developers are responsible for registering their patches in the correct
|
||||
* order (with increasing versions). You are not allowed to register a new
|
||||
* Patch with a version lower or equal than
|
||||
* {@link Patch#maxPatchVersion(String)}
|
||||
*/
|
||||
protected Patch(@NotNull String modID, String version) {
|
||||
this(modID, version, false);
|
||||
|
@ -85,10 +85,10 @@ public abstract class Patch {
|
|||
* Internal Constructor used to create patches that can allways run (no matter what patchlevel a level has)
|
||||
* @param modID The ID of the Mod
|
||||
* @param version The mod-version that introduces the patch. When {@Code runAllways} is set, this version will
|
||||
* determine the patchlevel that is written to the level
|
||||
* determine the patchlevel that is written to the level
|
||||
* @param alwaysApply When true, this patch is always active, no matter the patchlevel of the world.
|
||||
* This should be used sparingly and just for patches that apply to level.dat (as they only take
|
||||
* effect when changes are detected). Use {@link ForcedLevelPatch} to instatiate.
|
||||
* This should be used sparingly and just for patches that apply to level.dat (as they only take
|
||||
* effect when changes are detected). Use {@link ForcedLevelPatch} to instatiate.
|
||||
*/
|
||||
Patch(@NotNull String modID, String version, boolean alwaysApply) {
|
||||
//Patchlevels need to be unique and registered in ascending order
|
||||
|
@ -201,11 +201,11 @@ public abstract class Patch {
|
|||
* a {@link CompoundTag}. If the Path contains a non-leaf {@link net.minecraft.nbt.ListTag}, all members of that
|
||||
* list will be processed. For example:
|
||||
* <pre>
|
||||
* - global +
|
||||
* | - key (String)
|
||||
* | - items (List) +
|
||||
* | - { id (String) }
|
||||
* | - { id (String) }
|
||||
* - global +
|
||||
* | - key (String)
|
||||
* | - items (List) +
|
||||
* | - { id (String) }
|
||||
* | - { id (String) }
|
||||
* </pre>
|
||||
* The path <b>global.items.id</b> will fix all <i>id</i>-entries in the <i>items</i>-list, while the path
|
||||
* <b>global.key</b> will only fix the <i>key</i>-entry.
|
||||
|
|
|
@ -221,7 +221,7 @@ public class SurfaceRuleBuilder {
|
|||
/**
|
||||
* Set biome floor with specified {@link BlockState} and the given Noise Function. The rule is added with priority 3.
|
||||
* @param surfaceBlockA {@link BlockState} for the ground cover.
|
||||
* @param surfaceBlockB {@link BlockState} for the alternative ground cover.
|
||||
* @param surfaceBlockB {@link BlockState} for the alternative ground cover.
|
||||
* @param noise The {@link NoiseCondition}
|
||||
* @return same {@link SurfaceRuleBuilder} instance.
|
||||
*/
|
||||
|
|
|
@ -19,8 +19,8 @@ import java.util.function.Consumer;
|
|||
* <p>
|
||||
* This Block-Type will:
|
||||
* <ul>
|
||||
* <li>Drop itself</li>
|
||||
* <li>Automatically create an Item-Model from the Block-Model</li>
|
||||
* <li>Drop itself</li>
|
||||
* <li>Automatically create an Item-Model from the Block-Model</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class BaseBlock extends Block implements BlockModelProvider {
|
||||
|
@ -63,7 +63,7 @@ public class BaseBlock extends Block implements BlockModelProvider {
|
|||
* For example in {@link BaseLeavesBlock#BaseLeavesBlock(Block, MaterialColor, Consumer)}
|
||||
*
|
||||
* @param customizeProperties A {@link Consumer} to call with the preset properties
|
||||
* @param settings The properties as created by the Block
|
||||
* @param settings The properties as created by the Block
|
||||
* @return The reconfigured {@code settings}
|
||||
*/
|
||||
static FabricBlockSettings acceptAndReturn(Consumer<FabricBlockSettings> customizeProperties, FabricBlockSettings settings) {
|
||||
|
|
|
@ -3,14 +3,14 @@ package ru.bclib.blocks;
|
|||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
public class LeveledAnvilBlock extends BaseAnvilBlock{
|
||||
protected final int level;
|
||||
protected final int level;
|
||||
|
||||
public LeveledAnvilBlock(MaterialColor color, int level) {
|
||||
super(color);
|
||||
this.level = level;
|
||||
}
|
||||
public LeveledAnvilBlock(MaterialColor color, int level) {
|
||||
super(color);
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getCraftingLevel() {
|
||||
return level;
|
||||
}
|
||||
public int getCraftingLevel() {
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ public class OBJBlockModel implements UnbakedModel, BakedModel {
|
|||
if (member.contains("/")) {
|
||||
String[] sub = member.split("/");
|
||||
vertexIndex.add(Integer.parseInt(sub[0]) - 1); // Vertex
|
||||
uvIndex.add(Integer.parseInt(sub[1]) - 1); // UV
|
||||
uvIndex.add(Integer.parseInt(sub[1]) - 1); // UV
|
||||
}
|
||||
else {
|
||||
vertexIndex.add(Integer.parseInt(member) - 1); // Vertex
|
||||
|
|
|
@ -55,7 +55,7 @@ public class UnbakedQuad {
|
|||
float z = data[dataIndex++]; // Z
|
||||
POS.set(x, y, z, 0);
|
||||
POS.transform(matrix);
|
||||
vertexData[index] = Float.floatToIntBits(POS.x()); // X
|
||||
vertexData[index] = Float.floatToIntBits(POS.x()); // X
|
||||
vertexData[index | 1] = Float.floatToIntBits(POS.y()); // Y
|
||||
vertexData[index | 2] = Float.floatToIntBits(POS.z()); // Z
|
||||
vertexData[index | 3] = -1; // Unknown constant
|
||||
|
|
|
@ -39,372 +39,372 @@ import ru.bclib.complexmaterials.entry.RecipeEntry;
|
|||
import ru.bclib.recipes.GridRecipe;
|
||||
|
||||
public class WoodenComplexMaterial extends ComplexMaterial {
|
||||
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material");
|
||||
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material");
|
||||
|
||||
public static final String BLOCK_CRAFTING_TABLE = "crafting_table";
|
||||
public static final String BLOCK_STRIPPED_BARK = "stripped_bark";
|
||||
public static final String BLOCK_STRIPPED_LOG = "stripped_log";
|
||||
public static final String BLOCK_PRESSURE_PLATE = "plate";
|
||||
public static final String BLOCK_BOOKSHELF = "bookshelf";
|
||||
public static final String BLOCK_COMPOSTER = "composter";
|
||||
public static final String BLOCK_TRAPDOOR = "trapdoor";
|
||||
public static final String BLOCK_BARREL = "barrel";
|
||||
public static final String BLOCK_BUTTON = "button";
|
||||
public static final String BLOCK_LADDER = "ladder";
|
||||
public static final String BLOCK_PLANKS = "planks";
|
||||
public static final String BLOCK_STAIRS = "stairs";
|
||||
public static final String BLOCK_CHEST = "chest";
|
||||
public static final String BLOCK_FENCE = "fence";
|
||||
public static final String BLOCK_BARK = "bark";
|
||||
public static final String BLOCK_DOOR = "door";
|
||||
public static final String BLOCK_GATE = "gate";
|
||||
public static final String BLOCK_SIGN = "sign";
|
||||
public static final String BLOCK_SLAB = "slab";
|
||||
public static final String BLOCK_LOG = "log";
|
||||
public static final String BLOCK_CRAFTING_TABLE = "crafting_table";
|
||||
public static final String BLOCK_STRIPPED_BARK = "stripped_bark";
|
||||
public static final String BLOCK_STRIPPED_LOG = "stripped_log";
|
||||
public static final String BLOCK_PRESSURE_PLATE = "plate";
|
||||
public static final String BLOCK_BOOKSHELF = "bookshelf";
|
||||
public static final String BLOCK_COMPOSTER = "composter";
|
||||
public static final String BLOCK_TRAPDOOR = "trapdoor";
|
||||
public static final String BLOCK_BARREL = "barrel";
|
||||
public static final String BLOCK_BUTTON = "button";
|
||||
public static final String BLOCK_LADDER = "ladder";
|
||||
public static final String BLOCK_PLANKS = "planks";
|
||||
public static final String BLOCK_STAIRS = "stairs";
|
||||
public static final String BLOCK_CHEST = "chest";
|
||||
public static final String BLOCK_FENCE = "fence";
|
||||
public static final String BLOCK_BARK = "bark";
|
||||
public static final String BLOCK_DOOR = "door";
|
||||
public static final String BLOCK_GATE = "gate";
|
||||
public static final String BLOCK_SIGN = "sign";
|
||||
public static final String BLOCK_SLAB = "slab";
|
||||
public static final String BLOCK_LOG = "log";
|
||||
|
||||
public static final String TAG_LOGS = "logs";
|
||||
public static final String TAG_LOGS = "logs";
|
||||
|
||||
public final MaterialColor planksColor;
|
||||
public final MaterialColor woodColor;
|
||||
public final MaterialColor planksColor;
|
||||
public final MaterialColor woodColor;
|
||||
|
||||
public WoodenComplexMaterial(String modID, String baseName, String receipGroupPrefix, MaterialColor woodColor, MaterialColor planksColor) {
|
||||
super(modID, baseName, receipGroupPrefix);
|
||||
this.planksColor = planksColor;
|
||||
this.woodColor = woodColor;
|
||||
}
|
||||
public WoodenComplexMaterial(String modID, String baseName, String receipGroupPrefix, MaterialColor woodColor, MaterialColor planksColor) {
|
||||
super(modID, baseName, receipGroupPrefix);
|
||||
this.planksColor = planksColor;
|
||||
this.woodColor = woodColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FabricBlockSettings getBlockSettings() {
|
||||
return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)
|
||||
.materialColor(planksColor);
|
||||
}
|
||||
@Override
|
||||
protected FabricBlockSettings getBlockSettings() {
|
||||
return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)
|
||||
.materialColor(planksColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getMaterialID() {
|
||||
return MATERIAL_ID;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getMaterialID() {
|
||||
return MATERIAL_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initTags() {
|
||||
addBlockTag(TagAPI.makeBlockTag(getModID(), getBaseName() + "_logs"));
|
||||
addItemTag(TagAPI.makeItemTag(getModID(), getBaseName() + "_logs"));
|
||||
}
|
||||
@Override
|
||||
protected void initTags() {
|
||||
addBlockTag(TagAPI.makeBlockTag(getModID(), getBaseName() + "_logs"));
|
||||
addItemTag(TagAPI.makeItemTag(getModID(), getBaseName() + "_logs"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
initBase(blockSettings, itemSettings);
|
||||
initStorage(blockSettings, itemSettings);
|
||||
initDecorations(blockSettings, itemSettings);
|
||||
}
|
||||
@Override
|
||||
protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
initBase(blockSettings, itemSettings);
|
||||
initStorage(blockSettings, itemSettings);
|
||||
initDecorations(blockSettings, itemSettings);
|
||||
}
|
||||
|
||||
final protected void initBase(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
Tag.Named<Block> tagBlockLog = getBlockTag(TAG_LOGS);
|
||||
Tag.Named<Item> tagItemLog = getItemTag(TAG_LOGS);
|
||||
final protected void initBase(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
Tag.Named<Block> tagBlockLog = getBlockTag(TAG_LOGS);
|
||||
Tag.Named<Item> tagItemLog = getItemTag(TAG_LOGS);
|
||||
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_STRIPPED_LOG, (complexMaterial, settings) -> {
|
||||
return new BaseRotatedPillarBlock(settings);
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_STRIPPED_BARK, (complexMaterial, settings) -> {
|
||||
return new BaseBarkBlock(settings);
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_STRIPPED_LOG, (complexMaterial, settings) -> {
|
||||
return new BaseRotatedPillarBlock(settings);
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_STRIPPED_BARK, (complexMaterial, settings) -> {
|
||||
return new BaseBarkBlock(settings);
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_LOG, (complexMaterial, settings) -> {
|
||||
return new BaseStripableLogBlock(woodColor, getBlock(BLOCK_STRIPPED_LOG));
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_BARK, (complexMaterial, settings) -> {
|
||||
return new StripableBarkBlock(woodColor, getBlock(BLOCK_STRIPPED_BARK));
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(new BlockEntry(BLOCK_PLANKS, (complexMaterial, settings) -> {
|
||||
return new BaseBlock(settings);
|
||||
}).setBlockTags(BlockTags.PLANKS)
|
||||
.setItemTags(ItemTags.PLANKS));
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_LOG, (complexMaterial, settings) -> {
|
||||
return new BaseStripableLogBlock(woodColor, getBlock(BLOCK_STRIPPED_LOG));
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(
|
||||
new BlockEntry(BLOCK_BARK, (complexMaterial, settings) -> {
|
||||
return new StripableBarkBlock(woodColor, getBlock(BLOCK_STRIPPED_BARK));
|
||||
})
|
||||
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
|
||||
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
|
||||
);
|
||||
addBlockEntry(new BlockEntry(BLOCK_PLANKS, (complexMaterial, settings) -> {
|
||||
return new BaseBlock(settings);
|
||||
}).setBlockTags(BlockTags.PLANKS)
|
||||
.setItemTags(ItemTags.PLANKS));
|
||||
|
||||
addBlockEntry(new BlockEntry(BLOCK_STAIRS, (complexMaterial, settings) -> {
|
||||
return new BaseStairsBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS)
|
||||
.setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_SLAB, (complexMaterial, settings) -> {
|
||||
return new BaseSlabBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS)
|
||||
.setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_FENCE, (complexMaterial, settings) -> {
|
||||
return new BaseFenceBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES)
|
||||
.setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_GATE, (complexMaterial, settings) -> {
|
||||
return new BaseGateBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.FENCE_GATES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_BUTTON, (complexMaterial, settings) -> {
|
||||
return new BaseWoodenButtonBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS)
|
||||
.setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_PRESSURE_PLATE, (complexMaterial, settings) -> {
|
||||
return new WoodenPressurePlateBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES)
|
||||
.setItemTags(ItemTags.WOODEN_PRESSURE_PLATES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_TRAPDOOR, (complexMaterial, settings) -> {
|
||||
return new BaseTrapdoorBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS)
|
||||
.setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_DOOR, (complexMaterial, settings) -> {
|
||||
return new BaseDoorBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS)
|
||||
.setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_STAIRS, (complexMaterial, settings) -> {
|
||||
return new BaseStairsBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS)
|
||||
.setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_SLAB, (complexMaterial, settings) -> {
|
||||
return new BaseSlabBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS)
|
||||
.setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_FENCE, (complexMaterial, settings) -> {
|
||||
return new BaseFenceBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES)
|
||||
.setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_GATE, (complexMaterial, settings) -> {
|
||||
return new BaseGateBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.FENCE_GATES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_BUTTON, (complexMaterial, settings) -> {
|
||||
return new BaseWoodenButtonBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS)
|
||||
.setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_PRESSURE_PLATE, (complexMaterial, settings) -> {
|
||||
return new WoodenPressurePlateBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES)
|
||||
.setItemTags(ItemTags.WOODEN_PRESSURE_PLATES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_TRAPDOOR, (complexMaterial, settings) -> {
|
||||
return new BaseTrapdoorBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS)
|
||||
.setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_DOOR, (complexMaterial, settings) -> {
|
||||
return new BaseDoorBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS)
|
||||
.setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS));
|
||||
|
||||
|
||||
addBlockEntry(new BlockEntry(BLOCK_LADDER, (complexMaterial, settings) -> {
|
||||
return new BaseLadderBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.CLIMBABLE));
|
||||
addBlockEntry(new BlockEntry(BLOCK_SIGN, (complexMaterial, settings) -> {
|
||||
return new BaseSignBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.SIGNS)
|
||||
.setItemTags(ItemTags.SIGNS));
|
||||
addBlockEntry(new BlockEntry(BLOCK_LADDER, (complexMaterial, settings) -> {
|
||||
return new BaseLadderBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.CLIMBABLE));
|
||||
addBlockEntry(new BlockEntry(BLOCK_SIGN, (complexMaterial, settings) -> {
|
||||
return new BaseSignBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(BlockTags.SIGNS)
|
||||
.setItemTags(ItemTags.SIGNS));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
addBlockEntry(new BlockEntry(BLOCK_CHEST, (complexMaterial, settings) -> {
|
||||
return new BaseChestBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_CHEST, TagAPI.BLOCK_WOODEN_CHEST)
|
||||
.setItemTags(TagAPI.ITEM_CHEST, TagAPI.ITEM_WOODEN_CHEST));
|
||||
final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
addBlockEntry(new BlockEntry(BLOCK_CHEST, (complexMaterial, settings) -> {
|
||||
return new BaseChestBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_CHEST, TagAPI.BLOCK_WOODEN_CHEST)
|
||||
.setItemTags(TagAPI.ITEM_CHEST, TagAPI.ITEM_WOODEN_CHEST));
|
||||
|
||||
addBlockEntry(new BlockEntry(BLOCK_BARREL, (complexMaterial, settings) -> {
|
||||
return new BaseBarrelBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_BARREL, TagAPI.BLOCK_WOODEN_BARREL)
|
||||
.setItemTags(TagAPI.ITEM_BARREL, TagAPI.ITEM_WOODEN_BARREL));
|
||||
}
|
||||
addBlockEntry(new BlockEntry(BLOCK_BARREL, (complexMaterial, settings) -> {
|
||||
return new BaseBarrelBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_BARREL, TagAPI.BLOCK_WOODEN_BARREL)
|
||||
.setItemTags(TagAPI.ITEM_BARREL, TagAPI.ITEM_WOODEN_BARREL));
|
||||
}
|
||||
|
||||
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
addBlockEntry(new BlockEntry(BLOCK_CRAFTING_TABLE, (complexMaterial, settings) -> {
|
||||
return new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_WORKBENCHES)
|
||||
.setItemTags(TagAPI.ITEM_WORKBENCHES));
|
||||
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
addBlockEntry(new BlockEntry(BLOCK_CRAFTING_TABLE, (complexMaterial, settings) -> {
|
||||
return new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_WORKBENCHES)
|
||||
.setItemTags(TagAPI.ITEM_WORKBENCHES));
|
||||
|
||||
addBlockEntry(new BlockEntry(BLOCK_BOOKSHELF, (complexMaterial, settings) -> {
|
||||
return new BaseBookshelfBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_BOOKSHELVES));
|
||||
addBlockEntry(new BlockEntry(BLOCK_BOOKSHELF, (complexMaterial, settings) -> {
|
||||
return new BaseBookshelfBlock(getBlock(BLOCK_PLANKS));
|
||||
}).setBlockTags(TagAPI.BLOCK_BOOKSHELVES));
|
||||
|
||||
addBlockEntry(new BlockEntry(BLOCK_COMPOSTER, (complexMaterial, settings) -> {
|
||||
return new BaseComposterBlock(getBlock(BLOCK_PLANKS));
|
||||
}));
|
||||
}
|
||||
addBlockEntry(new BlockEntry(BLOCK_COMPOSTER, (complexMaterial, settings) -> {
|
||||
return new BaseComposterBlock(getBlock(BLOCK_PLANKS));
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initFlammable(FlammableBlockRegistry registry) {
|
||||
getBlocks().forEach(block -> {
|
||||
registry.add(block, 5, 20);
|
||||
});
|
||||
@Override
|
||||
protected void initFlammable(FlammableBlockRegistry registry) {
|
||||
getBlocks().forEach(block -> {
|
||||
registry.add(block, 5, 20);
|
||||
});
|
||||
|
||||
registry.add(getBlock(BLOCK_LOG), 5, 5);
|
||||
registry.add(getBlock(BLOCK_BARK), 5, 5);
|
||||
registry.add(getBlock(BLOCK_STRIPPED_LOG), 5, 5);
|
||||
registry.add(getBlock(BLOCK_STRIPPED_BARK), 5, 5);
|
||||
}
|
||||
registry.add(getBlock(BLOCK_LOG), 5, 5);
|
||||
registry.add(getBlock(BLOCK_BARK), 5, 5);
|
||||
registry.add(getBlock(BLOCK_STRIPPED_LOG), 5, 5);
|
||||
registry.add(getBlock(BLOCK_STRIPPED_BARK), 5, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDefaultRecipes() {
|
||||
Block planks = getBlock(BLOCK_PLANKS);
|
||||
addRecipeEntry(new RecipeEntry("planks", (material, config, id) -> {
|
||||
Block log_stripped = getBlock(BLOCK_STRIPPED_LOG);
|
||||
Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK);
|
||||
Block log = getBlock(BLOCK_LOG);
|
||||
Block bark = getBlock(BLOCK_BARK);
|
||||
GridRecipe.make(id, planks)
|
||||
.checkConfig(config)
|
||||
.setOutputCount(4)
|
||||
.setList("#")
|
||||
.addMaterial('#', log, bark, log_stripped, bark_stripped)
|
||||
.setGroup(receipGroupPrefix + "_planks")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("stairs", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_STAIRS))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(4)
|
||||
.setShape("# ", "## ", "###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_stairs")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("slab", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_SLAB))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(6)
|
||||
.setShape("###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_slabs")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("fence", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_FENCE))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("#I#", "#I#")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_planks_fences")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("gate", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_GATE))
|
||||
.checkConfig(config)
|
||||
.setShape("I#I", "I#I")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_planks_gates")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("button", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BUTTON))
|
||||
.checkConfig(config)
|
||||
.setList("#")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_buttons")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("pressure_plate", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_PRESSURE_PLATE))
|
||||
.checkConfig(config)
|
||||
.setShape("##")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_plates")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("trapdoor", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_TRAPDOOR))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(2)
|
||||
.setShape("###", "###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_trapdoors")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("door", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_DOOR))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("##", "##", "##")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_doors")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("crafting_table", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_CRAFTING_TABLE))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_tables")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("ladder", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_LADDER))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("I I", "I#I", "I I")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_ladders")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("sign", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_SIGN))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("###", "###", " I ")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_signs")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("chest", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_CHEST))
|
||||
.checkConfig(config)
|
||||
.setShape("###", "# #", "###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_chests")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("barrel", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BARREL))
|
||||
.checkConfig(config)
|
||||
.setShape("#S#", "# #", "#S#")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('S', getBlock(BLOCK_SLAB))
|
||||
.setGroup(receipGroupPrefix + "_barrels")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("bookshelf", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BOOKSHELF))
|
||||
.checkConfig(config)
|
||||
.setShape("###", "PPP", "###")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('P', Items.BOOK)
|
||||
.setGroup(receipGroupPrefix + "_bookshelves")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("bark", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BARK))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_LOG))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("log", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_LOG))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_BARK))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("stripped_bark", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_BARK))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_STRIPPED_LOG))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("stripped_log", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_LOG))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_STRIPPED_BARK))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("composter", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_COMPOSTER))
|
||||
.checkConfig(config)
|
||||
.setShape("# #", "# #", "###")
|
||||
.addMaterial('#', getBlock(BLOCK_SLAB))
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("shulker", (material, config, id) -> {
|
||||
GridRecipe.make(id, Blocks.SHULKER_BOX)
|
||||
.checkConfig(config)
|
||||
.setShape("S", "#", "S")
|
||||
.addMaterial('S', Items.SHULKER_SHELL)
|
||||
.addMaterial('#', getBlock(BLOCK_CHEST))
|
||||
.build();
|
||||
}));
|
||||
}
|
||||
@Override
|
||||
public void initDefaultRecipes() {
|
||||
Block planks = getBlock(BLOCK_PLANKS);
|
||||
addRecipeEntry(new RecipeEntry("planks", (material, config, id) -> {
|
||||
Block log_stripped = getBlock(BLOCK_STRIPPED_LOG);
|
||||
Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK);
|
||||
Block log = getBlock(BLOCK_LOG);
|
||||
Block bark = getBlock(BLOCK_BARK);
|
||||
GridRecipe.make(id, planks)
|
||||
.checkConfig(config)
|
||||
.setOutputCount(4)
|
||||
.setList("#")
|
||||
.addMaterial('#', log, bark, log_stripped, bark_stripped)
|
||||
.setGroup(receipGroupPrefix + "_planks")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("stairs", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_STAIRS))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(4)
|
||||
.setShape("# ", "## ", "###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_stairs")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("slab", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_SLAB))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(6)
|
||||
.setShape("###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_slabs")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("fence", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_FENCE))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("#I#", "#I#")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_planks_fences")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("gate", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_GATE))
|
||||
.checkConfig(config)
|
||||
.setShape("I#I", "I#I")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_planks_gates")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("button", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BUTTON))
|
||||
.checkConfig(config)
|
||||
.setList("#")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_buttons")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("pressure_plate", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_PRESSURE_PLATE))
|
||||
.checkConfig(config)
|
||||
.setShape("##")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_planks_plates")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("trapdoor", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_TRAPDOOR))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(2)
|
||||
.setShape("###", "###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_trapdoors")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("door", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_DOOR))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("##", "##", "##")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_doors")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("crafting_table", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_CRAFTING_TABLE))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_tables")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("ladder", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_LADDER))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("I I", "I#I", "I I")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_ladders")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("sign", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_SIGN))
|
||||
.checkConfig(config)
|
||||
.setOutputCount(3)
|
||||
.setShape("###", "###", " I ")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('I', Items.STICK)
|
||||
.setGroup(receipGroupPrefix + "_signs")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("chest", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_CHEST))
|
||||
.checkConfig(config)
|
||||
.setShape("###", "# #", "###")
|
||||
.addMaterial('#', planks)
|
||||
.setGroup(receipGroupPrefix + "_chests")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("barrel", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BARREL))
|
||||
.checkConfig(config)
|
||||
.setShape("#S#", "# #", "#S#")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('S', getBlock(BLOCK_SLAB))
|
||||
.setGroup(receipGroupPrefix + "_barrels")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("bookshelf", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BOOKSHELF))
|
||||
.checkConfig(config)
|
||||
.setShape("###", "PPP", "###")
|
||||
.addMaterial('#', planks)
|
||||
.addMaterial('P', Items.BOOK)
|
||||
.setGroup(receipGroupPrefix + "_bookshelves")
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("bark", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_BARK))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_LOG))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("log", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_LOG))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_BARK))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("stripped_bark", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_BARK))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_STRIPPED_LOG))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("stripped_log", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_LOG))
|
||||
.checkConfig(config)
|
||||
.setShape("##", "##")
|
||||
.addMaterial('#', getBlock(BLOCK_STRIPPED_BARK))
|
||||
.setOutputCount(3)
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("composter", (material, config, id) -> {
|
||||
GridRecipe.make(id, getBlock(BLOCK_COMPOSTER))
|
||||
.checkConfig(config)
|
||||
.setShape("# #", "# #", "###")
|
||||
.addMaterial('#', getBlock(BLOCK_SLAB))
|
||||
.build();
|
||||
}));
|
||||
addRecipeEntry(new RecipeEntry("shulker", (material, config, id) -> {
|
||||
GridRecipe.make(id, Blocks.SHULKER_BOX)
|
||||
.checkConfig(config)
|
||||
.setShape("S", "#", "S")
|
||||
.addMaterial('S', Items.SHULKER_SHELL)
|
||||
.addMaterial('#', getBlock(BLOCK_CHEST))
|
||||
.build();
|
||||
}));
|
||||
}
|
||||
}
|
|
@ -4,45 +4,45 @@ import ru.bclib.BCLib;
|
|||
import ru.bclib.api.dataexchange.handler.autosync.AutoSync;
|
||||
|
||||
public class ClientConfig extends NamedPathConfig {
|
||||
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> ACCEPT_CONFIGS = DependendConfigToken.Boolean(true, "acceptConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> ACCEPT_FILES = DependendConfigToken.Boolean(true, "acceptFiles", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> ACCEPT_MODS = DependendConfigToken.Boolean(false, "acceptMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> DISPLAY_MOD_INFO = DependendConfigToken.Boolean(true, "displayModInfo", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> ACCEPT_CONFIGS = DependendConfigToken.Boolean(true, "acceptConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> ACCEPT_FILES = DependendConfigToken.Boolean(true, "acceptFiles", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> ACCEPT_MODS = DependendConfigToken.Boolean(false, "acceptMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
@ConfigUI(leftPadding = 8)
|
||||
public static final DependendConfigToken<Boolean> DISPLAY_MOD_INFO = DependendConfigToken.Boolean(true, "displayModInfo", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
|
||||
@ConfigUI(topPadding = 12)
|
||||
public static final ConfigToken<Boolean> DEBUG_HASHES = ConfigToken.Boolean(false, "debugHashes", AutoSync.SYNC_CATEGORY);
|
||||
@ConfigUI(topPadding = 12)
|
||||
public static final ConfigToken<Boolean> DEBUG_HASHES = ConfigToken.Boolean(false, "debugHashes", AutoSync.SYNC_CATEGORY);
|
||||
|
||||
|
||||
public ClientConfig() {
|
||||
super(BCLib.MOD_ID, "client", false);
|
||||
}
|
||||
public ClientConfig() {
|
||||
super(BCLib.MOD_ID, "client", false);
|
||||
}
|
||||
|
||||
public boolean shouldPrintDebugHashes() {
|
||||
return get(DEBUG_HASHES);
|
||||
}
|
||||
public boolean shouldPrintDebugHashes() {
|
||||
return get(DEBUG_HASHES);
|
||||
}
|
||||
|
||||
public boolean isAllowingAutoSync() {
|
||||
return get(ENABLED);
|
||||
}
|
||||
public boolean isAllowingAutoSync() {
|
||||
return get(ENABLED);
|
||||
}
|
||||
|
||||
public boolean isAcceptingMods() {
|
||||
return get(ACCEPT_MODS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isAcceptingMods() {
|
||||
return get(ACCEPT_MODS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isAcceptingConfigs() {
|
||||
return get(ACCEPT_CONFIGS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isAcceptingConfigs() {
|
||||
return get(ACCEPT_CONFIGS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isAcceptingFiles() {
|
||||
return get(ACCEPT_FILES) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isAcceptingFiles() {
|
||||
return get(ACCEPT_FILES) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isShowingModInfo() {
|
||||
return get(DISPLAY_MOD_INFO) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isShowingModInfo() {
|
||||
return get(DISPLAY_MOD_INFO) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public final class ConfigKeeper {
|
|||
/**
|
||||
* Called for content based auto-sync.
|
||||
*
|
||||
* @param me - When called in AutoSync this represents the content of the client.
|
||||
* @param me - When called in AutoSync this represents the content of the client.
|
||||
* @param other - When called in AutoSync, this represents the content of the server
|
||||
* @return {@code true} if content was changed
|
||||
*/
|
||||
|
|
|
@ -7,44 +7,44 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class ServerConfig extends NamedPathConfig {
|
||||
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
|
||||
public static final DependendConfigToken<Boolean> OFFER_CONFIGS = DependendConfigToken.Boolean(true, "offerConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final DependendConfigToken<Boolean> OFFER_FILES = DependendConfigToken.Boolean(true, "offerFiles", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final DependendConfigToken<Boolean> OFFER_MODS = DependendConfigToken.Boolean(true, "offerMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final DependendConfigToken<Boolean> OFFER_ALL_MODS = DependendConfigToken.Boolean(false, "offerAllMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(OFFER_MODS));
|
||||
public static final DependendConfigToken<Boolean> SEND_ALL_MOD_INFO = DependendConfigToken.Boolean(false, "sendAllModInfo", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
|
||||
public static final DependendConfigToken<Boolean> OFFER_CONFIGS = DependendConfigToken.Boolean(true, "offerConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final DependendConfigToken<Boolean> OFFER_FILES = DependendConfigToken.Boolean(true, "offerFiles", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final DependendConfigToken<Boolean> OFFER_MODS = DependendConfigToken.Boolean(true, "offerMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
public static final DependendConfigToken<Boolean> OFFER_ALL_MODS = DependendConfigToken.Boolean(false, "offerAllMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(OFFER_MODS));
|
||||
public static final DependendConfigToken<Boolean> SEND_ALL_MOD_INFO = DependendConfigToken.Boolean(false, "sendAllModInfo", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
|
||||
|
||||
|
||||
public static final ConfigToken<List<String>> ADDITIONAL_MODS = ConfigToken.StringArray(new ArrayList<>(0), "additionalMods", AutoSync.SYNC_CATEGORY);
|
||||
public static final ConfigToken<List<String>> EXCLUDED_MODS = ConfigToken.StringArray(new ArrayList<>(0), "excludeMods", AutoSync.SYNC_CATEGORY);
|
||||
public static final ConfigToken<List<String>> ADDITIONAL_MODS = ConfigToken.StringArray(new ArrayList<>(0), "additionalMods", AutoSync.SYNC_CATEGORY);
|
||||
public static final ConfigToken<List<String>> EXCLUDED_MODS = ConfigToken.StringArray(new ArrayList<>(0), "excludeMods", AutoSync.SYNC_CATEGORY);
|
||||
|
||||
|
||||
public ServerConfig() {
|
||||
super(BCLib.MOD_ID, "server", false);
|
||||
}
|
||||
public ServerConfig() {
|
||||
super(BCLib.MOD_ID, "server", false);
|
||||
}
|
||||
|
||||
public boolean isAllowingAutoSync() {
|
||||
return get(ENABLED);
|
||||
}
|
||||
public boolean isAllowingAutoSync() {
|
||||
return get(ENABLED);
|
||||
}
|
||||
|
||||
public boolean isOfferingConfigs() {
|
||||
return get(OFFER_CONFIGS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isOfferingConfigs() {
|
||||
return get(OFFER_CONFIGS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isOfferingFiles() {
|
||||
return get(OFFER_FILES) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isOfferingFiles() {
|
||||
return get(OFFER_FILES) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isOfferingMods() {
|
||||
return get(OFFER_MODS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isOfferingMods() {
|
||||
return get(OFFER_MODS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isOfferingAllMods() {
|
||||
return get(OFFER_ALL_MODS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
public boolean isOfferingAllMods() {
|
||||
return get(OFFER_ALL_MODS) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isOfferingInfosForMods() {
|
||||
return get(SEND_ALL_MOD_INFO) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
public boolean isOfferingInfosForMods() {
|
||||
return get(SEND_ALL_MOD_INFO) /*&& isAllowingAutoSync()*/;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,64 +9,64 @@ import java.util.List;
|
|||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class GridColumn extends GridContainer {
|
||||
GridColumn(double width) {
|
||||
super(width);
|
||||
}
|
||||
GridColumn(double width) {
|
||||
super(width);
|
||||
}
|
||||
|
||||
GridColumn(double width, GridLayout.GridValueType widthType) {
|
||||
super(width, widthType);
|
||||
}
|
||||
GridColumn(double width, GridLayout.GridValueType widthType) {
|
||||
super(width, widthType);
|
||||
}
|
||||
|
||||
public GridRow addRow() {
|
||||
return addRow(VerticalAlignment.TOP);
|
||||
}
|
||||
public GridRow addRow() {
|
||||
return addRow(VerticalAlignment.TOP);
|
||||
}
|
||||
|
||||
public GridRow addRow(VerticalAlignment align) {
|
||||
GridRow row = new GridRow(1.0, widthType==GridValueType.INHERIT?GridValueType.INHERIT:GridLayout.GridValueType.PERCENTAGE, align);
|
||||
this.cells.add(row);
|
||||
return row;
|
||||
}
|
||||
public GridRow addRow(VerticalAlignment align) {
|
||||
GridRow row = new GridRow(1.0, widthType==GridValueType.INHERIT?GridValueType.INHERIT:GridLayout.GridValueType.PERCENTAGE, align);
|
||||
this.cells.add(row);
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
public void addSpacerRow() {
|
||||
this.addSpacerRow(4);
|
||||
}
|
||||
public void addSpacerRow() {
|
||||
this.addSpacerRow(4);
|
||||
}
|
||||
|
||||
public void addSpacerRow(int height) {
|
||||
GridCell cell = new GridCell(1.0, height, GridValueType.PERCENTAGE, null, null);
|
||||
this.cells.add(cell);
|
||||
}
|
||||
public void addSpacerRow(int height) {
|
||||
GridCell cell = new GridCell(1.0, height, GridValueType.PERCENTAGE, null, null);
|
||||
this.cells.add(cell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculateWidth(final int parentWidth){
|
||||
if (widthType == GridValueType.INHERIT) {
|
||||
return cells.stream()
|
||||
.filter(row->row.widthType == GridValueType.INHERIT)
|
||||
.map(row -> row.buildElement(0, 0, 1, 0, 0, null).width)
|
||||
.reduce(0, (p, c) -> Math.max(p, c));
|
||||
@Override
|
||||
public int calculateWidth(final int parentWidth){
|
||||
if (widthType == GridValueType.INHERIT) {
|
||||
return cells.stream()
|
||||
.filter(row->row.widthType == GridValueType.INHERIT)
|
||||
.map(row -> row.buildElement(0, 0, 1, 0, 0, null).width)
|
||||
.reduce(0, (p, c) -> Math.max(p, c));
|
||||
|
||||
} else {
|
||||
return super.calculateWidth(parentWidth);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return super.calculateWidth(parentWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected GridElement buildElementAt(int left, int inTop, int width, final List<GridElement> collector) {
|
||||
int height = 0;
|
||||
int top = inTop;
|
||||
@Override
|
||||
protected GridElement buildElementAt(int left, int inTop, int width, final List<GridElement> collector) {
|
||||
int height = 0;
|
||||
int top = inTop;
|
||||
|
||||
if (widthType == GridValueType.INHERIT) {
|
||||
if (widthType == GridValueType.INHERIT) {
|
||||
width = calculateWidth(width);
|
||||
}
|
||||
|
||||
for (GridCellDefinition row : cells) {
|
||||
GridElement element = row.buildElement(width, 0, 1, left, top, collector);
|
||||
top += element.height;
|
||||
height += element.height;
|
||||
}
|
||||
for (GridCellDefinition row : cells) {
|
||||
GridElement element = row.buildElement(width, 0, 1, left, top, collector);
|
||||
top += element.height;
|
||||
height += element.height;
|
||||
}
|
||||
|
||||
return new GridElement(left, inTop, width, height);
|
||||
}
|
||||
return new GridElement(left, inTop, width, height);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package ru.bclib.gui.screens;
|
|||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public interface AtomicProgressListener {
|
||||
public void incAtomic(int maxProgress);
|
||||
public void resetAtomic();
|
||||
public void stop();
|
||||
public void progressStage(Component component);
|
||||
public void incAtomic(int maxProgress);
|
||||
public void resetAtomic();
|
||||
public void stop();
|
||||
public void progressStage(Component component);
|
||||
}
|
||||
|
|
|
@ -11,41 +11,41 @@ import ru.bclib.gui.gridlayout.GridRow;
|
|||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ConfirmRestartScreen extends BCLibScreen {
|
||||
private final Component description;
|
||||
private final ConfirmRestartScreen.Listener listener;
|
||||
private final Component description;
|
||||
private final ConfirmRestartScreen.Listener listener;
|
||||
|
||||
public ConfirmRestartScreen(ConfirmRestartScreen.Listener listener) {
|
||||
this(listener, null);
|
||||
}
|
||||
public ConfirmRestartScreen(ConfirmRestartScreen.Listener listener) {
|
||||
this(listener, null);
|
||||
}
|
||||
|
||||
public ConfirmRestartScreen(ConfirmRestartScreen.Listener listener, Component message) {
|
||||
super(new TranslatableComponent("title.bclib.confirmrestart"));
|
||||
public ConfirmRestartScreen(ConfirmRestartScreen.Listener listener, Component message) {
|
||||
super(new TranslatableComponent("title.bclib.confirmrestart"));
|
||||
|
||||
this.description = message==null?new TranslatableComponent("message.bclib.confirmrestart"):message;
|
||||
this.listener = listener;
|
||||
}
|
||||
this.description = message==null?new TranslatableComponent("message.bclib.confirmrestart"):message;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
protected void initLayout() {
|
||||
final int BUTTON_HEIGHT = 20;
|
||||
|
||||
grid.addRow().addMessage(this.description, this.font, Alignment.CENTER);
|
||||
|
||||
grid.addSpacerRow();
|
||||
|
||||
GridRow row = grid.addRow();
|
||||
row.addFiller();
|
||||
row.addButton(CommonComponents.GUI_PROCEED, BUTTON_HEIGHT, font, (button) -> {
|
||||
listener.proceed();
|
||||
});
|
||||
row.addFiller();
|
||||
}
|
||||
protected void initLayout() {
|
||||
final int BUTTON_HEIGHT = 20;
|
||||
|
||||
grid.addRow().addMessage(this.description, this.font, Alignment.CENTER);
|
||||
|
||||
grid.addSpacerRow();
|
||||
|
||||
GridRow row = grid.addRow();
|
||||
row.addFiller();
|
||||
row.addButton(CommonComponents.GUI_PROCEED, BUTTON_HEIGHT, font, (button) -> {
|
||||
listener.proceed();
|
||||
});
|
||||
row.addFiller();
|
||||
}
|
||||
|
||||
public boolean shouldCloseOnEsc() {
|
||||
return false;
|
||||
}
|
||||
public boolean shouldCloseOnEsc() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface Listener {
|
||||
void proceed();
|
||||
}
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface Listener {
|
||||
void proceed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,49 +12,49 @@ import ru.bclib.gui.gridlayout.GridRow;
|
|||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class LevelFixErrorScreen extends BCLibScreen {
|
||||
private final String[] errors;
|
||||
final Listener onContinue;
|
||||
|
||||
public LevelFixErrorScreen(Screen parent, String[] errors, Listener onContinue) {
|
||||
super(parent, new TranslatableComponent("title.bclib.datafixer.error"), 10, true);
|
||||
this.errors = errors;
|
||||
this.onContinue = onContinue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initLayout() {
|
||||
grid.addSpacerRow();
|
||||
grid.addRow().addMessage(new TranslatableComponent("message.bclib.datafixer.error"), font, GridLayout.Alignment.CENTER);
|
||||
grid.addSpacerRow(8);
|
||||
|
||||
GridRow row = grid.addRow();
|
||||
row.addSpacer(10);
|
||||
GridColumn col = row.addColumn(300, GridLayout.GridValueType.CONSTANT);
|
||||
for (String error : errors){
|
||||
TextComponent dash = new TextComponent("-");
|
||||
row = col.addRow();
|
||||
row.addString(dash, this);
|
||||
|
||||
row.addSpacer(4);
|
||||
row.addString(new TextComponent(error), this);
|
||||
}
|
||||
|
||||
grid.addSpacerRow(8);
|
||||
row = grid.addRow();
|
||||
row.addFiller();
|
||||
row.addButton(new TranslatableComponent("title.bclib.datafixer.error.continue"), 0.5f, 20, font, (n)-> {
|
||||
onClose();
|
||||
onContinue.doContinue(true);
|
||||
});
|
||||
row.addSpacer();
|
||||
row.addButton(CommonComponents.GUI_CANCEL, 20, font, (n)-> {
|
||||
this.minecraft.setScreen(null);
|
||||
});
|
||||
row.addFiller();
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface Listener {
|
||||
void doContinue(boolean markFixed);
|
||||
}
|
||||
private final String[] errors;
|
||||
final Listener onContinue;
|
||||
|
||||
public LevelFixErrorScreen(Screen parent, String[] errors, Listener onContinue) {
|
||||
super(parent, new TranslatableComponent("title.bclib.datafixer.error"), 10, true);
|
||||
this.errors = errors;
|
||||
this.onContinue = onContinue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initLayout() {
|
||||
grid.addSpacerRow();
|
||||
grid.addRow().addMessage(new TranslatableComponent("message.bclib.datafixer.error"), font, GridLayout.Alignment.CENTER);
|
||||
grid.addSpacerRow(8);
|
||||
|
||||
GridRow row = grid.addRow();
|
||||
row.addSpacer(10);
|
||||
GridColumn col = row.addColumn(300, GridLayout.GridValueType.CONSTANT);
|
||||
for (String error : errors){
|
||||
TextComponent dash = new TextComponent("-");
|
||||
row = col.addRow();
|
||||
row.addString(dash, this);
|
||||
|
||||
row.addSpacer(4);
|
||||
row.addString(new TextComponent(error), this);
|
||||
}
|
||||
|
||||
grid.addSpacerRow(8);
|
||||
row = grid.addRow();
|
||||
row.addFiller();
|
||||
row.addButton(new TranslatableComponent("title.bclib.datafixer.error.continue"), 0.5f, 20, font, (n)-> {
|
||||
onClose();
|
||||
onContinue.doContinue(true);
|
||||
});
|
||||
row.addSpacer();
|
||||
row.addButton(CommonComponents.GUI_CANCEL, 20, font, (n)-> {
|
||||
this.minecraft.setScreen(null);
|
||||
});
|
||||
row.addFiller();
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface Listener {
|
||||
void doContinue(boolean markFixed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,193 +26,193 @@ import java.util.stream.Collectors;
|
|||
@Environment(EnvType.CLIENT)
|
||||
public class ModListScreen extends BCLibScreen {
|
||||
|
||||
private final List<ModUtil.ModInfo> mods;
|
||||
private final HelloClient.IServerModMap serverInfo;
|
||||
private final Component description;
|
||||
private final Component buttonTitle;
|
||||
private final List<ModUtil.ModInfo> mods;
|
||||
private final HelloClient.IServerModMap serverInfo;
|
||||
private final Component description;
|
||||
private final Component buttonTitle;
|
||||
|
||||
private static List<ModUtil.ModInfo> extractModList(Map<String, ModUtil.ModInfo> mods){
|
||||
List<ModUtil.ModInfo> list = new LinkedList<ModUtil.ModInfo>();
|
||||
ModUtil.getMods().forEach((id, info) -> list.add(info));
|
||||
return list;
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, Map<String, ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
this(parent, title, description, CommonComponents.GUI_BACK, mods, serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
this(parent, title, description, CommonComponents.GUI_BACK, mods, serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, Component button, Map<String, ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
this(parent, title, description, button, extractModList(mods), serverInfo);
|
||||
}
|
||||
private static List<ModUtil.ModInfo> extractModList(Map<String, ModUtil.ModInfo> mods){
|
||||
List<ModUtil.ModInfo> list = new LinkedList<ModUtil.ModInfo>();
|
||||
ModUtil.getMods().forEach((id, info) -> list.add(info));
|
||||
return list;
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, Map<String, ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
this(parent, title, description, CommonComponents.GUI_BACK, mods, serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
this(parent, title, description, CommonComponents.GUI_BACK, mods, serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, Component button, Map<String, ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
this(parent, title, description, button, extractModList(mods), serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent, Component title, Component description, Component button, List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
super(parent, title, 10, true);
|
||||
this.mods = mods;
|
||||
this.serverInfo = serverInfo;
|
||||
this.description = description;
|
||||
this.buttonTitle = button;
|
||||
}
|
||||
public ModListScreen(Screen parent, Component title, Component description, Component button, List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo) {
|
||||
super(parent, title, 10, true);
|
||||
this.mods = mods;
|
||||
this.serverInfo = serverInfo;
|
||||
this.description = description;
|
||||
this.buttonTitle = button;
|
||||
}
|
||||
|
||||
public static List<String> localMissing(HelloClient.IServerModMap serverInfo){
|
||||
return serverInfo.keySet()
|
||||
.stream()
|
||||
.filter(modid -> !ModUtil.getMods().keySet().stream().filter(mod -> mod.equals(modid)).findFirst().isPresent()).collect(Collectors.toList());
|
||||
}
|
||||
public static List<String> localMissing(HelloClient.IServerModMap serverInfo){
|
||||
return serverInfo.keySet()
|
||||
.stream()
|
||||
.filter(modid -> !ModUtil.getMods().keySet().stream().filter(mod -> mod.equals(modid)).findFirst().isPresent()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<String> serverMissing(HelloClient.IServerModMap serverInfo){
|
||||
return ModUtil.getMods().entrySet()
|
||||
.stream()
|
||||
.filter(entry -> entry.getValue().metadata.getEnvironment() != ModEnvironment.CLIENT)
|
||||
.map(entry -> entry.getKey())
|
||||
.filter(modid -> !serverInfo.keySet().stream().filter(mod -> mod.equals(modid)).findFirst().isPresent()).collect(Collectors.toList());
|
||||
}
|
||||
public static List<String> serverMissing(HelloClient.IServerModMap serverInfo){
|
||||
return ModUtil.getMods().entrySet()
|
||||
.stream()
|
||||
.filter(entry -> entry.getValue().metadata.getEnvironment() != ModEnvironment.CLIENT)
|
||||
.map(entry -> entry.getKey())
|
||||
.filter(modid -> !serverInfo.keySet().stream().filter(mod -> mod.equals(modid)).findFirst().isPresent()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static void addModDesc(GridColumn grid, java.util.List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo, GridScreen parent) {
|
||||
final int STATE_OK = 6;
|
||||
final int STATE_SERVER_MISSING_CLIENT_MOD = 5;
|
||||
final int STATE_MISSING_NOT_OFFERED = 4;
|
||||
final int STATE_VERSION_NOT_OFFERED = 3;
|
||||
final int STATE_VERSION = 2;
|
||||
final int STATE_SERVER_MISSING = 1;
|
||||
final int STATE_MISSING = 0;
|
||||
|
||||
public static void addModDesc(GridColumn grid, java.util.List<ModUtil.ModInfo> mods, HelloClient.IServerModMap serverInfo, GridScreen parent) {
|
||||
final int STATE_OK = 6;
|
||||
final int STATE_SERVER_MISSING_CLIENT_MOD = 5;
|
||||
final int STATE_MISSING_NOT_OFFERED = 4;
|
||||
final int STATE_VERSION_NOT_OFFERED = 3;
|
||||
final int STATE_VERSION = 2;
|
||||
final int STATE_SERVER_MISSING = 1;
|
||||
final int STATE_MISSING = 0;
|
||||
|
||||
|
||||
List<Triple<String, Integer, String>> items = new LinkedList<>();
|
||||
if (serverInfo!=null) {
|
||||
serverInfo.keySet()
|
||||
.stream()
|
||||
.filter(modid -> !mods.stream().filter(mod -> mod.metadata.getId().equals(modid)).findFirst().isPresent())
|
||||
.forEach(modid -> {
|
||||
HelloClient.OfferedModInfo nfo = serverInfo.get(modid);
|
||||
String stateString = nfo.version();
|
||||
if (nfo.size()>0) {
|
||||
stateString = "Version: " + stateString + ", Size: " + PathUtil.humanReadableFileSize(nfo.size());
|
||||
}
|
||||
if (nfo.canDownload()) {
|
||||
stateString += ", offered by server";
|
||||
}
|
||||
List<Triple<String, Integer, String>> items = new LinkedList<>();
|
||||
if (serverInfo!=null) {
|
||||
serverInfo.keySet()
|
||||
.stream()
|
||||
.filter(modid -> !mods.stream().filter(mod -> mod.metadata.getId().equals(modid)).findFirst().isPresent())
|
||||
.forEach(modid -> {
|
||||
HelloClient.OfferedModInfo nfo = serverInfo.get(modid);
|
||||
String stateString = nfo.version();
|
||||
if (nfo.size()>0) {
|
||||
stateString = "Version: " + stateString + ", Size: " + PathUtil.humanReadableFileSize(nfo.size());
|
||||
}
|
||||
if (nfo.canDownload()) {
|
||||
stateString += ", offered by server";
|
||||
}
|
||||
|
||||
items.add(new Triple<>(modid, nfo.canDownload()?STATE_MISSING:STATE_MISSING_NOT_OFFERED, stateString));
|
||||
});
|
||||
}
|
||||
items.add(new Triple<>(modid, nfo.canDownload()?STATE_MISSING:STATE_MISSING_NOT_OFFERED, stateString));
|
||||
});
|
||||
}
|
||||
|
||||
mods.forEach(mod -> {
|
||||
String serverVersion = null;
|
||||
int serverSize = 0;
|
||||
int state = STATE_OK;
|
||||
if (serverInfo != null) {
|
||||
final String modID = mod.metadata.getId();
|
||||
mods.forEach(mod -> {
|
||||
String serverVersion = null;
|
||||
int serverSize = 0;
|
||||
int state = STATE_OK;
|
||||
if (serverInfo != null) {
|
||||
final String modID = mod.metadata.getId();
|
||||
|
||||
|
||||
HelloClient.OfferedModInfo data = serverInfo.get(modID);
|
||||
if (data!=null) {
|
||||
final String modVer = data.version();
|
||||
final int size = data.size();
|
||||
if (!modVer.equals(mod.getVersion())) {
|
||||
state = data.canDownload()?STATE_VERSION:STATE_VERSION_NOT_OFFERED;
|
||||
serverVersion = modVer;
|
||||
serverSize = size;
|
||||
}
|
||||
} else if (mod.metadata.getEnvironment() == ModEnvironment.CLIENT){
|
||||
state = STATE_SERVER_MISSING_CLIENT_MOD;
|
||||
} else {
|
||||
state = STATE_SERVER_MISSING;
|
||||
}
|
||||
}
|
||||
HelloClient.OfferedModInfo data = serverInfo.get(modID);
|
||||
if (data!=null) {
|
||||
final String modVer = data.version();
|
||||
final int size = data.size();
|
||||
if (!modVer.equals(mod.getVersion())) {
|
||||
state = data.canDownload()?STATE_VERSION:STATE_VERSION_NOT_OFFERED;
|
||||
serverVersion = modVer;
|
||||
serverSize = size;
|
||||
}
|
||||
} else if (mod.metadata.getEnvironment() == ModEnvironment.CLIENT){
|
||||
state = STATE_SERVER_MISSING_CLIENT_MOD;
|
||||
} else {
|
||||
state = STATE_SERVER_MISSING;
|
||||
}
|
||||
}
|
||||
|
||||
String stateString = mod.metadata.getVersion().toString();
|
||||
if (serverVersion!=null) {
|
||||
stateString = "Client: " + stateString;
|
||||
stateString += ", Server: " + serverVersion;
|
||||
if (serverSize>0) {
|
||||
stateString += ", Size: " + PathUtil.humanReadableFileSize(serverSize);
|
||||
}
|
||||
}
|
||||
if (mod.metadata.getEnvironment() == ModEnvironment.CLIENT) {
|
||||
stateString+= ", client-only";
|
||||
} else if (mod.metadata.getEnvironment() == ModEnvironment.SERVER) {
|
||||
stateString+= ", server-only";
|
||||
}
|
||||
items.add(new Triple<>(mod.metadata.getName(), state, stateString));
|
||||
});
|
||||
String stateString = mod.metadata.getVersion().toString();
|
||||
if (serverVersion!=null) {
|
||||
stateString = "Client: " + stateString;
|
||||
stateString += ", Server: " + serverVersion;
|
||||
if (serverSize>0) {
|
||||
stateString += ", Size: " + PathUtil.humanReadableFileSize(serverSize);
|
||||
}
|
||||
}
|
||||
if (mod.metadata.getEnvironment() == ModEnvironment.CLIENT) {
|
||||
stateString+= ", client-only";
|
||||
} else if (mod.metadata.getEnvironment() == ModEnvironment.SERVER) {
|
||||
stateString+= ", server-only";
|
||||
}
|
||||
items.add(new Triple<>(mod.metadata.getName(), state, stateString));
|
||||
});
|
||||
|
||||
items.stream()
|
||||
.sorted(Comparator.comparing(a -> a.second + a.first.toLowerCase(Locale.ROOT)))
|
||||
.forEach(t -> {
|
||||
final String name = t.first;
|
||||
final int state = t.second;
|
||||
final String stateString = t.third;
|
||||
items.stream()
|
||||
.sorted(Comparator.comparing(a -> a.second + a.first.toLowerCase(Locale.ROOT)))
|
||||
.forEach(t -> {
|
||||
final String name = t.first;
|
||||
final int state = t.second;
|
||||
final String stateString = t.third;
|
||||
|
||||
int color = GridLayout.COLOR_RED;
|
||||
final String typeText;
|
||||
if (state==STATE_VERSION || state==STATE_VERSION_NOT_OFFERED) {
|
||||
typeText = "[VERSION]";
|
||||
if (state == STATE_VERSION_NOT_OFFERED) {
|
||||
color = GridLayout.COLOR_YELLOW;
|
||||
}
|
||||
} else if (state==STATE_MISSING || state==STATE_MISSING_NOT_OFFERED) {
|
||||
typeText = "[MISSING]";
|
||||
if (state == STATE_MISSING_NOT_OFFERED) {
|
||||
color = GridLayout.COLOR_YELLOW;
|
||||
}
|
||||
} else if (state==STATE_SERVER_MISSING || state == STATE_SERVER_MISSING_CLIENT_MOD) {
|
||||
if (state == STATE_SERVER_MISSING_CLIENT_MOD) {
|
||||
color = GridLayout.COLOR_CYAN;
|
||||
typeText = "[OK]";
|
||||
} else {
|
||||
typeText = "[NOT ON SERVER]";
|
||||
}
|
||||
} else {
|
||||
color = GridLayout.COLOR_DARK_GREEN;
|
||||
typeText = "[OK]";
|
||||
}
|
||||
TextComponent dash = new TextComponent("-");
|
||||
TextComponent typeTextComponent = new TextComponent(typeText);
|
||||
GridRow row = grid.addRow();
|
||||
int color = GridLayout.COLOR_RED;
|
||||
final String typeText;
|
||||
if (state==STATE_VERSION || state==STATE_VERSION_NOT_OFFERED) {
|
||||
typeText = "[VERSION]";
|
||||
if (state == STATE_VERSION_NOT_OFFERED) {
|
||||
color = GridLayout.COLOR_YELLOW;
|
||||
}
|
||||
} else if (state==STATE_MISSING || state==STATE_MISSING_NOT_OFFERED) {
|
||||
typeText = "[MISSING]";
|
||||
if (state == STATE_MISSING_NOT_OFFERED) {
|
||||
color = GridLayout.COLOR_YELLOW;
|
||||
}
|
||||
} else if (state==STATE_SERVER_MISSING || state == STATE_SERVER_MISSING_CLIENT_MOD) {
|
||||
if (state == STATE_SERVER_MISSING_CLIENT_MOD) {
|
||||
color = GridLayout.COLOR_CYAN;
|
||||
typeText = "[OK]";
|
||||
} else {
|
||||
typeText = "[NOT ON SERVER]";
|
||||
}
|
||||
} else {
|
||||
color = GridLayout.COLOR_DARK_GREEN;
|
||||
typeText = "[OK]";
|
||||
}
|
||||
TextComponent dash = new TextComponent("-");
|
||||
TextComponent typeTextComponent = new TextComponent(typeText);
|
||||
GridRow row = grid.addRow();
|
||||
|
||||
row.addString(dash, parent);
|
||||
row.addString(dash, parent);
|
||||
|
||||
row.addSpacer(4);
|
||||
row.addString(new TextComponent(name), parent);
|
||||
row.addSpacer(4);
|
||||
row.addString(new TextComponent(name), parent);
|
||||
|
||||
row.addSpacer(4);
|
||||
row.addString(typeTextComponent, color, parent);
|
||||
row.addSpacer(4);
|
||||
row.addString(typeTextComponent, color, parent);
|
||||
|
||||
if (!stateString.isEmpty()) {
|
||||
row = grid.addRow();
|
||||
row.addSpacer(4 + parent.getWidth(dash));
|
||||
row.addString(new TextComponent(stateString), GridLayout.COLOR_GRAY, parent);
|
||||
}
|
||||
if (!stateString.isEmpty()) {
|
||||
row = grid.addRow();
|
||||
row.addSpacer(4 + parent.getWidth(dash));
|
||||
row.addString(new TextComponent(stateString), GridLayout.COLOR_GRAY, parent);
|
||||
}
|
||||
|
||||
grid.addSpacerRow();
|
||||
});
|
||||
}
|
||||
grid.addSpacerRow();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initLayout() {
|
||||
if (description != null) {
|
||||
grid.addSpacerRow();
|
||||
grid.addRow().addMessage(description, font, GridLayout.Alignment.CENTER);
|
||||
grid.addSpacerRow(8);
|
||||
}
|
||||
@Override
|
||||
protected void initLayout() {
|
||||
if (description != null) {
|
||||
grid.addSpacerRow();
|
||||
grid.addRow().addMessage(description, font, GridLayout.Alignment.CENTER);
|
||||
grid.addSpacerRow(8);
|
||||
}
|
||||
|
||||
GridRow row = grid.addRow();
|
||||
row.addSpacer(10);
|
||||
GridColumn col = row.addColumn(200, GridLayout.GridValueType.CONSTANT);
|
||||
addModDesc(col, mods, serverInfo, this);
|
||||
GridRow row = grid.addRow();
|
||||
row.addSpacer(10);
|
||||
GridColumn col = row.addColumn(200, GridLayout.GridValueType.CONSTANT);
|
||||
addModDesc(col, mods, serverInfo, this);
|
||||
|
||||
grid.addSpacerRow(8);
|
||||
row = grid.addRow();
|
||||
row.addFiller();
|
||||
row.addButton(buttonTitle, 20, font, (n)-> {
|
||||
onClose();
|
||||
});
|
||||
row.addFiller();
|
||||
}
|
||||
grid.addSpacerRow(8);
|
||||
row = grid.addRow();
|
||||
row.addFiller();
|
||||
row.addButton(buttonTitle, 20, font, (n)-> {
|
||||
onClose();
|
||||
});
|
||||
row.addFiller();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,16 +55,16 @@ class ModMenuScreenFactoryImpl {
|
|||
* <p>
|
||||
* Example:
|
||||
* <pre>{@code public class ModMenu extends ModMenuIntegration {
|
||||
* public static final ModMenuApiMarker entrypointObject = createEntrypoint(new EntryPoint());
|
||||
* public static final ModMenuApiMarker entrypointObject = createEntrypoint(new EntryPoint());
|
||||
*
|
||||
* public EntryPoint() {
|
||||
* super(GridScreen::new);
|
||||
* }
|
||||
* public EntryPoint() {
|
||||
* super(GridScreen::new);
|
||||
* }
|
||||
* }}</pre>
|
||||
* You'd also need to add the ModMenu-Entrypoint to your <i>fabric.mod.json</i>:
|
||||
* <pre>"entrypoints": {
|
||||
* ...
|
||||
* "modmenu": [ "your.mod.ModMenu::entrypointObject" ]
|
||||
* ...
|
||||
* "modmenu": [ "your.mod.ModMenu::entrypointObject" ]
|
||||
* }</pre>
|
||||
*/
|
||||
public abstract class ModMenuIntegration {
|
||||
|
@ -101,7 +101,7 @@ public abstract class ModMenuIntegration {
|
|||
/**
|
||||
* Create a new ModMenu delegate
|
||||
* @param screenFactory A Factory. The Factory receives the currently visible {@code parent}-Screen
|
||||
* and must return a new Screen Object.
|
||||
* and must return a new Screen Object.
|
||||
*/
|
||||
public ModMenuIntegration(ModMenuScreenFactory screenFactory){
|
||||
this.screenFactory = screenFactory;
|
||||
|
|
|
@ -3,7 +3,7 @@ package ru.bclib.interfaces;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public interface SurfaceMaterialProvider {
|
||||
BlockState getTopMaterial();
|
||||
BlockState getUnderMaterial();
|
||||
BlockState getAltTopMaterial();
|
||||
BlockState getTopMaterial();
|
||||
BlockState getUnderMaterial();
|
||||
BlockState getAltTopMaterial();
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ package ru.bclib.interfaces;
|
|||
|
||||
@FunctionalInterface
|
||||
public interface TriConsumer<A, B, C> {
|
||||
void accept(A a, B b, C c);
|
||||
void accept(A a, B b, C c);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package ru.bclib.mixin.client;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.datafixers.util.Function4;
|
||||
import net.fabricmc.fabric.api.event.registry.DynamicRegistrySetupCallback;
|
||||
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Minecraft.ExperimentalDialogType;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
|
@ -15,17 +9,10 @@ import net.minecraft.client.main.GameConfig;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.RegistryAccess.RegistryHolder;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.world.level.DataPackConfig;
|
||||
import net.minecraft.world.level.LevelSettings;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
|
@ -35,18 +22,12 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.LifeCycleAPI;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.api.dataexchange.DataExchangeAPI;
|
||||
import ru.bclib.api.datafixer.DataFixerAPI;
|
||||
import ru.bclib.interfaces.CustomColorProvider;
|
||||
import ru.bclib.mixin.common.StructureSettingsAccessor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
|
|
|
@ -31,35 +31,35 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public class MinecraftServerMixin {
|
||||
@Shadow
|
||||
private ServerResources resources;
|
||||
@Shadow
|
||||
private ServerResources resources;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private Map<ResourceKey<Level>, ServerLevel> levels;
|
||||
@Final
|
||||
@Shadow
|
||||
private Map<ResourceKey<Level>, ServerLevel> levels;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
protected WorldData worldData;
|
||||
@Final
|
||||
@Shadow
|
||||
protected WorldData worldData;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void bclib_onServerInit(Thread thread, RegistryHolder registryHolder, LevelStorageAccess levelStorageAccess, WorldData worldData, PackRepository packRepository, Proxy proxy, DataFixer dataFixer, ServerResources serverResources, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, GameProfileCache gameProfileCache, ChunkProgressListenerFactory chunkProgressListenerFactory, CallbackInfo ci) {
|
||||
DataExchangeAPI.prepareServerside();
|
||||
}
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void bclib_onServerInit(Thread thread, RegistryHolder registryHolder, LevelStorageAccess levelStorageAccess, WorldData worldData, PackRepository packRepository, Proxy proxy, DataFixer dataFixer, ServerResources serverResources, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, GameProfileCache gameProfileCache, ChunkProgressListenerFactory chunkProgressListenerFactory, CallbackInfo ci) {
|
||||
DataExchangeAPI.prepareServerside();
|
||||
}
|
||||
|
||||
@Inject(method = "reloadResources", at = @At(value = "RETURN"), cancellable = true)
|
||||
private void bclib_reloadResources(Collection<String> collection, CallbackInfoReturnable<CompletableFuture<Void>> info) {
|
||||
bclib_injectRecipes();
|
||||
}
|
||||
@Inject(method = "reloadResources", at = @At(value = "RETURN"), cancellable = true)
|
||||
private void bclib_reloadResources(Collection<String> collection, CallbackInfoReturnable<CompletableFuture<Void>> info) {
|
||||
bclib_injectRecipes();
|
||||
}
|
||||
|
||||
@Inject(method = "loadLevel", at = @At(value = "RETURN"), cancellable = true)
|
||||
private void bclib_loadLevel(CallbackInfo info) {
|
||||
bclib_injectRecipes();
|
||||
//BiomeAPI.initRegistry(MinecraftServer.class.cast(this));
|
||||
}
|
||||
@Inject(method = "loadLevel", at = @At(value = "RETURN"), cancellable = true)
|
||||
private void bclib_loadLevel(CallbackInfo info) {
|
||||
bclib_injectRecipes();
|
||||
//BiomeAPI.initRegistry(MinecraftServer.class.cast(this));
|
||||
}
|
||||
|
||||
private void bclib_injectRecipes() {
|
||||
RecipeManagerAccessor accessor = (RecipeManagerAccessor) resources.getRecipeManager();
|
||||
accessor.bclib_setRecipes(BCLRecipeManager.getMap(accessor.bclib_getRecipes()));
|
||||
}
|
||||
private void bclib_injectRecipes() {
|
||||
RecipeManagerAccessor accessor = (RecipeManagerAccessor) resources.getRecipeManager();
|
||||
accessor.bclib_setRecipes(BCLRecipeManager.getMap(accessor.bclib_getRecipes()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ import ru.bclib.world.biomes.FabricBiomesData;
|
|||
|
||||
@Mixin(value = NetherBiomeData.class, remap = false)
|
||||
public class NetherBiomeDataMixin {
|
||||
@Inject(method = "addNetherBiome", at = @At(value = "HEAD"))
|
||||
private static void bclib_addNetherBiome(ResourceKey<Biome> biome, Climate.ParameterPoint spawnNoisePoint, CallbackInfo info) {
|
||||
FabricBiomesData.NETHER_BIOMES.add(biome);
|
||||
}
|
||||
@Inject(method = "addNetherBiome", at = @At(value = "HEAD"))
|
||||
private static void bclib_addNetherBiome(ResourceKey<Biome> biome, Climate.ParameterPoint spawnNoisePoint, CallbackInfo info) {
|
||||
FabricBiomesData.NETHER_BIOMES.add(biome);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package ru.bclib.mixin.common;
|
|||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
|
||||
import org.apache.commons.codec.language.bm.Rule;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
|
|
|
@ -12,39 +12,39 @@ import java.util.function.Supplier;
|
|||
|
||||
@Mixin(SurfaceRules.Context.class)
|
||||
public interface SurfaceRulesContextAccessor {
|
||||
@Accessor("blockX")
|
||||
int getBlockX();
|
||||
@Accessor("blockX")
|
||||
int getBlockX();
|
||||
|
||||
@Accessor("blockY")
|
||||
int getBlockY();
|
||||
@Accessor("blockY")
|
||||
int getBlockY();
|
||||
|
||||
@Accessor("blockZ")
|
||||
int getBlockZ();
|
||||
@Accessor("blockZ")
|
||||
int getBlockZ();
|
||||
|
||||
@Accessor("surfaceDepth")
|
||||
int getSurfaceDepth();
|
||||
@Accessor("surfaceDepth")
|
||||
int getSurfaceDepth();
|
||||
|
||||
@Accessor("biome")
|
||||
Supplier<Biome> getBiome();
|
||||
@Accessor("biome")
|
||||
Supplier<Biome> getBiome();
|
||||
|
||||
@Accessor("biomeKey")
|
||||
Supplier<ResourceKey<Biome>> getBiomeKey();
|
||||
@Accessor("biomeKey")
|
||||
Supplier<ResourceKey<Biome>> getBiomeKey();
|
||||
|
||||
@Accessor("chunk")
|
||||
ChunkAccess getChunk();
|
||||
@Accessor("chunk")
|
||||
ChunkAccess getChunk();
|
||||
|
||||
@Accessor("noiseChunk")
|
||||
NoiseChunk getNoiseChunk();
|
||||
|
||||
@Accessor("stoneDepthAbove")
|
||||
int getStoneDepthAbove();
|
||||
|
||||
@Accessor("stoneDepthBelow")
|
||||
int getStoneDepthBelow();
|
||||
|
||||
@Accessor("lastUpdateY")
|
||||
long getLastUpdateY();
|
||||
|
||||
@Accessor("lastUpdateXZ")
|
||||
long getLastUpdateXZ();
|
||||
@Accessor("noiseChunk")
|
||||
NoiseChunk getNoiseChunk();
|
||||
|
||||
@Accessor("stoneDepthAbove")
|
||||
int getStoneDepthAbove();
|
||||
|
||||
@Accessor("stoneDepthBelow")
|
||||
int getStoneDepthBelow();
|
||||
|
||||
@Accessor("lastUpdateY")
|
||||
long getLastUpdateY();
|
||||
|
||||
@Accessor("lastUpdateXZ")
|
||||
long getLastUpdateXZ();
|
||||
}
|
||||
|
|
|
@ -12,24 +12,24 @@ import ru.bclib.world.biomes.FabricBiomesData;
|
|||
|
||||
@Mixin(value = TheEndBiomeData.class, remap = false)
|
||||
public class TheEndBiomeDataMixin {
|
||||
@Inject(method = "addEndBiomeReplacement", at = @At(value = "HEAD"))
|
||||
private static void bclib_addEndBiomeReplacement(ResourceKey<Biome> replaced, ResourceKey<Biome> variant, double weight, CallbackInfo info) {
|
||||
if (replaced == Biomes.END_BARRENS || replaced == Biomes.SMALL_END_ISLANDS) {
|
||||
FabricBiomesData.END_VOID_BIOMES.put(variant, (float) weight);
|
||||
}
|
||||
else {
|
||||
FabricBiomesData.END_LAND_BIOMES.put(variant, (float) weight);
|
||||
}
|
||||
}
|
||||
@Inject(method = "addEndBiomeReplacement", at = @At(value = "HEAD"))
|
||||
private static void bclib_addEndBiomeReplacement(ResourceKey<Biome> replaced, ResourceKey<Biome> variant, double weight, CallbackInfo info) {
|
||||
if (replaced == Biomes.END_BARRENS || replaced == Biomes.SMALL_END_ISLANDS) {
|
||||
FabricBiomesData.END_VOID_BIOMES.put(variant, (float) weight);
|
||||
}
|
||||
else {
|
||||
FabricBiomesData.END_LAND_BIOMES.put(variant, (float) weight);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "addEndMidlandsReplacement", at = @At(value = "HEAD"))
|
||||
private static void bclib_addEndMidlandsReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> midlands, double weight, CallbackInfo info) {
|
||||
FabricBiomesData.END_LAND_BIOMES.put(midlands, (float) weight);
|
||||
}
|
||||
@Inject(method = "addEndMidlandsReplacement", at = @At(value = "HEAD"))
|
||||
private static void bclib_addEndMidlandsReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> midlands, double weight, CallbackInfo info) {
|
||||
FabricBiomesData.END_LAND_BIOMES.put(midlands, (float) weight);
|
||||
}
|
||||
|
||||
@Inject(method = "addEndBarrensReplacement", at = @At(value = "HEAD"))
|
||||
private static void bclib_addEndBarrensReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> barrens, double weight, CallbackInfo info) {
|
||||
FabricBiomesData.END_LAND_BIOMES.put(barrens, (float) weight);
|
||||
FabricBiomesData.END_VOID_BIOMES.put(barrens, (float) weight);
|
||||
}
|
||||
@Inject(method = "addEndBarrensReplacement", at = @At(value = "HEAD"))
|
||||
private static void bclib_addEndBarrensReplacement(ResourceKey<Biome> highlands, ResourceKey<Biome> barrens, double weight, CallbackInfo info) {
|
||||
FabricBiomesData.END_LAND_BIOMES.put(barrens, (float) weight);
|
||||
FabricBiomesData.END_VOID_BIOMES.put(barrens, (float) weight);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,301 +33,299 @@ import ru.bclib.util.RecipeHelper;
|
|||
import java.util.Objects;
|
||||
|
||||
public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory {
|
||||
public final static String GROUP = "smithing";
|
||||
public final static RecipeType<AnvilRecipe> TYPE = BCLRecipeManager.registerType(BCLib.MOD_ID, GROUP);
|
||||
public final static Serializer SERIALIZER = BCLRecipeManager.registerSerializer(
|
||||
BCLib.MOD_ID,
|
||||
GROUP,
|
||||
new Serializer()
|
||||
);
|
||||
public final static ResourceLocation ID = BCLib.makeID(GROUP);
|
||||
public final static String GROUP = "smithing";
|
||||
public final static RecipeType<AnvilRecipe> TYPE = BCLRecipeManager.registerType(BCLib.MOD_ID, GROUP);
|
||||
public final static Serializer SERIALIZER = BCLRecipeManager.registerSerializer(
|
||||
BCLib.MOD_ID,
|
||||
GROUP,
|
||||
new Serializer()
|
||||
);
|
||||
public final static ResourceLocation ID = BCLib.makeID(GROUP);
|
||||
|
||||
private final ResourceLocation id;
|
||||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
private final int damage;
|
||||
private final int toolLevel;
|
||||
private final int anvilLevel;
|
||||
private final int inputCount;
|
||||
private final ResourceLocation id;
|
||||
private final Ingredient input;
|
||||
private final ItemStack output;
|
||||
private final int damage;
|
||||
private final int toolLevel;
|
||||
private final int anvilLevel;
|
||||
private final int inputCount;
|
||||
|
||||
public AnvilRecipe(ResourceLocation identifier, Ingredient input, ItemStack output, int inputCount, int toolLevel, int anvilLevel, int damage) {
|
||||
this.id = identifier;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.toolLevel = toolLevel;
|
||||
this.anvilLevel = anvilLevel;
|
||||
this.inputCount = inputCount;
|
||||
this.damage = damage;
|
||||
}
|
||||
public AnvilRecipe(ResourceLocation identifier, Ingredient input, ItemStack output, int inputCount, int toolLevel, int anvilLevel, int damage) {
|
||||
this.id = identifier;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.toolLevel = toolLevel;
|
||||
this.anvilLevel = anvilLevel;
|
||||
this.inputCount = inputCount;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public static Builder create(String id) {
|
||||
return create(BCLib.makeID(id));
|
||||
}
|
||||
public static Builder create(String id) {
|
||||
return create(BCLib.makeID(id));
|
||||
}
|
||||
|
||||
public static Builder create(ResourceLocation id) {
|
||||
Builder.INSTANCE.id = id;
|
||||
Builder.INSTANCE.input = null;
|
||||
Builder.INSTANCE.output = null;
|
||||
Builder.INSTANCE.inputCount = 1;
|
||||
Builder.INSTANCE.toolLevel = 1;
|
||||
Builder.INSTANCE.anvilLevel = 1;
|
||||
Builder.INSTANCE.damage = 1;
|
||||
Builder.INSTANCE.alright = true;
|
||||
Builder.INSTANCE.exist = true;
|
||||
public static Builder create(ResourceLocation id) {
|
||||
Builder.INSTANCE.id = id;
|
||||
Builder.INSTANCE.input = null;
|
||||
Builder.INSTANCE.output = null;
|
||||
Builder.INSTANCE.inputCount = 1;
|
||||
Builder.INSTANCE.toolLevel = 1;
|
||||
Builder.INSTANCE.anvilLevel = 1;
|
||||
Builder.INSTANCE.damage = 1;
|
||||
Builder.INSTANCE.alright = true;
|
||||
Builder.INSTANCE.exist = true;
|
||||
|
||||
return Builder.INSTANCE;
|
||||
}
|
||||
return Builder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return SERIALIZER;
|
||||
}
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return SERIALIZER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResultItem() {
|
||||
return this.output;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getResultItem() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Container craftingInventory, Level world) {
|
||||
return this.matches(craftingInventory);
|
||||
}
|
||||
@Override
|
||||
public boolean matches(Container craftingInventory, Level world) {
|
||||
return this.matches(craftingInventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(Container craftingInventory) {
|
||||
return this.output.copy();
|
||||
}
|
||||
@Override
|
||||
public ItemStack assemble(Container craftingInventory) {
|
||||
return this.output.copy();
|
||||
}
|
||||
|
||||
public ItemStack craft(Container craftingInventory, Player player) {
|
||||
if (!player.isCreative()) {
|
||||
if (!checkHammerDurability(craftingInventory, player)) return ItemStack.EMPTY;
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
hammer.hurtAndBreak(this.damage, player, entity -> entity.broadcastBreakEvent((InteractionHand) null));
|
||||
}
|
||||
return this.assemble(craftingInventory);
|
||||
}
|
||||
public ItemStack craft(Container craftingInventory, Player player) {
|
||||
if (!player.isCreative()) {
|
||||
if (!checkHammerDurability(craftingInventory, player)) return ItemStack.EMPTY;
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
hammer.hurtAndBreak(this.damage, player, entity -> entity.broadcastBreakEvent((InteractionHand) null));
|
||||
}
|
||||
return this.assemble(craftingInventory);
|
||||
}
|
||||
|
||||
public boolean checkHammerDurability(Container craftingInventory, Player player) {
|
||||
if (player.isCreative()) return true;
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
int damage = hammer.getDamageValue() + this.damage;
|
||||
return damage < hammer.getMaxDamage();
|
||||
}
|
||||
public boolean checkHammerDurability(Container craftingInventory, Player player) {
|
||||
if (player.isCreative()) return true;
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
int damage = hammer.getDamageValue() + this.damage;
|
||||
return damage < hammer.getMaxDamage();
|
||||
}
|
||||
|
||||
public boolean matches(Container craftingInventory) {
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
if (hammer.isEmpty() || !TagAPI.ITEM_HAMMERS.contains(hammer.getItem())) {
|
||||
return false;
|
||||
}
|
||||
ItemStack material = craftingInventory.getItem(0);
|
||||
int materialCount = material.getCount();
|
||||
int level = ((TieredItem) hammer.getItem()).getTier().getLevel();
|
||||
return this.input.test(craftingInventory.getItem(0)) && materialCount >= this.inputCount && level >= this.toolLevel;
|
||||
}
|
||||
public boolean matches(Container craftingInventory) {
|
||||
ItemStack hammer = craftingInventory.getItem(1);
|
||||
if (hammer.isEmpty() || !TagAPI.ITEM_HAMMERS.contains(hammer.getItem())) {
|
||||
return false;
|
||||
}
|
||||
ItemStack material = craftingInventory.getItem(0);
|
||||
int materialCount = material.getCount();
|
||||
int level = ((TieredItem) hammer.getItem()).getTier().getLevel();
|
||||
return this.input.test(craftingInventory.getItem(0)) && materialCount >= this.inputCount && level >= this.toolLevel;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public int getInputCount() {
|
||||
return this.inputCount;
|
||||
}
|
||||
public int getInputCount() {
|
||||
return this.inputCount;
|
||||
}
|
||||
|
||||
public int getAnvilLevel() {
|
||||
return this.anvilLevel;
|
||||
}
|
||||
public int getAnvilLevel() {
|
||||
return this.anvilLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
NonNullList<Ingredient> defaultedList = NonNullList.create();
|
||||
defaultedList.add(Ingredient.of(TagAPI.ITEM_HAMMERS
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(hammer -> ((TieredItem) hammer).getTier().getLevel() >= toolLevel)
|
||||
.map(ItemStack::new)));
|
||||
defaultedList.add(input);
|
||||
return defaultedList;
|
||||
}
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
NonNullList<Ingredient> defaultedList = NonNullList.create();
|
||||
defaultedList.add(Ingredient.of(TagAPI.ITEM_HAMMERS
|
||||
.getValues()
|
||||
.stream()
|
||||
.filter(hammer -> ((TieredItem) hammer).getTier().getLevel() >= toolLevel)
|
||||
.map(ItemStack::new)));
|
||||
defaultedList.add(input);
|
||||
return defaultedList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean canCraftInDimensions(int width, int height) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean canCraftInDimensions(int width, int height) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return this.id;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeType<?> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
@Override
|
||||
public RecipeType<?> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpecial() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isSpecial() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
AnvilRecipe that = (AnvilRecipe) o;
|
||||
return damage == that.damage && toolLevel == that.toolLevel && id.equals(that.id) && input.equals(that.input) && output
|
||||
.equals(that.output);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
AnvilRecipe that = (AnvilRecipe) o;
|
||||
return damage == that.damage && toolLevel == that.toolLevel && id.equals(that.id) && input.equals(that.input) && output.equals(that.output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, input, output, damage, toolLevel);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, input, output, damage, toolLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AnvilRecipe [" + id + "]";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AnvilRecipe [" + id + "]";
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final static Builder INSTANCE = new Builder();
|
||||
public static class Builder {
|
||||
private final static Builder INSTANCE = new Builder();
|
||||
|
||||
private ResourceLocation id;
|
||||
private Ingredient input;
|
||||
private ItemStack output;
|
||||
private int inputCount = 1;
|
||||
private int toolLevel = 1;
|
||||
private int anvilLevel = 1;
|
||||
private int damage = 1;
|
||||
private boolean alright;
|
||||
private boolean exist;
|
||||
private ResourceLocation id;
|
||||
private Ingredient input;
|
||||
private ItemStack output;
|
||||
private int inputCount = 1;
|
||||
private int toolLevel = 1;
|
||||
private int anvilLevel = 1;
|
||||
private int damage = 1;
|
||||
private boolean alright;
|
||||
private boolean exist;
|
||||
|
||||
private Builder() { }
|
||||
private Builder() {}
|
||||
|
||||
public Builder setInput(ItemLike... inputItems) {
|
||||
this.alright &= RecipeHelper.exists(inputItems);
|
||||
this.setInput(Ingredient.of(inputItems));
|
||||
return this;
|
||||
}
|
||||
public Builder setInput(ItemLike... inputItems) {
|
||||
this.alright &= RecipeHelper.exists(inputItems);
|
||||
this.setInput(Ingredient.of(inputItems));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setInput(Tag<Item> inputTag) {
|
||||
this.setInput(Ingredient.of(inputTag));
|
||||
return this;
|
||||
}
|
||||
public Builder setInput(Tag<Item> inputTag) {
|
||||
this.setInput(Ingredient.of(inputTag));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setInput(Ingredient ingredient) {
|
||||
this.input = ingredient;
|
||||
return this;
|
||||
}
|
||||
public Builder setInput(Ingredient ingredient) {
|
||||
this.input = ingredient;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setInputCount(int count) {
|
||||
this.inputCount = count;
|
||||
return this;
|
||||
}
|
||||
public Builder setInputCount(int count) {
|
||||
this.inputCount = count;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOutput(ItemLike output) {
|
||||
return this.setOutput(output, 1);
|
||||
}
|
||||
public Builder setOutput(ItemLike output) {
|
||||
return this.setOutput(output, 1);
|
||||
}
|
||||
|
||||
public Builder setOutput(ItemLike output, int amount) {
|
||||
this.alright &= RecipeHelper.exists(output);
|
||||
this.output = new ItemStack(output, amount);
|
||||
return this;
|
||||
}
|
||||
public Builder setOutput(ItemLike output, int amount) {
|
||||
this.alright &= RecipeHelper.exists(output);
|
||||
this.output = new ItemStack(output, amount);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setToolLevel(int level) {
|
||||
this.toolLevel = level;
|
||||
return this;
|
||||
}
|
||||
public Builder setToolLevel(int level) {
|
||||
this.toolLevel = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAnvilLevel(int level) {
|
||||
this.anvilLevel = level;
|
||||
return this;
|
||||
}
|
||||
public Builder setAnvilLevel(int level) {
|
||||
this.anvilLevel = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDamage(int damage) {
|
||||
this.damage = damage;
|
||||
return this;
|
||||
}
|
||||
public Builder setDamage(int damage) {
|
||||
this.damage = damage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder checkConfig(PathConfig config) {
|
||||
exist &= config.getBoolean("anvil", id.getPath(), true);
|
||||
return this;
|
||||
}
|
||||
public Builder checkConfig(PathConfig config) {
|
||||
exist &= config.getBoolean("anvil", id.getPath(), true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
if (exist) {
|
||||
if (input == null) {
|
||||
BCLib.LOGGER.warning("Input for Anvil recipe can't be 'null', recipe {} will be ignored!", id);
|
||||
return;
|
||||
}
|
||||
if (output == null) {
|
||||
BCLib.LOGGER.warning("Output for Anvil recipe can't be 'null', recipe {} will be ignored!", id);
|
||||
return;
|
||||
}
|
||||
if (BCLRecipeManager.getRecipe(TYPE, id) != null) {
|
||||
BCLib.LOGGER.warning("Can't add Anvil recipe! Id {} already exists!", id);
|
||||
return;
|
||||
}
|
||||
if (!alright) {
|
||||
BCLib.LOGGER.debug("Can't add Anvil recipe {}! Ingeredient or output not exists.", id);
|
||||
return;
|
||||
}
|
||||
BCLRecipeManager.addRecipe(
|
||||
TYPE,
|
||||
new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void build() {
|
||||
if (exist) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (input == null) {
|
||||
BCLib.LOGGER.warning("Input for Anvil recipe can't be 'null', recipe {} will be ignored!", id);
|
||||
return;
|
||||
}
|
||||
if (output == null) {
|
||||
BCLib.LOGGER.warning("Output for Anvil recipe can't be 'null', recipe {} will be ignored!", id);
|
||||
return;
|
||||
}
|
||||
if (BCLRecipeManager.getRecipe(TYPE, id) != null) {
|
||||
BCLib.LOGGER.warning("Can't add Anvil recipe! Id {} already exists!", id);
|
||||
return;
|
||||
}
|
||||
if (!alright) {
|
||||
BCLib.LOGGER.debug("Can't add Anvil recipe {}! Ingeredient or output not exists.", id);
|
||||
return;
|
||||
}
|
||||
BCLRecipeManager.addRecipe(TYPE, new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<AnvilRecipe> {
|
||||
@Override
|
||||
public AnvilRecipe fromJson(ResourceLocation id, JsonObject json) {
|
||||
Ingredient input = Ingredient.fromJson(json.get("input"));
|
||||
JsonObject result = GsonHelper.getAsJsonObject(json, "result");
|
||||
ItemStack output = ItemUtil.fromJsonRecipe(result);
|
||||
if (output == null) {
|
||||
throw new IllegalStateException("Output item does not exists!");
|
||||
}
|
||||
if (result.has("nbt")) {
|
||||
try {
|
||||
String nbtData = GsonHelper.getAsString(result, "nbt");
|
||||
CompoundTag nbt = TagParser.parseTag(nbtData);
|
||||
output.setTag(nbt);
|
||||
}
|
||||
catch (CommandSyntaxException ex) {
|
||||
BCLib.LOGGER.warning("Error parse nbt data for output.", ex);
|
||||
}
|
||||
}
|
||||
int inputCount = GsonHelper.getAsInt(json, "inputCount", 1);
|
||||
int toolLevel = GsonHelper.getAsInt(json, "toolLevel", 1);
|
||||
int anvilLevel = GsonHelper.getAsInt(json, "anvilLevel", 1);
|
||||
int damage = GsonHelper.getAsInt(json, "damage", 1);
|
||||
public static class Serializer implements RecipeSerializer<AnvilRecipe> {
|
||||
@Override
|
||||
public AnvilRecipe fromJson(ResourceLocation id, JsonObject json) {
|
||||
Ingredient input = Ingredient.fromJson(json.get("input"));
|
||||
JsonObject result = GsonHelper.getAsJsonObject(json, "result");
|
||||
ItemStack output = ItemUtil.fromJsonRecipe(result);
|
||||
if (output == null) {
|
||||
throw new IllegalStateException("Output item does not exists!");
|
||||
}
|
||||
if (result.has("nbt")) {
|
||||
try {
|
||||
String nbtData = GsonHelper.getAsString(result, "nbt");
|
||||
CompoundTag nbt = TagParser.parseTag(nbtData);
|
||||
output.setTag(nbt);
|
||||
}
|
||||
catch (CommandSyntaxException ex) {
|
||||
BCLib.LOGGER.warning("Error parse nbt data for output.", ex);
|
||||
}
|
||||
}
|
||||
int inputCount = GsonHelper.getAsInt(json, "inputCount", 1);
|
||||
int toolLevel = GsonHelper.getAsInt(json, "toolLevel", 1);
|
||||
int anvilLevel = GsonHelper.getAsInt(json, "anvilLevel", 1);
|
||||
int damage = GsonHelper.getAsInt(json, "damage", 1);
|
||||
|
||||
return new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage);
|
||||
}
|
||||
return new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnvilRecipe fromNetwork(ResourceLocation id, FriendlyByteBuf packetBuffer) {
|
||||
Ingredient input = Ingredient.fromNetwork(packetBuffer);
|
||||
ItemStack output = packetBuffer.readItem();
|
||||
int inputCount = packetBuffer.readVarInt();
|
||||
int toolLevel = packetBuffer.readVarInt();
|
||||
int anvilLevel = packetBuffer.readVarInt();
|
||||
int damage = packetBuffer.readVarInt();
|
||||
@Override
|
||||
public AnvilRecipe fromNetwork(ResourceLocation id, FriendlyByteBuf packetBuffer) {
|
||||
Ingredient input = Ingredient.fromNetwork(packetBuffer);
|
||||
ItemStack output = packetBuffer.readItem();
|
||||
int inputCount = packetBuffer.readVarInt();
|
||||
int toolLevel = packetBuffer.readVarInt();
|
||||
int anvilLevel = packetBuffer.readVarInt();
|
||||
int damage = packetBuffer.readVarInt();
|
||||
|
||||
return new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage);
|
||||
}
|
||||
return new AnvilRecipe(id, input, output, inputCount, toolLevel, anvilLevel, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toNetwork(FriendlyByteBuf packetBuffer, AnvilRecipe recipe) {
|
||||
recipe.input.toNetwork(packetBuffer);
|
||||
packetBuffer.writeItem(recipe.output);
|
||||
packetBuffer.writeVarInt(recipe.inputCount);
|
||||
packetBuffer.writeVarInt(recipe.toolLevel);
|
||||
packetBuffer.writeVarInt(recipe.anvilLevel);
|
||||
packetBuffer.writeVarInt(recipe.damage);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void toNetwork(FriendlyByteBuf packetBuffer, AnvilRecipe recipe) {
|
||||
recipe.input.toNetwork(packetBuffer);
|
||||
packetBuffer.writeItem(recipe.output);
|
||||
packetBuffer.writeVarInt(recipe.inputCount);
|
||||
packetBuffer.writeVarInt(recipe.toolLevel);
|
||||
packetBuffer.writeVarInt(recipe.anvilLevel);
|
||||
packetBuffer.writeVarInt(recipe.damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.world.item.crafting.RecipeType;
|
|||
import net.minecraft.world.item.crafting.SmeltingRecipe;
|
||||
import net.minecraft.world.item.crafting.SmokingRecipe;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.config.PathConfig;
|
||||
|
||||
public class FurnaceRecipe {
|
||||
|
@ -77,54 +76,53 @@ public class FurnaceRecipe {
|
|||
|
||||
public void build(boolean blasting, boolean campfire, boolean smoker) {
|
||||
if (exist) {
|
||||
SmeltingRecipe recipe = new SmeltingRecipe(
|
||||
return;
|
||||
}
|
||||
|
||||
SmeltingRecipe recipe = new SmeltingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.SMELTING, recipe);
|
||||
|
||||
if (blasting) {
|
||||
BlastingRecipe recipe2 = new BlastingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time
|
||||
time / 2
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.SMELTING, recipe);
|
||||
|
||||
if (blasting) {
|
||||
BlastingRecipe recipe2 = new BlastingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time / 2
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.BLASTING, recipe2);
|
||||
}
|
||||
|
||||
if (campfire) {
|
||||
CampfireCookingRecipe recipe2 = new CampfireCookingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time * 3
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.CAMPFIRE_COOKING, recipe2);
|
||||
}
|
||||
|
||||
if (smoker) {
|
||||
SmokingRecipe recipe2 = new SmokingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time / 2
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.SMOKING, recipe2);
|
||||
}
|
||||
BCLRecipeManager.addRecipe(RecipeType.BLASTING, recipe2);
|
||||
}
|
||||
else {
|
||||
BCLib.LOGGER.debug("Furnace recipe {} couldn't be added", id);
|
||||
|
||||
if (campfire) {
|
||||
CampfireCookingRecipe recipe2 = new CampfireCookingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time * 3
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.CAMPFIRE_COOKING, recipe2);
|
||||
}
|
||||
|
||||
if (smoker) {
|
||||
SmokingRecipe recipe2 = new SmokingRecipe(
|
||||
id,
|
||||
group,
|
||||
Ingredient.of(input),
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
time / 2
|
||||
);
|
||||
BCLRecipeManager.addRecipe(RecipeType.SMOKING, recipe2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.world.item.crafting.RecipeType;
|
|||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.world.item.crafting.ShapelessRecipe;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.config.PathConfig;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -30,7 +29,7 @@ public class GridRecipe {
|
|||
private String[] shape;
|
||||
private Map<Character, Ingredient> materialKeys = Maps.newHashMap();
|
||||
private int count;
|
||||
private boolean exist = true;
|
||||
private boolean exist;
|
||||
|
||||
private GridRecipe() {}
|
||||
|
||||
|
@ -114,24 +113,23 @@ public class GridRecipe {
|
|||
}
|
||||
|
||||
public void build() {
|
||||
if (exist) {
|
||||
int height = shape.length;
|
||||
int width = shape[0].length();
|
||||
ItemStack result = new ItemStack(output, count);
|
||||
NonNullList<Ingredient> materials = this.getMaterials(width, height);
|
||||
|
||||
CraftingRecipe recipe = shaped ? new ShapedRecipe(
|
||||
id,
|
||||
group,
|
||||
width,
|
||||
height,
|
||||
materials,
|
||||
result
|
||||
) : new ShapelessRecipe(id, group, result, materials);
|
||||
BCLRecipeManager.addRecipe(type, recipe);
|
||||
}
|
||||
else {
|
||||
BCLib.LOGGER.debug("Recipe {} couldn't be added", id);
|
||||
if (!exist) {
|
||||
return;
|
||||
}
|
||||
|
||||
int height = shape.length;
|
||||
int width = shape[0].length();
|
||||
ItemStack result = new ItemStack(output, count);
|
||||
NonNullList<Ingredient> materials = this.getMaterials(width, height);
|
||||
|
||||
CraftingRecipe recipe = shaped ? new ShapedRecipe(
|
||||
id,
|
||||
group,
|
||||
width,
|
||||
height,
|
||||
materials,
|
||||
result
|
||||
) : new ShapelessRecipe(id, group, result, materials);
|
||||
BCLRecipeManager.addRecipe(type, recipe);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class SmithingTableRecipe {
|
|||
BUILDER.base = null;
|
||||
BUILDER.addition = null;
|
||||
BUILDER.result = null;
|
||||
BUILDER.alright = true;
|
||||
BUILDER.exist = true;
|
||||
|
||||
return BUILDER;
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ public class SmithingTableRecipe {
|
|||
private Ingredient base;
|
||||
private Ingredient addition;
|
||||
private ItemStack result;
|
||||
private boolean alright;
|
||||
private boolean exist;
|
||||
|
||||
private SmithingTableRecipe() {}
|
||||
|
@ -49,13 +48,13 @@ public class SmithingTableRecipe {
|
|||
}
|
||||
|
||||
public SmithingTableRecipe setResult(ItemLike item, int count) {
|
||||
this.alright &= BCLRecipeManager.exists(item);
|
||||
this.exist &= BCLRecipeManager.exists(item);
|
||||
this.result = new ItemStack(item, count);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SmithingTableRecipe setBase(ItemLike... items) {
|
||||
this.alright &= BCLRecipeManager.exists(items);
|
||||
this.exist &= BCLRecipeManager.exists(items);
|
||||
this.base = Ingredient.of(items);
|
||||
return this;
|
||||
}
|
||||
|
@ -66,7 +65,7 @@ public class SmithingTableRecipe {
|
|||
}
|
||||
|
||||
public SmithingTableRecipe setAddition(ItemLike... items) {
|
||||
this.alright &= BCLRecipeManager.exists(items);
|
||||
this.exist &= BCLRecipeManager.exists(items);
|
||||
this.addition = Ingredient.of(items);
|
||||
return this;
|
||||
}
|
||||
|
@ -97,10 +96,7 @@ public class SmithingTableRecipe {
|
|||
BCLib.LOGGER.warning("Can't add Smithing recipe! Id {} already exists!", id);
|
||||
return;
|
||||
}
|
||||
if (!alright) {
|
||||
BCLib.LOGGER.debug("Can't add Smithing recipe {}! Ingeredients or output not exists.", id);
|
||||
return;
|
||||
}
|
||||
|
||||
BCLRecipeManager.addRecipe(TYPE, new UpgradeRecipe(id, base, addition, result));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class BlocksHelper {
|
|||
/**
|
||||
* Rotates {@link BlockState} horizontally. Used in block classes with {@link Direction} {@link Property} in rotate function.
|
||||
*
|
||||
* @param state - {@link BlockState} to mirror;
|
||||
* @param state - {@link BlockState} to mirror;
|
||||
* @param rotation - {@link Rotation};
|
||||
* @param facing - Block {@link Direction} {@link Property}.
|
||||
* @return Rotated {@link BlockState}.
|
||||
|
|
|
@ -45,9 +45,9 @@ public class PathUtil {
|
|||
/**
|
||||
* A simple directory walker that ignores dot-files
|
||||
*
|
||||
* @param path The path where you want to start
|
||||
* @param path The path where you want to start
|
||||
* @param pathConsumer The consumer called for each valid file. The consumer will get an absolute {@link Path}-Object
|
||||
* for each visited file
|
||||
* for each visited file
|
||||
*/
|
||||
public static void fileWalker(File path, Consumer<Path> pathConsumer) {
|
||||
fileWalker(path, true, pathConsumer);
|
||||
|
@ -56,10 +56,10 @@ public class PathUtil {
|
|||
/**
|
||||
* A simple directory walker that ignores dot-files
|
||||
*
|
||||
* @param path The path where you want to start
|
||||
* @param recursive if {@code false}, only the {@code path} is traversed
|
||||
* @param path The path where you want to start
|
||||
* @param recursive if {@code false}, only the {@code path} is traversed
|
||||
* @param pathConsumer The consumer called for each valid file. The consumer will get an absolute {@link Path}-Object
|
||||
* for each visited file
|
||||
* for each visited file
|
||||
*/
|
||||
public static void fileWalker(File path, boolean recursive, Consumer<Path> pathConsumer) {
|
||||
if (!path.exists()) return;
|
||||
|
|
|
@ -73,12 +73,12 @@ public class TranslationHelper {
|
|||
if (!missingNames.isEmpty()) {
|
||||
|
||||
System.out.println("========================================");
|
||||
System.out.println(" MISSING NAMES LIST");
|
||||
System.out.println(" MISSING NAMES LIST");
|
||||
|
||||
if (!missingNames.isEmpty()) {
|
||||
if (languageCode.equals("en_us")) {
|
||||
System.out.println("========================================");
|
||||
System.out.println(" AUTO ENGLISH BEAUTIFICATION");
|
||||
System.out.println(" AUTO ENGLISH BEAUTIFICATION");
|
||||
System.out.println("========================================");
|
||||
missingNames.stream().sorted().forEach(name -> {
|
||||
System.out.println(" \"" + name + "\": \"" + fastTranslateEn(name) + "\",");
|
||||
|
@ -86,7 +86,7 @@ public class TranslationHelper {
|
|||
}
|
||||
else {
|
||||
System.out.println("========================================");
|
||||
System.out.println(" TEMPLATE: [" + languageCode + "]");
|
||||
System.out.println(" TEMPLATE: [" + languageCode + "]");
|
||||
System.out.println("========================================");
|
||||
missingNames.stream().sorted().forEach(name -> {
|
||||
System.out.println(" \"" + name + "\": \"\",");
|
||||
|
|
|
@ -102,7 +102,7 @@ public class BCLFeature {
|
|||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
|
@ -113,15 +113,15 @@ public class BCLFeature {
|
|||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param minY A {@link VerticalAnchor} for the minimum height, for example
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* {@code VerticalAnchor.bottom()}, {@code VerticalAnchor.absolute(10)}, {@code VerticalAnchor.aboveBottom(10)}
|
||||
* @param maxY A {@link VerticalAnchor} for the maximum height.
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, VerticalAnchor minY, VerticalAnchor maxY, boolean rare) {
|
||||
|
@ -131,14 +131,14 @@ public class BCLFeature {
|
|||
/**
|
||||
* Will create a basic ore feature.
|
||||
*
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param id {@link ResourceLocation} feature ID.
|
||||
* @param blockOre {@link Decoration} feature step.
|
||||
* @param hostBlock {@link Block} to generate feature in.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veins iterations per chunk.
|
||||
* @param veinSize size of ore vein.
|
||||
* @param placement {@link net.minecraft.world.level.levelgen.placement.PlacementModifier} for the ore distribution,
|
||||
* for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
|
||||
* @param rare when true, this is placed as a rare resource
|
||||
* @return new BCLFeature instance.
|
||||
*/
|
||||
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, PlacementModifier placement, boolean rare) {
|
||||
|
|
|
@ -8,20 +8,20 @@ import ru.bclib.api.biomes.BiomeAPI;
|
|||
import java.util.List;
|
||||
|
||||
public abstract class BCLBiomeSource extends BiomeSource {
|
||||
protected final Registry<Biome> biomeRegistry;
|
||||
protected final long seed;
|
||||
protected final Registry<Biome> biomeRegistry;
|
||||
protected final long seed;
|
||||
|
||||
private static List<Biome> preInit(Registry<Biome> biomeRegistry, List<Biome> biomes){
|
||||
biomes.forEach(biome -> BiomeAPI.sortBiomeFeatures(biome));
|
||||
return biomes;
|
||||
}
|
||||
private static List<Biome> preInit(Registry<Biome> biomeRegistry, List<Biome> biomes){
|
||||
biomes.forEach(biome -> BiomeAPI.sortBiomeFeatures(biome));
|
||||
return biomes;
|
||||
}
|
||||
|
||||
protected BCLBiomeSource(Registry<Biome> biomeRegistry, long seed, List<Biome> list) {
|
||||
super(preInit(biomeRegistry, list));
|
||||
protected BCLBiomeSource(Registry<Biome> biomeRegistry, long seed, List<Biome> list) {
|
||||
super(preInit(biomeRegistry, list));
|
||||
|
||||
this.seed = seed;
|
||||
this.biomeRegistry = biomeRegistry;
|
||||
this.seed = seed;
|
||||
this.biomeRegistry = biomeRegistry;
|
||||
|
||||
BiomeAPI.initRegistry(biomeRegistry);
|
||||
}
|
||||
BiomeAPI.initRegistry(biomeRegistry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,20 +32,20 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
|||
});
|
||||
private BiomeMap biomeMap;
|
||||
|
||||
private static boolean forceLegacyGenerator = false;
|
||||
private static boolean forceLegacyGenerator = false;
|
||||
private static int lastWorldHeight;
|
||||
private static int worldHeight;
|
||||
|
||||
/**
|
||||
* When true, the older square generator is used for the nether.
|
||||
/**
|
||||
* When true, the older square generator is used for the nether.
|
||||
*
|
||||
* This override is used (for example) by BetterNether to force the legacy generation for worlds
|
||||
* that were created before 1.18
|
||||
* @param val wether or not you want to force the old generatore.
|
||||
*/
|
||||
public static void setForceLegacyGeneration(boolean val){
|
||||
forceLegacyGenerator = val;
|
||||
}
|
||||
* @param val wether or not you want to force the old generatore.
|
||||
*/
|
||||
public static void setForceLegacyGeneration(boolean val){
|
||||
forceLegacyGenerator = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set world height, used when Nether is larger than vanilla 128 blocks tall.
|
||||
|
|
|
@ -6,29 +6,29 @@ import ru.bclib.noise.OpenSimplexNoise;
|
|||
import ru.bclib.util.MHelper;
|
||||
|
||||
public class DoubleBlockSurfaceNoiseCondition extends SurfaceNoiseCondition {
|
||||
public static final DoubleBlockSurfaceNoiseCondition CONDITION = new DoubleBlockSurfaceNoiseCondition(0);
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(4141);
|
||||
public static final DoubleBlockSurfaceNoiseCondition CONDITION = new DoubleBlockSurfaceNoiseCondition(0);
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(4141);
|
||||
|
||||
private final double threshold;
|
||||
public DoubleBlockSurfaceNoiseCondition(double threshold){
|
||||
this.threshold = threshold;
|
||||
}
|
||||
private final double threshold;
|
||||
public DoubleBlockSurfaceNoiseCondition(double threshold){
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
private static int lastX = Integer.MIN_VALUE;
|
||||
private static int lastZ = Integer.MIN_VALUE;
|
||||
private static double lastValue = 0;
|
||||
private static int lastX = Integer.MIN_VALUE;
|
||||
private static int lastZ = Integer.MIN_VALUE;
|
||||
private static double lastValue = 0;
|
||||
|
||||
@Override
|
||||
public boolean test(SurfaceRulesContextAccessor context) {
|
||||
final int x = context.getBlockX();
|
||||
final int z = context.getBlockZ();
|
||||
if (lastX==x && lastZ==z) return lastValue > threshold;
|
||||
@Override
|
||||
public boolean test(SurfaceRulesContextAccessor context) {
|
||||
final int x = context.getBlockX();
|
||||
final int z = context.getBlockZ();
|
||||
if (lastX==x && lastZ==z) return lastValue > threshold;
|
||||
|
||||
double value = NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(-0.4, 0.4, MHelper.RANDOM);
|
||||
double value = NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(-0.4, 0.4, MHelper.RANDOM);
|
||||
|
||||
lastX=x;
|
||||
lastZ=z;
|
||||
lastValue=value;
|
||||
return value > threshold;
|
||||
}
|
||||
lastX=x;
|
||||
lastZ=z;
|
||||
lastValue=value;
|
||||
return value > threshold;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"title.bclib.confirmrestart": "Restart Required",
|
||||
"message.bclib.confirmrestart": "The requested content was synchronized. You need to restart Minecraft now.",
|
||||
"title.link.bclib.discord": "Discord",
|
||||
"title.bclib.modmenu.main": "BCLib Settings",
|
||||
"title.bclib.modmenu.main": "BCLib Settings",
|
||||
"title.bclib.progress": "Progress",
|
||||
"title.bclib.filesync.progress": "File Transfer",
|
||||
"message.bclib.filesync.progress": "Syncing File-Content with Server",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"title.bclib.confirmrestart": "재시작 필요",
|
||||
"message.bclib.confirmrestart": "요청한 콘텐츠가 동기화되었습니다. 지금 마인크래프트를 다시 시작해야 합니다.",
|
||||
"title.link.bclib.discord": "디스코드",
|
||||
"title.bclib.modmenu.main": "BCLib 환경설정",
|
||||
"title.bclib.modmenu.main": "BCLib 환경설정",
|
||||
"title.bclib.progress": "진행",
|
||||
"title.bclib.filesync.progress": "파일 전송",
|
||||
"message.bclib.filesync.progress": "파일 내용을 서버와 동기화하는 중",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// Value near 254
|
||||
bool isEmissive(float alpha) {
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
}
|
||||
|
||||
void frx_startFragment(inout frx_FragmentData fragData) {
|
||||
|
|
|
@ -32,7 +32,7 @@ vec3 hsvToRGB(vec3 color) {
|
|||
|
||||
// Value near 254
|
||||
bool isEmissive(float alpha) {
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -34,7 +34,7 @@ vec3 hsvToRGB(vec3 color) {
|
|||
|
||||
// Value near 254
|
||||
bool isEmissive(float alpha) {
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -33,7 +33,7 @@ vec3 hsvToRGB(vec3 color) {
|
|||
|
||||
// Value near 254
|
||||
bool isEmissive(float alpha) {
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -32,7 +32,7 @@ vec3 hsvToRGB(vec3 color) {
|
|||
|
||||
// Value near 254
|
||||
bool isEmissive(float alpha) {
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
return 0.9960 < alpha && alpha < 0.9962;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
accessWidener v1 named
|
||||
|
||||
# Classes
|
||||
accessible class net/minecraft/client/Minecraft$ExperimentalDialogType
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$Context
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$Condition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$SurfaceRule
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$LazyXZCondition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$LazyCondition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$SequenceRuleSource
|
||||
accessible class net/minecraft/client/Minecraft$ExperimentalDialogType
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$Context
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$Condition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$SurfaceRule
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$LazyXZCondition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$LazyCondition
|
||||
accessible class net/minecraft/world/level/levelgen/SurfaceRules$SequenceRuleSource
|
|
@ -26,10 +26,10 @@
|
|||
"server": [
|
||||
"ru.bclib.server.BCLibServer"
|
||||
],
|
||||
"modmenu": [ "ru.bclib.gui.modmenu.EntryPoint::entrypointObject" ]
|
||||
"modmenu": [ "ru.bclib.gui.modmenu.EntryPoint::entrypointObject" ]
|
||||
},
|
||||
"accessWidener" : "bclib.accesswidener",
|
||||
"mixins": [
|
||||
"accessWidener" : "bclib.accesswidener",
|
||||
"mixins": [
|
||||
"bclib.mixins.common.json",
|
||||
"bclib.mixins.client.json"
|
||||
],
|
||||
|
@ -37,12 +37,12 @@
|
|||
"fabricloader": ">=0.12.9",
|
||||
"fabric": ">=0.44.0",
|
||||
"minecraft": ">=1.18.1"
|
||||
},
|
||||
"custom":{
|
||||
"modmenu":{
|
||||
"links":{
|
||||
"title.link.bclib.discord":"https://discord.gg/kYuATbYbKW"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"custom":{
|
||||
"modmenu":{
|
||||
"links":{
|
||||
"title.link.bclib.discord":"https://discord.gg/kYuATbYbKW"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue