More WIP porting messing around with Claude
This commit is contained in:
parent
53049ab1c0
commit
5072ae1dd7
|
|
@ -28,9 +28,9 @@ import net.minecraft.world.entity.animal.cow.MushroomCow;
|
|||
import net.minecraft.world.entity.animal.rabbit.Rabbit;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.monster.Creeper;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
import net.minecraft.world.entity.npc.Villager;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
import net.minecraft.world.entity.monster.zombie.Zombie;
|
||||
import net.minecraft.world.entity.npc.villager.Villager;
|
||||
import net.minecraft.world.entity.npc.villager.VillagerProfession;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
package thedarkcolour.exdeorum.blockentity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.level.storage.ValueOutput;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
|
@ -55,21 +55,21 @@ public abstract class AbstractMachineBlockEntity<M extends AbstractMachineBlockE
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
super.saveAdditional(nbt, registries);
|
||||
protected void saveAdditional(ValueOutput output) {
|
||||
super.saveAdditional(output);
|
||||
|
||||
nbt.put("inventory", this.inventory.serializeNBT(registries));
|
||||
nbt.putInt("energy", this.energy.getEnergyStored());
|
||||
nbt.putInt("redstoneMode", this.redstoneMode);
|
||||
this.inventory.serialize(output.child("inventory"));
|
||||
output.putInt("energy", this.energy.getEnergyStored());
|
||||
output.putInt("redstoneMode", this.redstoneMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
super.loadAdditional(nbt, registries);
|
||||
public void loadAdditional(ValueInput input) {
|
||||
super.loadAdditional(input);
|
||||
|
||||
this.inventory.deserializeNBT(registries, nbt.getCompound("inventory"));
|
||||
this.energy.setStoredEnergy(nbt.getInt("energy"));
|
||||
this.redstoneMode = Mth.clamp(nbt.getInt("redstoneMode"), 0, 2);
|
||||
this.inventory.deserialize(input.childOrEmpty("inventory"));
|
||||
this.energy.setStoredEnergy(input.getIntOr("energy", 0));
|
||||
this.redstoneMode = Mth.clamp(input.getIntOr("redstoneMode", 0), 0, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
|
@ -51,8 +52,8 @@ public abstract class EBlockEntity extends BlockEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider registries) {
|
||||
loadAdditional(pkt.getTag(), registries);
|
||||
public void onDataPacket(Connection net, ValueInput valueInput) {
|
||||
loadAdditional(valueInput);
|
||||
}
|
||||
|
||||
public void markUpdated() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
|
|
@ -32,6 +31,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.level.storage.ValueOutput;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -69,18 +70,18 @@ public class MechanicalHammerBlockEntity extends AbstractMachineBlockEntity<Mech
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
super.saveAdditional(nbt, registries);
|
||||
protected void saveAdditional(ValueOutput output) {
|
||||
super.saveAdditional(output);
|
||||
|
||||
nbt.putInt("progress", this.progress);
|
||||
output.putInt("progress", this.progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
super.loadAdditional(nbt, registries);
|
||||
public void loadAdditional(ValueInput input) {
|
||||
super.loadAdditional(input);
|
||||
|
||||
this.progress = nbt.getInt("progress");
|
||||
onHammerChanged(registries);
|
||||
this.progress = input.getIntOr("progress", NOT_RUNNING);
|
||||
onHammerChanged(input.lookup());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
package thedarkcolour.exdeorum.blockentity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
|
@ -31,6 +29,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.level.storage.ValueOutput;
|
||||
import thedarkcolour.exdeorum.blockentity.helper.ItemHelper;
|
||||
import thedarkcolour.exdeorum.blockentity.logic.SieveLogic;
|
||||
import thedarkcolour.exdeorum.config.EConfig;
|
||||
|
|
@ -54,17 +54,17 @@ public class MechanicalSieveBlockEntity extends AbstractMachineBlockEntity<Mecha
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
super.saveAdditional(nbt, registries);
|
||||
protected void saveAdditional(ValueOutput output) {
|
||||
super.saveAdditional(output);
|
||||
|
||||
this.logic.saveNbt(nbt, registries);
|
||||
this.logic.saveNbt(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
super.loadAdditional(nbt, registries);
|
||||
public void loadAdditional(ValueInput input) {
|
||||
super.loadAdditional(input);
|
||||
|
||||
this.logic.loadNbt(nbt, registries);
|
||||
this.logic.loadNbt(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -208,10 +208,10 @@ public class MechanicalSieveBlockEntity extends AbstractMachineBlockEntity<Mecha
|
|||
|
||||
// Used instead of onLoad because missing parameter
|
||||
@Override
|
||||
public void deserializeNBT(HolderLookup.Provider provider, CompoundTag nbt) {
|
||||
super.deserializeNBT(provider, nbt);
|
||||
public void deserialize(ValueInput input) {
|
||||
super.deserialize(input);
|
||||
|
||||
this.sieve.logic.setMesh(provider, this.sieve.inventory.getStackInSlot(MESH_SLOT), false);
|
||||
this.sieve.logic.setMesh(input.lookup(), this.sieve.inventory.getStackInSlot(MESH_SLOT), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ package thedarkcolour.exdeorum.blockentity.logic;
|
|||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.world.level.storage.ValueInput;
|
||||
import net.minecraft.world.level.storage.ValueOutput;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
|
|
@ -90,7 +90,7 @@ public class SieveLogic {
|
|||
if (this.progress >= 1.0f - Mth.EPSILON) {
|
||||
var level = this.owner.getServerLevel();
|
||||
var context = RecipeUtil.emptyLootContext(level);
|
||||
var rand = level.random;
|
||||
var rand = level.getRandom();
|
||||
var limitDrops = this.contents.getItem() == Items.MOSS_BLOCK && EConfig.SERVER.limitMossSieveDrops.get();
|
||||
var handledAnyDrops = false;
|
||||
var hasDrops = false;
|
||||
|
|
@ -165,33 +165,22 @@ public class SieveLogic {
|
|||
}
|
||||
}
|
||||
|
||||
public void saveNbt(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
public void saveNbt(ValueOutput output) {
|
||||
if (!this.contents.isEmpty()) {
|
||||
nbt.put("contents", this.contents.save(registries));
|
||||
output.store("contents", ItemStack.CODEC, this.contents);
|
||||
}
|
||||
if (!this.mechanical && !this.mesh.isEmpty()) {
|
||||
nbt.put("mesh", this.mesh.save(registries));
|
||||
output.store("mesh", ItemStack.CODEC, this.mesh);
|
||||
}
|
||||
nbt.putFloat("progress", this.progress);
|
||||
output.putFloat("progress", this.progress);
|
||||
}
|
||||
|
||||
public void loadNbt(CompoundTag nbt, HolderLookup.Provider registries) {
|
||||
if (nbt.contains("contents")) {
|
||||
this.contents = ItemStack.parseOptional(registries, nbt.getCompound("contents"));
|
||||
} else {
|
||||
this.contents = ItemStack.EMPTY;
|
||||
}
|
||||
if (nbt.getTagType("progress") == Tag.TAG_SHORT) {
|
||||
this.progress = (float) nbt.getShort("progress") / 100f;
|
||||
} else {
|
||||
this.progress = nbt.getFloat("progress");
|
||||
}
|
||||
public void loadNbt(ValueInput input) {
|
||||
var registries = input.lookup();
|
||||
this.contents = input.read("contents", ItemStack.CODEC).orElse(ItemStack.EMPTY);
|
||||
this.progress = input.getFloatOr("progress", 0f);
|
||||
if (!this.mechanical) {
|
||||
if (nbt.contains("mesh")) {
|
||||
setMesh(registries, ItemStack.parseOptional(registries, nbt.getCompound("mesh")), false);
|
||||
} else {
|
||||
setMesh(registries, ItemStack.EMPTY, false);
|
||||
}
|
||||
setMesh(registries, input.read("mesh", ItemStack.CODEC).orElse(ItemStack.EMPTY), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import net.minecraft.core.HolderLookup;
|
|||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.advancements.AdvancementProvider;
|
||||
import net.minecraft.data.advancements.AdvancementSubProvider;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
|
@ -47,8 +48,8 @@ class Advancements extends AdvancementProvider {
|
|||
super(output, registries, List.of(new CoreAchievements()));
|
||||
}
|
||||
|
||||
private static String modLoc(String path) {
|
||||
return Identifier.fromNamespaceAndPath(ExDeorum.ID, path).toString();
|
||||
private static Identifier modLoc(String path) {
|
||||
return Identifier.fromNamespaceAndPath(ExDeorum.ID, path);
|
||||
}
|
||||
|
||||
public static class CoreAchievements implements AdvancementSubProvider {
|
||||
|
|
@ -80,7 +81,7 @@ class Advancements extends AdvancementProvider {
|
|||
true,
|
||||
true
|
||||
)
|
||||
.addCriterion("craft_crook", hasItems(item().of(EItemTags.CROOKS).build()))
|
||||
.addCriterion("craft_crook", hasItems(item().of(registries.lookupOrThrow(Registries.ITEM), EItemTags.CROOKS).build()))
|
||||
.save(saver, modLoc("core/crook"));
|
||||
var barrel = advancement()
|
||||
.parent(root)
|
||||
|
|
@ -94,7 +95,7 @@ class Advancements extends AdvancementProvider {
|
|||
true,
|
||||
true
|
||||
)
|
||||
.addCriterion("has_barrel", hasItems(item().of(EItemTags.BARRELS).build()))
|
||||
.addCriterion("has_barrel", hasItems(item().of(registries.lookupOrThrow(Registries.ITEM), EItemTags.BARRELS).build()))
|
||||
.save(saver, modLoc("core/barrel"));
|
||||
var silkWorm = advancement()
|
||||
.parent(crook)
|
||||
|
|
@ -108,7 +109,7 @@ class Advancements extends AdvancementProvider {
|
|||
true,
|
||||
false
|
||||
)
|
||||
.addCriterion("has_silk_worm", hasItems(item().of(EItems.SILKWORM.get()).build()))
|
||||
.addCriterion("has_silk_worm", hasItems(item().of(registries.lookupOrThrow(Registries.ITEM), EItems.SILKWORM.get()).build()))
|
||||
.save(saver, modLoc("core/silk_worm"));
|
||||
var stringMesh = advancement()
|
||||
.parent(silkWorm)
|
||||
|
|
@ -122,7 +123,7 @@ class Advancements extends AdvancementProvider {
|
|||
true,
|
||||
false
|
||||
)
|
||||
.addCriterion("has_string_mesh", hasItems(item().of(EItems.STRING_MESH.get()).build()))
|
||||
.addCriterion("has_string_mesh", hasItems(item().of(registries.lookupOrThrow(Registries.ITEM), EItems.STRING_MESH.get()).build()))
|
||||
.save(saver, modLoc("core/string_mesh"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import net.minecraft.core.registries.Registries;
|
|||
import net.minecraft.data.loot.BlockLootSubProvider;
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
||||
|
||||
import net.minecraft.world.level.storage.loot.LootPool;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.storage.loot.entries.LootItem;
|
||||
|
|
@ -47,7 +47,7 @@ class BlockLoot extends BlockLootSubProvider {
|
|||
@Override
|
||||
protected void generate() {
|
||||
MKUtils.forModRegistry(Registries.BLOCK, ExDeorum.ID, (id, block) -> {
|
||||
if (block.getLootTable() != BuiltInLootTables.EMPTY) {
|
||||
if (block.getLootTable().isPresent()) {
|
||||
dropSelf(block);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,13 +18,12 @@
|
|||
|
||||
package thedarkcolour.exdeorum.data;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder;
|
||||
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
|
||||
import net.neoforged.neoforge.client.model.generators.loaders.CompositeModelBuilder;
|
||||
import thedarkcolour.exdeorum.material.DefaultMaterials;
|
||||
import thedarkcolour.exdeorum.registry.EBlocks;
|
||||
import thedarkcolour.exdeorum.registry.ECompressedBlocks;
|
||||
|
|
@ -33,6 +32,24 @@ import thedarkcolour.modkit.data.MKBlockModelProvider;
|
|||
import java.util.Objects;
|
||||
|
||||
class BlockModels {
|
||||
/**
|
||||
* Wraps a pending model JSON so callers can chain .renderType() after creating a model.
|
||||
* The JSON is registered lazily, so mutations (renderType) before run() are reflected.
|
||||
*/
|
||||
static class ModelBuilder {
|
||||
private final JsonObject json;
|
||||
|
||||
ModelBuilder(MKBlockModelProvider models, Identifier modelId, JsonObject json) {
|
||||
this.json = json;
|
||||
models.acceptModel(modelId, () -> json);
|
||||
}
|
||||
|
||||
public ModelBuilder renderType(String type) {
|
||||
json.addProperty("render_type", "minecraft:" + type);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addBlockModels(MKBlockModelProvider models) {
|
||||
models.simpleBlock(EBlocks.DUST.get());
|
||||
models.simpleBlock(EBlocks.CRUSHED_NETHERRACK.get());
|
||||
|
|
@ -228,39 +245,62 @@ class BlockModels {
|
|||
}
|
||||
|
||||
public static void compressedBlock(MKBlockModelProvider models, Block block, Block appearance) {
|
||||
var original = models.file(models.blockTexture(appearance));
|
||||
Identifier originalModelId = models.blockTexture(appearance);
|
||||
Identifier modelId = models.modBlock(models.name(block));
|
||||
|
||||
models.getVariantBuilder(block).partialState().addModels(new ConfiguredModel(
|
||||
models.models().getBuilder(models.name(block)).customLoader(CompositeModelBuilder::begin)
|
||||
.child("base", models.models().nested()
|
||||
.parent(original)
|
||||
.renderType("solid")
|
||||
)
|
||||
.child("overlay", models.models().nested()
|
||||
.parent(models.mcFile("cube_all"))
|
||||
.texture("all", models.modLoc("block/compressed_overlay"))
|
||||
.renderType("translucent")
|
||||
)
|
||||
.itemRenderOrder("base", "overlay")
|
||||
.end()
|
||||
.parent(models.mcFile("block"))
|
||||
.texture("particle", models.blockTexture(appearance))
|
||||
));
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("parent", models.mcBlock("block").toString());
|
||||
json.addProperty("loader", "neoforge:composite");
|
||||
|
||||
JsonObject textures = new JsonObject();
|
||||
textures.addProperty("particle", originalModelId.toString());
|
||||
json.add("textures", textures);
|
||||
|
||||
JsonObject children = new JsonObject();
|
||||
|
||||
JsonObject baseChild = new JsonObject();
|
||||
baseChild.addProperty("parent", originalModelId.toString());
|
||||
baseChild.addProperty("render_type", "minecraft:solid");
|
||||
children.add("base", baseChild);
|
||||
|
||||
JsonObject overlayChild = new JsonObject();
|
||||
overlayChild.addProperty("parent", models.mcBlock("cube_all").toString());
|
||||
overlayChild.addProperty("render_type", "minecraft:translucent");
|
||||
JsonObject overlayTextures = new JsonObject();
|
||||
overlayTextures.addProperty("all", models.modLoc("block/compressed_overlay").toString());
|
||||
overlayChild.add("textures", overlayTextures);
|
||||
children.add("overlay", overlayChild);
|
||||
|
||||
json.add("children", children);
|
||||
|
||||
JsonArray itemRenderOrder = new JsonArray();
|
||||
itemRenderOrder.add("base");
|
||||
itemRenderOrder.add("overlay");
|
||||
json.add("item_render_order", itemRenderOrder);
|
||||
|
||||
models.acceptModel(modelId, () -> json);
|
||||
models.simpleBlock(block, modelId);
|
||||
}
|
||||
|
||||
public static void crucible(MKBlockModelProvider models, Block block, Block appearance) {
|
||||
crucible(models, block, appearance, "", "");
|
||||
}
|
||||
|
||||
public static BlockModelBuilder crucible(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix, String pathSuffix) {
|
||||
public static ModelBuilder crucible(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix, String pathSuffix) {
|
||||
var texture = texture(appearance, pathPrefix, pathSuffix);
|
||||
Identifier modelId = models.modBlock(models.name(block));
|
||||
|
||||
return singleModel(models, block)
|
||||
.parent(models.modFile("template_crucible"))
|
||||
.texture("inside", texture)
|
||||
.texture("top", texture)
|
||||
.texture("bottom", texture)
|
||||
.texture("side", texture);
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("parent", models.modBlock("template_crucible").toString());
|
||||
JsonObject textures = new JsonObject();
|
||||
textures.addProperty("inside", texture.toString());
|
||||
textures.addProperty("top", texture.toString());
|
||||
textures.addProperty("bottom", texture.toString());
|
||||
textures.addProperty("side", texture.toString());
|
||||
json.add("textures", textures);
|
||||
|
||||
models.simpleBlock(block, modelId);
|
||||
return new ModelBuilder(models, modelId, json);
|
||||
}
|
||||
|
||||
private static Identifier texture(Block block, String prefix, String suffix) {
|
||||
|
|
@ -272,41 +312,53 @@ class BlockModels {
|
|||
barrel(models, block, appearance, "");
|
||||
}
|
||||
|
||||
public static BlockModelBuilder barrel(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix) {
|
||||
return singleModel(models, block)
|
||||
.parent(models.modFile("template_barrel"))
|
||||
.texture("barrel", texture(appearance, pathPrefix, ""));
|
||||
public static ModelBuilder barrel(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix) {
|
||||
var texture = texture(appearance, pathPrefix, "");
|
||||
Identifier modelId = models.modBlock(models.name(block));
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("parent", models.modBlock("template_barrel").toString());
|
||||
JsonObject textures = new JsonObject();
|
||||
textures.addProperty("barrel", texture.toString());
|
||||
json.add("textures", textures);
|
||||
|
||||
models.simpleBlock(block, modelId);
|
||||
return new ModelBuilder(models, modelId, json);
|
||||
}
|
||||
|
||||
public static void sieve(MKBlockModelProvider models, Block block, Block appearance) {
|
||||
sieve(models, block, appearance, "");
|
||||
}
|
||||
|
||||
public static BlockModelBuilder sieve(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix) {
|
||||
return singleModel(models, block)
|
||||
.parent(models.modFile("template_sieve"))
|
||||
.texture("texture", texture(appearance, pathPrefix, ""));
|
||||
public static ModelBuilder sieve(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix) {
|
||||
var texture = texture(appearance, pathPrefix, "");
|
||||
Identifier modelId = models.modBlock(models.name(block));
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("parent", models.modBlock("template_sieve").toString());
|
||||
JsonObject textures = new JsonObject();
|
||||
textures.addProperty("texture", texture.toString());
|
||||
json.add("textures", textures);
|
||||
|
||||
models.simpleBlock(block, modelId);
|
||||
return new ModelBuilder(models, modelId, json);
|
||||
}
|
||||
|
||||
public static void compressedSieve(MKBlockModelProvider models, Block block, Block appearance) {
|
||||
compressedSieve(models, block, appearance, "", "");
|
||||
}
|
||||
|
||||
public static BlockModelBuilder compressedSieve(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix, String pathSuffix) {
|
||||
return singleModel(models, block)
|
||||
.parent(models.modFile("template_compressed_sieve"))
|
||||
.texture("texture", texture(appearance, pathPrefix, pathSuffix));
|
||||
}
|
||||
public static ModelBuilder compressedSieve(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix, String pathSuffix) {
|
||||
var texture = texture(appearance, pathPrefix, pathSuffix);
|
||||
Identifier modelId = models.modBlock(models.name(block));
|
||||
|
||||
public static BlockModelBuilder singleModel(MKBlockModelProvider models, Block block) {
|
||||
BlockModelBuilder builder = blockModel(models, block);
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("parent", models.modBlock("template_compressed_sieve").toString());
|
||||
JsonObject textures = new JsonObject();
|
||||
textures.addProperty("texture", texture.toString());
|
||||
json.add("textures", textures);
|
||||
|
||||
models.getVariantBuilder(block).partialState().addModels(new ConfiguredModel(builder));
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static BlockModelBuilder blockModel(MKBlockModelProvider models, Block block) {
|
||||
return models.models().getBuilder(models.name(block));
|
||||
models.simpleBlock(block, modelId);
|
||||
return new ModelBuilder(models, modelId, json);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ public class Data {
|
|||
var gen = event.getGenerator(); // writes to json
|
||||
var output = gen.getPackOutput();
|
||||
var registries = event.getLookupProvider();
|
||||
// reads existing files like pngs and parent models
|
||||
var helper = event.getExistingFileHelper();
|
||||
|
||||
var dataHelper = new DataHelper(ExDeorum.ID, event);
|
||||
dataHelper.createEnglish(true, English::addTranslations);
|
||||
dataHelper.createBlockModels(BlockModels::addBlockModels);
|
||||
|
|
@ -46,8 +43,8 @@ public class Data {
|
|||
dataHelper.createTags(Registries.WORLD_PRESET, ModTags::createWorldPresetTags);
|
||||
|
||||
gen.addProvider(true, new LootTables(output, registries));
|
||||
gen.addProvider(true, new Advancements(output, registries, helper));
|
||||
gen.addProvider(true, new Sounds(output, helper));
|
||||
gen.addProvider(true, new Advancements(output, registries));
|
||||
gen.addProvider(true, new Sounds(output));
|
||||
gen.addProvider(true, new LootModifiers(output, registries));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package thedarkcolour.exdeorum.data;
|
|||
|
||||
import net.minecraft.advancements.criterion.ItemPredicate;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
|
@ -33,6 +34,6 @@ class LootModifiers extends GlobalLootModifierProvider {
|
|||
}
|
||||
|
||||
private void add(String name, Function<LootItemCondition[], IGlobalLootModifier> constructor, TagKey<Item> requiredTag) {
|
||||
add(name, constructor.apply(new LootItemCondition[]{new MatchTool(Optional.of(ItemPredicate.Builder.item().of(requiredTag).build()))}), List.of());
|
||||
add(name, constructor.apply(new LootItemCondition[]{new MatchTool(Optional.of(ItemPredicate.Builder.item().of(this.registries.lookupOrThrow(Registries.ITEM), requiredTag).build()))}), List.of());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,13 @@ package thedarkcolour.exdeorum.data.recipe;
|
|||
|
||||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
|
@ -88,28 +91,28 @@ public class Recipes {
|
|||
public static void addRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
craftingRecipes(writer, recipes);
|
||||
smeltingRecipes(recipes);
|
||||
SieveRecipes.sieveRecipes(writer);
|
||||
crucibleRecipes(writer);
|
||||
hammerRecipes(writer);
|
||||
compressedHammerRecipes(writer);
|
||||
SieveRecipes.sieveRecipes(writer, recipes);
|
||||
crucibleRecipes(writer, recipes);
|
||||
hammerRecipes(writer, recipes);
|
||||
compressedHammerRecipes(writer, recipes);
|
||||
crookRecipes(writer);
|
||||
crucibleHeatSources(writer);
|
||||
barrelCompostRecipes(writer);
|
||||
barrelCompostRecipes(writer, recipes);
|
||||
barrelMixingRecipes(writer);
|
||||
fluidTransformationRecipes(writer);
|
||||
}
|
||||
|
||||
private static void craftingRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
// Crooks
|
||||
shapedCrook(recipes, EItems.CROOK, ingredient(Tags.Items.RODS_WOODEN));
|
||||
shapedCrook(recipes, EItems.CROOK, recipes.ingredient(Tags.Items.RODS_WOODEN));
|
||||
shapedCrook(recipes, EItems.BONE_CROOK, ingredient(Items.BONE));
|
||||
|
||||
// Hammers
|
||||
shapedHammer(recipes, EItems.WOODEN_HAMMER, ingredient(ItemTags.PLANKS));
|
||||
shapedHammer(recipes, EItems.STONE_HAMMER, ingredient(ItemTags.STONE_CRAFTING_MATERIALS));
|
||||
shapedHammer(recipes, EItems.GOLDEN_HAMMER, ingredient(Tags.Items.INGOTS_GOLD));
|
||||
shapedHammer(recipes, EItems.IRON_HAMMER, ingredient(Tags.Items.INGOTS_IRON));
|
||||
shapedHammer(recipes, EItems.DIAMOND_HAMMER, ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
shapedHammer(recipes, EItems.WOODEN_HAMMER, recipes.ingredient(ItemTags.PLANKS));
|
||||
shapedHammer(recipes, EItems.STONE_HAMMER, recipes.ingredient(ItemTags.STONE_CRAFTING_MATERIALS));
|
||||
shapedHammer(recipes, EItems.GOLDEN_HAMMER, recipes.ingredient(Tags.Items.INGOTS_GOLD));
|
||||
shapedHammer(recipes, EItems.IRON_HAMMER, recipes.ingredient(Tags.Items.INGOTS_IRON));
|
||||
shapedHammer(recipes, EItems.DIAMOND_HAMMER, recipes.ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
recipes.netheriteUpgrade(RecipeCategory.TOOLS, ingredient(EItems.DIAMOND_HAMMER.get()), EItems.NETHERITE_HAMMER.get());
|
||||
|
||||
// Crucibles
|
||||
|
|
@ -231,10 +234,7 @@ public class Recipes {
|
|||
recipes.grid3x3(RecipeCategory.BUILDING_BLOCKS, storage, Ingredient.of(material));
|
||||
}
|
||||
// still allow uncrafting
|
||||
ShapelessRecipeBuilder fromStorage = new ShapelessRecipeBuilder(RecipeCategory.MISC, material, 9);
|
||||
unlockedByHaving(fromStorage, storage);
|
||||
fromStorage.requires(storage);
|
||||
fromStorage.save(writer, id(material).withSuffix("_from_" + id(storage).getPath()));
|
||||
recipes.shapelessCrafting(id(material).withSuffix("_from_" + id(storage).getPath()), RecipeCategory.MISC, material, 9, storage);
|
||||
}
|
||||
|
||||
// Compressed sieves
|
||||
|
|
@ -327,23 +327,23 @@ public class Recipes {
|
|||
modSieve(recipes, ModIds.BLUE_SKIES, ModCompatData.CRYSTALLIZED_PLANKS_ITEM, ModCompatData.CRYSTALLIZED_SLAB, DefaultMaterials.CRYSTALLIZED_SIEVE.getItem());
|
||||
|
||||
// Meshes
|
||||
recipes.grid3x3(EItems.STRING_MESH.get(), ingredient(Tags.Items.STRINGS));
|
||||
recipes.grid3x3(EItems.STRING_MESH.get(), recipes.ingredient(Tags.Items.STRINGS));
|
||||
mesh(recipes, EItems.FLINT_MESH, ingredient(Items.FLINT));
|
||||
mesh(recipes, EItems.IRON_MESH, ingredient(Tags.Items.INGOTS_IRON));
|
||||
mesh(recipes, EItems.GOLDEN_MESH, ingredient(Tags.Items.INGOTS_GOLD));
|
||||
mesh(recipes, EItems.DIAMOND_MESH, ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
mesh(recipes, EItems.IRON_MESH, recipes.ingredient(Tags.Items.INGOTS_IRON));
|
||||
mesh(recipes, EItems.GOLDEN_MESH, recipes.ingredient(Tags.Items.INGOTS_GOLD));
|
||||
mesh(recipes, EItems.DIAMOND_MESH, recipes.ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
meshUpgrade(recipes, EItems.FLINT_MESH, EItems.STRING_MESH, ingredient(Items.FLINT));
|
||||
meshUpgrade(recipes, EItems.IRON_MESH, EItems.FLINT_MESH, ingredient(Tags.Items.INGOTS_IRON));
|
||||
meshUpgrade(recipes, EItems.GOLDEN_MESH, EItems.IRON_MESH, ingredient(Tags.Items.INGOTS_GOLD));
|
||||
meshUpgrade(recipes, EItems.DIAMOND_MESH, EItems.GOLDEN_MESH, ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
meshUpgrade(recipes, EItems.IRON_MESH, EItems.FLINT_MESH, recipes.ingredient(Tags.Items.INGOTS_IRON));
|
||||
meshUpgrade(recipes, EItems.GOLDEN_MESH, EItems.IRON_MESH, recipes.ingredient(Tags.Items.INGOTS_GOLD));
|
||||
meshUpgrade(recipes, EItems.DIAMOND_MESH, EItems.GOLDEN_MESH, recipes.ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
recipes.netheriteUpgrade(RecipeCategory.MISC, ingredient(EItems.DIAMOND_MESH), EItems.NETHERITE_MESH.get());
|
||||
|
||||
// Watering cans
|
||||
wateringCan(recipes, EItems.WOODEN_WATERING_CAN, ingredient(ItemTags.PLANKS));
|
||||
wateringCan(recipes, EItems.STONE_WATERING_CAN, ingredient(ItemTags.STONE_TOOL_MATERIALS));
|
||||
wateringCan(recipes, EItems.IRON_WATERING_CAN, ingredient(Tags.Items.INGOTS_IRON));
|
||||
wateringCan(recipes, EItems.GOLDEN_WATERING_CAN, ingredient(Tags.Items.INGOTS_GOLD));
|
||||
wateringCan(recipes, EItems.DIAMOND_WATERING_CAN, ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
wateringCan(recipes, EItems.WOODEN_WATERING_CAN, recipes.ingredient(ItemTags.PLANKS));
|
||||
wateringCan(recipes, EItems.STONE_WATERING_CAN, recipes.ingredient(ItemTags.STONE_TOOL_MATERIALS));
|
||||
wateringCan(recipes, EItems.IRON_WATERING_CAN, recipes.ingredient(Tags.Items.INGOTS_IRON));
|
||||
wateringCan(recipes, EItems.GOLDEN_WATERING_CAN, recipes.ingredient(Tags.Items.INGOTS_GOLD));
|
||||
wateringCan(recipes, EItems.DIAMOND_WATERING_CAN, recipes.ingredient(Tags.Items.GEMS_DIAMOND));
|
||||
recipes.netheriteUpgrade(RecipeCategory.TOOLS, ingredient(EItems.DIAMOND_WATERING_CAN), EItems.NETHERITE_WATERING_CAN.get());
|
||||
|
||||
// misc
|
||||
|
|
@ -376,7 +376,7 @@ public class Recipes {
|
|||
recipe.pattern("WCW");
|
||||
recipe.pattern("CSC");
|
||||
recipe.pattern("WCW");
|
||||
MKRecipeProvider.unlockedByHaving(recipe, EItems.WOOD_CHIPPINGS.get());
|
||||
recipes.unlockedByHaving(recipe, EItems.WOOD_CHIPPINGS.get());
|
||||
});
|
||||
recipes.shapedCrafting(RecipeCategory.MISC, EItems.MECHANICAL_SIEVE.get(), recipe -> {
|
||||
recipe.define('#', Items.IRON_BLOCK);
|
||||
|
|
@ -386,7 +386,7 @@ public class Recipes {
|
|||
recipe.pattern("#G#");
|
||||
recipe.pattern("IHI");
|
||||
recipe.pattern("I I");
|
||||
MKRecipeProvider.unlockedByHaving(recipe, Items.HOPPER);
|
||||
recipes.unlockedByHaving(recipe, Items.HOPPER);
|
||||
});
|
||||
recipes.shapedCrafting(RecipeCategory.MISC, EItems.MECHANICAL_HAMMER.get(), recipe -> {
|
||||
recipe.define('#', Items.IRON_BLOCK);
|
||||
|
|
@ -396,7 +396,7 @@ public class Recipes {
|
|||
recipe.pattern("III");
|
||||
recipe.pattern("ITI");
|
||||
recipe.pattern("#H#");
|
||||
MKRecipeProvider.unlockedByHaving(recipe, Items.HOPPER);
|
||||
recipes.unlockedByHaving(recipe, Items.HOPPER);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void grid2x2TagResult(RecipeOutput writer, TagKey<Item> resultTag, Ingredient ingredient) {
|
||||
writer.accept(modLoc(resultTag.location().getPath() + "_from_chunks"), new OreChunkRecipe(ingredient, resultTag), null, tagNotEmpty(resultTag));
|
||||
writer.withConditions(tagNotEmpty(resultTag)).accept(ResourceKey.create(Registries.RECIPE, modLoc(resultTag.location().getPath() + "_from_chunks")), new OreChunkRecipe(ingredient, resultTag), null);
|
||||
}
|
||||
|
||||
private static void shapedCrook(MKRecipeProvider recipes, ItemLike crook, Ingredient stick) {
|
||||
|
|
@ -470,7 +470,7 @@ public class Recipes {
|
|||
private static void mesh(MKRecipeProvider recipes, Supplier<? extends Item> result, Ingredient ingredient) {
|
||||
recipes.shapedCrafting(RecipeCategory.MISC, result.get(), recipe -> {
|
||||
recipe.define('#', ingredient);
|
||||
recipe.define('S', ingredient(Tags.Items.STRINGS));
|
||||
recipe.define('S', recipes.ingredient(Tags.Items.STRINGS));
|
||||
recipe.pattern("S#S");
|
||||
recipe.pattern("#S#");
|
||||
recipe.pattern("S#S");
|
||||
|
|
@ -503,22 +503,22 @@ public class Recipes {
|
|||
|
||||
recipes.foodCooking(EItems.SILKWORM.get(), EItems.COOKED_SILKWORM.get(), 0.1f);
|
||||
}
|
||||
private static void crucibleRecipes(RecipeOutput writer) {
|
||||
lavaCrucible(writer, "cobblestone", ingredient(Tags.Items.COBBLESTONES), 250);
|
||||
lavaCrucible(writer, "stone", ingredient(Tags.Items.STONES), 250);
|
||||
lavaCrucible(writer, "gravel", ingredient(Tags.Items.GRAVELS), 250);
|
||||
lavaCrucible(writer, "netherrack", ingredient(Tags.Items.NETHERRACKS), 500);
|
||||
private static void crucibleRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
lavaCrucible(writer, "cobblestone", recipes.ingredient(Tags.Items.COBBLESTONES), 250);
|
||||
lavaCrucible(writer, "stone", recipes.ingredient(Tags.Items.STONES), 250);
|
||||
lavaCrucible(writer, "gravel", recipes.ingredient(Tags.Items.GRAVELS), 250);
|
||||
lavaCrucible(writer, "netherrack", recipes.ingredient(Tags.Items.NETHERRACKS), 500);
|
||||
|
||||
waterCrucible(writer, "saplings", ingredient(ItemTags.SAPLINGS), 100);
|
||||
waterCrucible(writer, "leaves", ingredient(ItemTags.LEAVES), 250);
|
||||
waterCrucible(writer, "small_flowers", ingredient(ItemTags.SMALL_FLOWERS), 100);
|
||||
waterCrucible(writer, "tall_flowers", ingredient(ItemTags.TALL_FLOWERS), 200);
|
||||
waterCrucible(writer, "mushrooms", ingredient(Tags.Items.MUSHROOMS), 100);
|
||||
waterCrucible(writer, "saplings", recipes.ingredient(ItemTags.SAPLINGS), 100);
|
||||
waterCrucible(writer, "leaves", recipes.ingredient(ItemTags.LEAVES), 250);
|
||||
waterCrucible(writer, "small_flowers", recipes.ingredient(ItemTags.SMALL_FLOWERS), 100);
|
||||
waterCrucible(writer, "tall_flowers", recipes.ingredient(ItemTags.TALL_FLOWERS), 200);
|
||||
waterCrucible(writer, "mushrooms", recipes.ingredient(Tags.Items.MUSHROOMS), 100);
|
||||
waterCrucible(writer, "lily_pad", ingredient(Items.LILY_PAD), 150);
|
||||
waterCrucible(writer, "sugar_cane", ingredient(Items.SUGAR_CANE), 100);
|
||||
waterCrucible(writer, "vine", ingredient(Items.VINE), 100);
|
||||
waterCrucible(writer, "seeds_and_spores", SPORES_AND_SEEDS, 50);
|
||||
waterCrucible(writer, "seeds", ingredient(Tags.Items.SEEDS), 50);
|
||||
waterCrucible(writer, "seeds", recipes.ingredient(Tags.Items.SEEDS), 50);
|
||||
waterCrucible(writer, "grass", ingredient(Items.SHORT_GRASS, Items.TALL_GRASS), 100);
|
||||
waterCrucible(writer, "grass_block", ingredient(Items.GRASS_BLOCK), 150);
|
||||
waterCrucible(writer, "sweet_berries", ingredient(Items.SWEET_BERRIES, Items.GLOW_BERRIES), 50);
|
||||
|
|
@ -538,14 +538,14 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void lavaCrucible(RecipeOutput writer, String id, Ingredient ingredient, int volume) {
|
||||
writer.accept(modLoc("lava_crucible/" + id), new CrucibleRecipe.Lava(ingredient, new FluidStack(Fluids.LAVA, volume)), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("lava_crucible/" + id)), new CrucibleRecipe.Lava(ingredient, new FluidStack(Fluids.LAVA, volume)), null);
|
||||
}
|
||||
|
||||
private static void waterCrucible(RecipeOutput writer, String id, Ingredient ingredient, int volume) {
|
||||
writer.accept(modLoc("water_crucible/" + id), new CrucibleRecipe.Water(ingredient, new FluidStack(Fluids.WATER, volume)), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("water_crucible/" + id)), new CrucibleRecipe.Water(ingredient, new FluidStack(Fluids.WATER, volume)), null);
|
||||
}
|
||||
|
||||
private static void hammerRecipes(RecipeOutput writer) {
|
||||
private static void hammerRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
// Cobblestone -> Gravel -> Sand -> Dust
|
||||
hammerRecipe(writer, "gravel", ingredient(Items.COBBLESTONE, Items.DIORITE, Items.GRANITE, Items.ANDESITE), Blocks.GRAVEL);
|
||||
hammerRecipe(writer, "sand", ingredient(Items.GRAVEL), Blocks.SAND);
|
||||
|
|
@ -563,7 +563,7 @@ public class Recipes {
|
|||
|
||||
hammerRecipe(writer, "stone_pebbles", ingredient(Items.STONE, Items.STONE_BRICKS, Items.CHISELED_STONE_BRICKS, Items.CRACKED_STONE_BRICKS), EItems.STONE_PEBBLE.get(), new UniformGenerator(ConstantValue.exactly(1), ConstantValue.exactly(6)));
|
||||
hammerRecipe(writer, "basalt", ingredient(Items.POLISHED_BASALT, Items.SMOOTH_BASALT), Items.BASALT);
|
||||
hammerRecipe(writer, "wood_chippings", ingredient(ItemTags.LOGS), EItems.WOOD_CHIPPINGS.get(), new UniformGenerator(ConstantValue.exactly(3), ConstantValue.exactly(8)));
|
||||
hammerRecipe(writer, "wood_chippings", recipes.ingredient(ItemTags.LOGS), EItems.WOOD_CHIPPINGS.get(), new UniformGenerator(ConstantValue.exactly(3), ConstantValue.exactly(8)));
|
||||
|
||||
hammerRecipe(writer, "tube_coral", ingredient(Items.TUBE_CORAL_BLOCK), Items.TUBE_CORAL);
|
||||
hammerRecipe(writer, "brain_coral", ingredient(Items.BRAIN_CORAL_BLOCK), Items.BRAIN_CORAL);
|
||||
|
|
@ -580,20 +580,20 @@ public class Recipes {
|
|||
hammerRecipe(writer, "pointed_dripstone", ingredient(Items.DRIPSTONE_BLOCK), Items.POINTED_DRIPSTONE, between(2, 4));
|
||||
}
|
||||
|
||||
private static void compressedHammerRecipes(RecipeOutput writer) {
|
||||
compressedHammerRecipe(writer, Items.GRAVEL, ingredient(ECompressedBlocks.COMPRESSED_COBBLESTONE.getTag(), ECompressedBlocks.COMPRESSED_DIORITE.getTag(), ECompressedBlocks.COMPRESSED_GRANITE.getTag(), ECompressedBlocks.COMPRESSED_ANDESITE.getTag()));
|
||||
compressedHammerRecipe(writer, Items.SAND, ingredient(ECompressedBlocks.COMPRESSED_GRAVEL.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.DUST.get(), ingredient(EItemTags.COMPRESSED_SANDS));
|
||||
private static void compressedHammerRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
compressedHammerRecipe(writer, Items.GRAVEL, recipes.ingredient(ECompressedBlocks.COMPRESSED_COBBLESTONE.getTag(), ECompressedBlocks.COMPRESSED_DIORITE.getTag(), ECompressedBlocks.COMPRESSED_GRANITE.getTag(), ECompressedBlocks.COMPRESSED_ANDESITE.getTag()));
|
||||
compressedHammerRecipe(writer, Items.SAND, recipes.ingredient(ECompressedBlocks.COMPRESSED_GRAVEL.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.DUST.get(), recipes.ingredient(EItemTags.COMPRESSED_SANDS));
|
||||
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_DEEPSLATE.get(), ingredient(ECompressedBlocks.COMPRESSED_DEEPSLATE.getTag(), ECompressedBlocks.COMPRESSED_COBBLED_DEEPSLATE.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_NETHERRACK.get(), ingredient(ECompressedBlocks.COMPRESSED_NETHERRACK.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_BLACKSTONE.get(), ingredient(ECompressedBlocks.COMPRESSED_BLACKSTONE.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_END_STONE.get(), ingredient(ECompressedBlocks.COMPRESSED_END_STONE.getTag()));
|
||||
compressedHammerRecipe(writer, Items.RED_SAND, ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_NETHERRACK.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_DEEPSLATE.get(), recipes.ingredient(ECompressedBlocks.COMPRESSED_DEEPSLATE.getTag(), ECompressedBlocks.COMPRESSED_COBBLED_DEEPSLATE.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_NETHERRACK.get(), recipes.ingredient(ECompressedBlocks.COMPRESSED_NETHERRACK.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_BLACKSTONE.get(), recipes.ingredient(ECompressedBlocks.COMPRESSED_BLACKSTONE.getTag()));
|
||||
compressedHammerRecipe(writer, EItems.CRUSHED_END_STONE.get(), recipes.ingredient(ECompressedBlocks.COMPRESSED_END_STONE.getTag()));
|
||||
compressedHammerRecipe(writer, Items.RED_SAND, recipes.ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_NETHERRACK.getTag()));
|
||||
}
|
||||
|
||||
private static void compressedHammerRecipe(RecipeOutput writer, ItemLike result, Ingredient block) {
|
||||
writer.accept(modLoc("compressed_hammer/" + path(result)), new CompressedHammerRecipe(block, new ItemStack(result.asItem()), exactly(9)), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("compressed_hammer/" + path(result))), new CompressedHammerRecipe(block, new ItemStack(result.asItem()), exactly(9)), null);
|
||||
}
|
||||
|
||||
private static void hammerRecipe(RecipeOutput writer, String name, Ingredient block, ItemLike result) {
|
||||
|
|
@ -601,7 +601,7 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void hammerRecipe(RecipeOutput writer, String name, Ingredient block, ItemLike result, NumberProvider resultAmount) {
|
||||
writer.accept(modLoc("hammer/" + name), new HammerRecipe(block, new ItemStack(result.asItem()), resultAmount), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("hammer/" + name)), new HammerRecipe(block, new ItemStack(result.asItem()), resultAmount), null);
|
||||
}
|
||||
|
||||
private static void crookRecipes(RecipeOutput writer) {
|
||||
|
|
@ -614,7 +614,7 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void crookRecipe(RecipeOutput writer, String name, BlockPredicate blockPredicate, ItemLike result, float chance) {
|
||||
writer.accept(modLoc("crook/" + name), new CrookRecipe(blockPredicate, new ItemStack(result), chance), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("crook/" + name)), new CrookRecipe(blockPredicate, new ItemStack(result), chance), null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||
|
|
@ -638,16 +638,16 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void crucibleHeatSource(RecipeOutput writer, String name, BlockPredicate blockPredicate, int heatValue) {
|
||||
writer.accept(modLoc("crucible_heat_source/" + name), new CrucibleHeatRecipe(blockPredicate, heatValue), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("crucible_heat_source/" + name)), new CrucibleHeatRecipe(blockPredicate, heatValue), null);
|
||||
}
|
||||
|
||||
private static void barrelCompostRecipes(RecipeOutput writer) {
|
||||
private static void barrelCompostRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
// plants
|
||||
barrelCompost(writer, "saplings", ingredient(ItemTags.SAPLINGS), 125);
|
||||
barrelCompost(writer, "leaves", ingredient(ItemTags.LEAVES), 125);
|
||||
barrelCompost(writer, "small_flowers", ingredient(ItemTags.SMALL_FLOWERS), 100);
|
||||
barrelCompost(writer, "tall_flowers", ingredient(ItemTags.TALL_FLOWERS), 150);
|
||||
barrelCompost(writer, "mushrooms", ingredient(Tags.Items.MUSHROOMS), 100);
|
||||
barrelCompost(writer, "saplings", recipes.ingredient(ItemTags.SAPLINGS), 125);
|
||||
barrelCompost(writer, "leaves", recipes.ingredient(ItemTags.LEAVES), 125);
|
||||
barrelCompost(writer, "small_flowers", recipes.ingredient(ItemTags.SMALL_FLOWERS), 100);
|
||||
barrelCompost(writer, "tall_flowers", recipes.ingredient(ItemTags.TALL_FLOWERS), 150);
|
||||
barrelCompost(writer, "mushrooms", recipes.ingredient(Tags.Items.MUSHROOMS), 100);
|
||||
barrelCompost(writer, "lily_pad", ingredient(Items.LILY_PAD), 100);
|
||||
barrelCompost(writer, "sugar_cane", ingredient(Items.SUGAR_CANE), 80);
|
||||
barrelCompost(writer, "vine", ingredient(Items.VINE), 100);
|
||||
|
|
@ -655,8 +655,8 @@ public class Recipes {
|
|||
barrelCompost(writer, "tall_grass", ingredient(Items.TALL_GRASS, Items.LARGE_FERN), 150);
|
||||
barrelCompost(writer, "seagrass", ingredient(Items.SEAGRASS), 80);
|
||||
barrelCompost(writer, "nether_wart", ingredient(Items.NETHER_WART), 100);
|
||||
barrelCompost(writer, "seeds", ingredient(Tags.Items.SEEDS), 80);
|
||||
barrelCompost(writer, "wheat", ingredient(Tags.Items.CROPS_WHEAT), 80);
|
||||
barrelCompost(writer, "seeds", recipes.ingredient(Tags.Items.SEEDS), 80);
|
||||
barrelCompost(writer, "wheat", recipes.ingredient(Tags.Items.CROPS_WHEAT), 80);
|
||||
barrelCompost(writer, "berries", ingredient(Items.SWEET_BERRIES, Items.GLOW_BERRIES), 80);
|
||||
barrelCompost(writer, "melon", ingredient(Items.MELON), 200);
|
||||
barrelCompost(writer, "cake", ingredient(Items.CAKE), 500);
|
||||
|
|
@ -714,7 +714,7 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void barrelCompost(RecipeOutput writer, String id, Ingredient ingredient, int volume) {
|
||||
writer.accept(modLoc("barrel_compost/" + id), new BarrelCompostRecipe(ingredient, volume), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("barrel_compost/" + id)), new BarrelCompostRecipe(ingredient, volume), null);
|
||||
}
|
||||
|
||||
private static void barrelMixingRecipes(RecipeOutput writer) {
|
||||
|
|
@ -741,15 +741,15 @@ public class Recipes {
|
|||
}
|
||||
|
||||
private static void barrelMixing(RecipeOutput writer, String suffix, Ingredient ingredient, Fluid fluidType, Item result) {
|
||||
writer.accept(modLoc("barrel_mixing/" + path(result) + suffix), new BarrelMixingRecipe(ingredient, SizedFluidIngredient.of(fluidType, 1000), new ItemStack(result)), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("barrel_mixing/" + path(result) + suffix)), new BarrelMixingRecipe(ingredient, SizedFluidIngredient.of(fluidType, 1000), new ItemStack(result)), null);
|
||||
}
|
||||
|
||||
private static void barrelFluidMixing(RecipeOutput writer, Fluid base, Fluid additive, Item result, boolean consumesAdditive) {
|
||||
writer.accept(modLoc("barrel_fluid_mixing/" + path(result)), new BarrelFluidMixingRecipe(SizedFluidIngredient.of(base, 1000), FluidIngredient.of(additive), new ItemStack(result), consumesAdditive), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("barrel_fluid_mixing/" + path(result))), new BarrelFluidMixingRecipe(SizedFluidIngredient.of(base, 1000), FluidIngredient.of(additive), new ItemStack(result), consumesAdditive), null);
|
||||
}
|
||||
|
||||
private static void fluidTransformationRecipes(RecipeOutput writer) {
|
||||
writer.accept(modLoc("barrel_fluid_transformation/witch_water"), new FluidTransformationRecipe(FluidIngredient.of(Fluids.WATER), EFluids.WITCH_WATER.get(), 0x2B1057, BlockPredicate.singleBlock(Blocks.MYCELIUM), WeightedList.<BlockState>builder().add(50, Blocks.RED_MUSHROOM.defaultBlockState()).add(50, Blocks.BROWN_MUSHROOM.defaultBlockState()).build(), 1700), null);
|
||||
writer.accept(ResourceKey.create(Registries.RECIPE, modLoc("barrel_fluid_transformation/witch_water")), new FluidTransformationRecipe(FluidIngredient.of(Fluids.WATER), EFluids.WITCH_WATER.get(), 0x2B1057, BlockPredicate.singleBlock(Blocks.MYCELIUM), WeightedList.<BlockState>builder().add(50, Blocks.RED_MUSHROOM.defaultBlockState()).add(50, Blocks.BROWN_MUSHROOM.defaultBlockState()).build(), 1700), null);
|
||||
}
|
||||
|
||||
static Identifier modLoc(String path) {
|
||||
|
|
@ -757,7 +757,7 @@ public class Recipes {
|
|||
}
|
||||
|
||||
static ICondition tagNotEmpty(TagKey<Item> tag) {
|
||||
return new NotCondition(new TagEmptyCondition(tag.location()));
|
||||
return new NotCondition(new TagEmptyCondition<>(tag));
|
||||
}
|
||||
|
||||
static ICondition modInstalled(String modid) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@
|
|||
package thedarkcolour.exdeorum.data.recipe;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
|
@ -42,6 +45,8 @@ import java.util.Map;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
import static net.minecraft.world.level.storage.loot.providers.number.BinomialDistributionGenerator.binomial;
|
||||
import thedarkcolour.modkit.data.MKRecipeProvider;
|
||||
|
||||
import static thedarkcolour.exdeorum.data.recipe.Recipes.modLoc;
|
||||
import static thedarkcolour.modkit.data.MKRecipeProvider.ingredient;
|
||||
import static thedarkcolour.modkit.data.MKRecipeProvider.path;
|
||||
|
|
@ -60,26 +65,25 @@ class SieveRecipes {
|
|||
SOUL_SAND = ingredient(Items.SOUL_SAND),
|
||||
CRUSHED_END_STONE = ingredient(EItems.CRUSHED_END_STONE),
|
||||
MOSS_BLOCK = ingredient(Items.MOSS_BLOCK);
|
||||
// mod condition is null for ex deorum blocks (ex deorum is always last priority)
|
||||
private static final Map<Ingredient, Ingredient> COMPRESSED_VARIANTS = ImmutableMap.<Ingredient, Ingredient>builder()
|
||||
.put(DIRT, ingredient(ECompressedBlocks.COMPRESSED_DIRT.getTag()))
|
||||
.put(GRAVEL, ingredient(ECompressedBlocks.COMPRESSED_GRAVEL.getTag()))
|
||||
.put(SAND, ingredient(ECompressedBlocks.COMPRESSED_SAND.getTag()))
|
||||
.put(DUST, ingredient(ECompressedBlocks.COMPRESSED_DUST.getTag()))
|
||||
.put(RED_SAND, ingredient(ECompressedBlocks.COMPRESSED_RED_SAND.getTag()))
|
||||
.put(CRUSHED_DEEPSLATE, ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_DEEPSLATE.getTag()))
|
||||
.put(CRUSHED_BLACKSTONE, ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_BLACKSTONE.getTag()))
|
||||
.put(CRUSHED_NETHERRACK, ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_NETHERRACK.getTag()))
|
||||
.put(SOUL_SAND, ingredient(ECompressedBlocks.COMPRESSED_SOUL_SAND.getTag()))
|
||||
.put(CRUSHED_END_STONE, ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_END_STONE.getTag()))
|
||||
.put(MOSS_BLOCK, ingredient(ECompressedBlocks.COMPRESSED_MOSS_BLOCK.getTag()))
|
||||
.build();
|
||||
|
||||
static void sieveRecipes(RecipeOutput writer) {
|
||||
static void sieveRecipes(RecipeOutput writer, MKRecipeProvider recipes) {
|
||||
// mod condition is null for ex deorum blocks (ex deorum is always last priority)
|
||||
Map<Ingredient, Ingredient> compressedVariants = ImmutableMap.<Ingredient, Ingredient>builder()
|
||||
.put(DIRT, recipes.ingredient(ECompressedBlocks.COMPRESSED_DIRT.getTag()))
|
||||
.put(GRAVEL, recipes.ingredient(ECompressedBlocks.COMPRESSED_GRAVEL.getTag()))
|
||||
.put(SAND, recipes.ingredient(ECompressedBlocks.COMPRESSED_SAND.getTag()))
|
||||
.put(DUST, recipes.ingredient(ECompressedBlocks.COMPRESSED_DUST.getTag()))
|
||||
.put(RED_SAND, recipes.ingredient(ECompressedBlocks.COMPRESSED_RED_SAND.getTag()))
|
||||
.put(CRUSHED_DEEPSLATE, recipes.ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_DEEPSLATE.getTag()))
|
||||
.put(CRUSHED_BLACKSTONE, recipes.ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_BLACKSTONE.getTag()))
|
||||
.put(CRUSHED_NETHERRACK, recipes.ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_NETHERRACK.getTag()))
|
||||
.put(SOUL_SAND, recipes.ingredient(ECompressedBlocks.COMPRESSED_SOUL_SAND.getTag()))
|
||||
.put(CRUSHED_END_STONE, recipes.ingredient(ECompressedBlocks.COMPRESSED_CRUSHED_END_STONE.getTag()))
|
||||
.put(MOSS_BLOCK, recipes.ingredient(ECompressedBlocks.COMPRESSED_MOSS_BLOCK.getTag()))
|
||||
.build();
|
||||
var allMeshes = List.of(EItems.STRING_MESH, EItems.FLINT_MESH, EItems.IRON_MESH, EItems.GOLDEN_MESH, EItems.DIAMOND_MESH, EItems.NETHERITE_MESH);
|
||||
|
||||
// Dirt -> String mesh
|
||||
forMesh(writer, DIRT, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DIRT, EItems.STRING_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(7, 0.6f));
|
||||
drops.add(Items.FLINT, chance(0.25f));
|
||||
drops.add(Items.WHEAT_SEEDS, chance(0.125f));
|
||||
|
|
@ -97,7 +101,7 @@ class SieveRecipes {
|
|||
// Flint mesh will be used to get a larger variety of outputs from dirt, just so people don't always
|
||||
// have the inventory spam that are the -ite pebbles.
|
||||
// Dirt -> Flint mesh
|
||||
forMesh(writer, DIRT, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DIRT, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(7, 0.6f));
|
||||
drops.add(Items.FLINT, chance(0.3f));
|
||||
drops.add(EItems.ANDESITE_PEBBLE.get(), binomial(7, 0.4f));
|
||||
|
|
@ -118,7 +122,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SOURCEBERRY.get(), chance(0.03f), Recipes.modInstalled(ModIds.ARS_NOUVEAU));
|
||||
});
|
||||
// Dirt -> Iron mesh
|
||||
forMesh(writer, DIRT, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DIRT, EItems.IRON_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(8, 0.65f));
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(3, 0.45f));
|
||||
drops.add(Items.FLINT, chance(0.3f));
|
||||
|
|
@ -135,7 +139,7 @@ class SieveRecipes {
|
|||
});
|
||||
// Gold tends to spread its luster to whatever passes through it...
|
||||
// Dirt -> Gold mesh
|
||||
forMesh(writer, DIRT, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DIRT, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(8, 0.7f));
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(3, 0.55f));
|
||||
drops.add(Items.FLINT, chance(0.2f));
|
||||
|
|
@ -153,7 +157,7 @@ class SieveRecipes {
|
|||
});
|
||||
// Diamond tables have less junk items in them. Maybe you want those items? Use other meshes!
|
||||
// Dirt -> Diamond mesh
|
||||
forMesh(writer, DIRT, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DIRT, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(8, 0.7f));
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(3, 0.60f));
|
||||
drops.add(Items.FLINT, binomial(3, 0.3f));
|
||||
|
|
@ -165,7 +169,7 @@ class SieveRecipes {
|
|||
});
|
||||
// Netherite should be the best for all drops (except pebbles)
|
||||
// Dirt -> Netherite mesh
|
||||
forMesh(writer, DIRT, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DIRT, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(5, 0.4f));
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.65f));
|
||||
drops.add(Items.FLINT, binomial(3, 0.4f));
|
||||
|
|
@ -179,7 +183,7 @@ class SieveRecipes {
|
|||
});
|
||||
|
||||
// Gravel -> String mesh
|
||||
forMesh(writer, GRAVEL, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,GRAVEL, EItems.STRING_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(4, 0.4f));
|
||||
drops.add(Items.FLINT, chance(0.2f));
|
||||
drops.add(Items.COAL, chance(0.1f));
|
||||
|
|
@ -204,7 +208,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.03f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
});
|
||||
// Gravel -> Flint mesh
|
||||
forMesh(writer, GRAVEL, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,GRAVEL, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(EItems.ANDESITE_PEBBLE.get(), binomial(4, 0.4f));
|
||||
drops.add(EItems.GRANITE_PEBBLE.get(), binomial(4, 0.4f));
|
||||
|
|
@ -233,7 +237,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.0325f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
});
|
||||
// Gravel -> Iron mesh
|
||||
forMesh(writer, GRAVEL, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,GRAVEL, EItems.IRON_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(3, 0.55f));
|
||||
drops.add(Items.FLINT, chance(0.15f));
|
||||
|
|
@ -260,7 +264,7 @@ class SieveRecipes {
|
|||
});
|
||||
// Golden mesh has much higher drops for gold and gems
|
||||
// Gravel -> Golden mesh
|
||||
forMesh(writer, GRAVEL, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,GRAVEL, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(EItems.STONE_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(3, 0.55f));
|
||||
drops.add(Items.FLINT, chance(0.13f));
|
||||
|
|
@ -288,7 +292,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.04f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
});
|
||||
// Gravel -> Diamond mesh
|
||||
forMesh(writer, GRAVEL, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,GRAVEL, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(5, 0.6f));
|
||||
drops.add(Items.FLINT, chance(0.05f));
|
||||
drops.add(Items.COAL, chance(0.06f));
|
||||
|
|
@ -313,7 +317,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.06f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
});
|
||||
// Gravel -> Netherite mesh
|
||||
forMesh(writer, GRAVEL, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,GRAVEL, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(6, 0.625f));
|
||||
drops.add(Items.COAL, chance(0.06f));
|
||||
drops.add(Items.LAPIS_LAZULI, chance(0.11f));
|
||||
|
|
@ -340,7 +344,7 @@ class SieveRecipes {
|
|||
});
|
||||
|
||||
// Sand -> String mesh
|
||||
forMesh(writer, SAND, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SAND, EItems.STRING_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.13f));
|
||||
drops.add(Items.FLINT, chance(0.2f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.08f));
|
||||
|
|
@ -352,7 +356,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_CRYSTAL.get(), chance(0.03f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
drops.addConditional(ModCompatData.CHARGED_CERTUS_QUARTZ_CRYSTAL.get(), chance(0.005f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
});
|
||||
forMesh(writer, SAND, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SAND, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(Items.FLINT, binomial(2, 0.2f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.03f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.16f));
|
||||
|
|
@ -362,7 +366,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_CRYSTAL.get(), chance(0.04f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
drops.addConditional(ModCompatData.CHARGED_CERTUS_QUARTZ_CRYSTAL.get(), chance(0.005f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
});
|
||||
forMesh(writer, SAND, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SAND, EItems.IRON_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.13f));
|
||||
drops.add(Items.FLINT, chance(0.23f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.08f));
|
||||
|
|
@ -376,7 +380,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_CRYSTAL.get(), chance(0.06f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
drops.addConditional(ModCompatData.CHARGED_CERTUS_QUARTZ_CRYSTAL.get(), chance(0.0125f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
});
|
||||
forMesh(writer, SAND, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SAND, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.10f));
|
||||
drops.add(Items.FLINT, chance(0.18f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.06f));
|
||||
|
|
@ -392,7 +396,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_CRYSTAL.get(), chance(0.07f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
drops.addConditional(ModCompatData.CHARGED_CERTUS_QUARTZ_CRYSTAL.get(), chance(0.015f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
});
|
||||
forMesh(writer, SAND, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SAND, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(Items.FLINT, chance(0.23f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.22f));
|
||||
drops.add(Items.IRON_NUGGET, chance(0.22f));
|
||||
|
|
@ -402,7 +406,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_CRYSTAL.get(), chance(0.09f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
drops.addConditional(ModCompatData.CHARGED_CERTUS_QUARTZ_CRYSTAL.get(), chance(0.02f), Recipes.modInstalled(ModIds.APPLIED_ENERGISTICS_2));
|
||||
});
|
||||
forMesh(writer, SAND, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SAND, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.15f));
|
||||
drops.add(Items.FLINT, binomial(2, 0.23f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.23f));
|
||||
|
|
@ -417,49 +421,49 @@ class SieveRecipes {
|
|||
});
|
||||
|
||||
// Red Sand -> String mesh
|
||||
forMesh(writer, RED_SAND, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,RED_SAND, EItems.STRING_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.12f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.07f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.09f));
|
||||
drops.add(Items.REDSTONE, chance(0.08f));
|
||||
drops.add(Items.RAW_GOLD, chance(0.03f));
|
||||
});
|
||||
forMesh(writer, RED_SAND, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,RED_SAND, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.12f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.07f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.12f));
|
||||
drops.add(Items.REDSTONE, chance(0.09f));
|
||||
drops.add(Items.RAW_GOLD, chance(0.04f));
|
||||
});
|
||||
forMesh(writer, RED_SAND, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,RED_SAND, EItems.IRON_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.12f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.07f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.09f));
|
||||
drops.add(Items.REDSTONE, chance(0.11f));
|
||||
drops.add(Items.RAW_GOLD, chance(0.06f));
|
||||
});
|
||||
forMesh(writer, RED_SAND, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,RED_SAND, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.12f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.07f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.19f));
|
||||
drops.add(Items.REDSTONE, chance(0.07f));
|
||||
drops.add(Items.RAW_GOLD, chance(0.11f));
|
||||
});
|
||||
forMesh(writer, RED_SAND, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,RED_SAND, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.10f));
|
||||
drops.add(Items.DEAD_BUSH, chance(0.03f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.14f));
|
||||
drops.add(Items.REDSTONE, chance(0.14f));
|
||||
drops.add(Items.RAW_GOLD, chance(0.08f));
|
||||
});
|
||||
forMesh(writer, RED_SAND, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,RED_SAND, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(Items.CACTUS, chance(0.12f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.15f));
|
||||
drops.add(Items.REDSTONE, chance(0.17f));
|
||||
drops.add(Items.RAW_GOLD, chance(0.10f));
|
||||
});
|
||||
|
||||
forMesh(writer, DUST, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DUST, EItems.STRING_MESH, drops -> {
|
||||
drops.add(Items.GUNPOWDER, chance(0.1f));
|
||||
drops.add(Items.BONE_MEAL, chance(0.1f));
|
||||
drops.add(Items.REDSTONE, chance(0.06f));
|
||||
|
|
@ -470,7 +474,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SKY_STONE_DUST.get(), chance(0.06f), Recipes.AE2);
|
||||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_DUST.get(), chance(0.06f), Recipes.AE2);
|
||||
});
|
||||
forMesh(writer, DUST, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DUST, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(Items.GUNPOWDER, chance(0.11f));
|
||||
drops.add(Items.BONE_MEAL, chance(0.11f));
|
||||
drops.add(Items.REDSTONE, chance(0.09f));
|
||||
|
|
@ -481,7 +485,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SKY_STONE_DUST.get(), chance(0.07f), Recipes.AE2);
|
||||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_DUST.get(), chance(0.07f), Recipes.AE2);
|
||||
});
|
||||
forMesh(writer, DUST, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DUST, EItems.IRON_MESH, drops -> {
|
||||
drops.add(Items.GUNPOWDER, chance(0.13f));
|
||||
drops.add(Items.BONE_MEAL, chance(0.12f));
|
||||
drops.add(Items.REDSTONE, chance(0.1f));
|
||||
|
|
@ -493,7 +497,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SKY_STONE_DUST.get(), chance(0.075f), Recipes.AE2);
|
||||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_DUST.get(), chance(0.075f), Recipes.AE2);
|
||||
});
|
||||
forMesh(writer, DUST, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DUST, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(Items.GUNPOWDER, chance(0.13f));
|
||||
drops.add(Items.BONE_MEAL, chance(0.11f));
|
||||
drops.add(Items.REDSTONE, chance(0.12f));
|
||||
|
|
@ -506,7 +510,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SKY_STONE_DUST.get(), chance(0.08f), Recipes.AE2);
|
||||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_DUST.get(), chance(0.08f), Recipes.AE2);
|
||||
});
|
||||
forMesh(writer, DUST, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DUST, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(Items.GUNPOWDER, chance(0.14f));
|
||||
drops.add(Items.BONE_MEAL, chance(0.10f));
|
||||
drops.add(Items.REDSTONE, chance(0.12f));
|
||||
|
|
@ -518,7 +522,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SKY_STONE_DUST.get(), chance(0.10f), Recipes.AE2);
|
||||
drops.addConditional(ModCompatData.CERTUS_QUARTZ_DUST.get(), chance(0.10f), Recipes.AE2);
|
||||
});
|
||||
forMesh(writer, DUST, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,DUST, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(Items.GUNPOWDER, chance(0.14f));
|
||||
drops.add(Items.BONE_MEAL, chance(0.13f));
|
||||
drops.add(Items.REDSTONE, chance(0.14f));
|
||||
|
|
@ -533,7 +537,7 @@ class SieveRecipes {
|
|||
});
|
||||
|
||||
// Crushed Deepslate -> String mesh
|
||||
forMesh(writer, CRUSHED_DEEPSLATE, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_DEEPSLATE, EItems.STRING_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(EItems.COPPER_ORE_CHUNK.get(), chance(0.12f));
|
||||
drops.add(EItems.IRON_ORE_CHUNK.get(), chance(0.12f));
|
||||
|
|
@ -556,7 +560,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.05f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
drops.addConditional(EItems.LITHIUM_ORE_CHUNK.get(), chance(0.045f), Recipes.tagNotEmpty(EItemTags.ORES_LITHIUM));
|
||||
});
|
||||
forMesh(writer, CRUSHED_DEEPSLATE, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_DEEPSLATE, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(EItems.TUFF_PEBBLE.get(), binomial(4, 0.4f));
|
||||
drops.add(EItems.CALCITE_PEBBLE.get(), binomial(4, 0.4f));
|
||||
|
|
@ -582,7 +586,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.06f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
drops.addConditional(EItems.LITHIUM_ORE_CHUNK.get(), chance(0.05f), Recipes.tagNotEmpty(EItemTags.ORES_LITHIUM));
|
||||
});
|
||||
forMesh(writer, CRUSHED_DEEPSLATE, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_DEEPSLATE, EItems.IRON_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.6f));
|
||||
drops.add(EItems.COPPER_ORE_CHUNK.get(), chance(0.10f));
|
||||
drops.add(EItems.IRON_ORE_CHUNK.get(), chance(0.15f));
|
||||
|
|
@ -605,7 +609,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.06f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
drops.addConditional(EItems.LITHIUM_ORE_CHUNK.get(), chance(0.06f), Recipes.tagNotEmpty(EItemTags.ORES_LITHIUM));
|
||||
});
|
||||
forMesh(writer, CRUSHED_DEEPSLATE, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_DEEPSLATE, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.65f));
|
||||
drops.add(EItems.COPPER_ORE_CHUNK.get(), chance(0.09f));
|
||||
drops.add(EItems.IRON_ORE_CHUNK.get(), chance(0.15f));
|
||||
|
|
@ -630,7 +634,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.065f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
drops.addConditional(EItems.LITHIUM_ORE_CHUNK.get(), chance(0.065f), Recipes.tagNotEmpty(EItemTags.ORES_LITHIUM));
|
||||
});
|
||||
forMesh(writer, CRUSHED_DEEPSLATE, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_DEEPSLATE, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.65f));
|
||||
drops.add(EItems.COPPER_ORE_CHUNK.get(), chance(0.09f));
|
||||
drops.add(EItems.IRON_ORE_CHUNK.get(), chance(0.18f));
|
||||
|
|
@ -653,7 +657,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.BORON_ORE_CHUNK.get(), chance(0.08f), Recipes.tagNotEmpty(EItemTags.ORES_BORON));
|
||||
drops.addConditional(EItems.LITHIUM_ORE_CHUNK.get(), chance(0.08f), Recipes.tagNotEmpty(EItemTags.ORES_LITHIUM));
|
||||
});
|
||||
forMesh(writer, CRUSHED_DEEPSLATE, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_DEEPSLATE, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(EItems.DEEPSLATE_PEBBLE.get(), binomial(4, 0.7f));
|
||||
drops.add(EItems.COPPER_ORE_CHUNK.get(), chance(0.10f));
|
||||
drops.add(EItems.IRON_ORE_CHUNK.get(), chance(0.20f));
|
||||
|
|
@ -677,7 +681,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.LITHIUM_ORE_CHUNK.get(), chance(0.085f), Recipes.tagNotEmpty(EItemTags.ORES_LITHIUM));
|
||||
});
|
||||
|
||||
forMesh(writer, CRUSHED_BLACKSTONE, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_BLACKSTONE, EItems.STRING_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(4, 0.6f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(3, 0.5f));
|
||||
drops.add(Items.ANCIENT_DEBRIS, chance(0.02f));
|
||||
|
|
@ -686,7 +690,7 @@ class SieveRecipes {
|
|||
drops.add(Items.GUNPOWDER, chance(0.07f));
|
||||
drops.add(Items.BLACK_DYE, chance(0.07f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_BLACKSTONE, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_BLACKSTONE, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(4, 0.65f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(3, 0.55f));
|
||||
drops.add(Items.ANCIENT_DEBRIS, chance(0.03f));
|
||||
|
|
@ -695,7 +699,7 @@ class SieveRecipes {
|
|||
drops.add(Items.GUNPOWDER, chance(0.09f));
|
||||
drops.add(Items.BLACK_DYE, chance(0.08f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_BLACKSTONE, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_BLACKSTONE, EItems.IRON_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(5, 0.65f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(4, 0.55f));
|
||||
drops.add(Items.ANCIENT_DEBRIS, chance(0.04f));
|
||||
|
|
@ -704,7 +708,7 @@ class SieveRecipes {
|
|||
drops.add(Items.GUNPOWDER, chance(0.09f));
|
||||
drops.add(Items.BLACK_DYE, chance(0.08f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_BLACKSTONE, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_BLACKSTONE, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(5, 0.7f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(Items.ANCIENT_DEBRIS, chance(0.05f));
|
||||
|
|
@ -713,14 +717,14 @@ class SieveRecipes {
|
|||
drops.add(Items.GUNPOWDER, chance(0.1f));
|
||||
drops.add(Items.BLACK_DYE, chance(0.06f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_BLACKSTONE, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_BLACKSTONE, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(5, 0.7f));
|
||||
drops.add(Items.ANCIENT_DEBRIS, chance(0.06f));
|
||||
drops.add(Items.GOLD_NUGGET, binomial(4, 0.275f));
|
||||
drops.add(Items.MAGMA_CREAM, chance(0.11f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.11f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_BLACKSTONE, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_BLACKSTONE, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(5, 0.75f));
|
||||
drops.add(Items.ANCIENT_DEBRIS, chance(0.1f));
|
||||
drops.add(Items.GOLD_NUGGET, binomial(4, 0.325f));
|
||||
|
|
@ -728,7 +732,7 @@ class SieveRecipes {
|
|||
drops.add(Items.GUNPOWDER, chance(0.11f));
|
||||
});
|
||||
|
||||
forMesh(writer, CRUSHED_NETHERRACK, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_NETHERRACK, EItems.STRING_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(3, 0.4f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(3, 0.3f));
|
||||
drops.add(Items.BLAZE_POWDER, chance(0.08f));
|
||||
|
|
@ -741,7 +745,7 @@ class SieveRecipes {
|
|||
|
||||
drops.addConditional(EItems.COBALT_ORE_CHUNK.get(), chance(0.04f), Recipes.tagNotEmpty(EItemTags.ORES_COBALT));
|
||||
});
|
||||
forMesh(writer, CRUSHED_NETHERRACK, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_NETHERRACK, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(4, 0.5f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(4, 0.4f));
|
||||
drops.add(Items.BLAZE_POWDER, chance(0.09f));
|
||||
|
|
@ -754,7 +758,7 @@ class SieveRecipes {
|
|||
|
||||
drops.addConditional(EItems.COBALT_ORE_CHUNK.get(), chance(0.05f), Recipes.tagNotEmpty(EItemTags.ORES_COBALT));
|
||||
});
|
||||
forMesh(writer, CRUSHED_NETHERRACK, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_NETHERRACK, EItems.IRON_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(4, 0.6f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(4, 0.45f));
|
||||
drops.add(Items.BLAZE_POWDER, chance(0.1f));
|
||||
|
|
@ -767,7 +771,7 @@ class SieveRecipes {
|
|||
|
||||
drops.addConditional(EItems.COBALT_ORE_CHUNK.get(), chance(0.065f), Recipes.tagNotEmpty(EItemTags.ORES_COBALT));
|
||||
});
|
||||
forMesh(writer, CRUSHED_NETHERRACK, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_NETHERRACK, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(4, 0.6f));
|
||||
drops.add(EItems.BASALT_PEBBLE.get(), binomial(4, 0.45f));
|
||||
drops.add(Items.BLAZE_POWDER, chance(0.11f));
|
||||
|
|
@ -781,7 +785,7 @@ class SieveRecipes {
|
|||
|
||||
drops.addConditional(EItems.COBALT_ORE_CHUNK.get(), chance(0.07f), Recipes.tagNotEmpty(EItemTags.ORES_COBALT));
|
||||
});
|
||||
forMesh(writer, CRUSHED_NETHERRACK, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_NETHERRACK, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(4, 0.6f));
|
||||
drops.add(Items.BLAZE_POWDER, chance(0.14f));
|
||||
drops.add(Items.QUARTZ, chance(0.13f));
|
||||
|
|
@ -791,7 +795,7 @@ class SieveRecipes {
|
|||
|
||||
drops.addConditional(EItems.COBALT_ORE_CHUNK.get(), chance(0.09f), Recipes.tagNotEmpty(EItemTags.ORES_COBALT));
|
||||
});
|
||||
forMesh(writer, CRUSHED_NETHERRACK, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_NETHERRACK, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(EItems.BLACKSTONE_PEBBLE.get(), binomial(5, 0.65f));
|
||||
drops.add(Items.BLAZE_POWDER, chance(0.15f));
|
||||
drops.add(Items.QUARTZ, chance(0.15f));
|
||||
|
|
@ -802,7 +806,7 @@ class SieveRecipes {
|
|||
drops.addConditional(EItems.COBALT_ORE_CHUNK.get(), chance(0.11f), Recipes.tagNotEmpty(EItemTags.ORES_COBALT));
|
||||
});
|
||||
|
||||
forMesh(writer, SOUL_SAND, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SOUL_SAND, EItems.STRING_MESH, drops -> {
|
||||
drops.add(Items.QUARTZ, chance(0.12f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.07f));
|
||||
drops.add(Items.BONE, chance(0.08f));
|
||||
|
|
@ -810,7 +814,7 @@ class SieveRecipes {
|
|||
drops.add(Items.NETHER_WART, chance(0.06f));
|
||||
drops.add(Items.GLOWSTONE_DUST, chance(0.06f));
|
||||
});
|
||||
forMesh(writer, SOUL_SAND, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SOUL_SAND, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(Items.QUARTZ, chance(0.14f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.08f));
|
||||
drops.add(Items.BONE, chance(0.1f));
|
||||
|
|
@ -820,7 +824,7 @@ class SieveRecipes {
|
|||
drops.add(EItems.WARPED_NYLIUM_SPORES.get(), chance(0.03f));
|
||||
drops.add(EItems.CRIMSON_NYLIUM_SPORES.get(), chance(0.03f));
|
||||
});
|
||||
forMesh(writer, SOUL_SAND, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SOUL_SAND, EItems.IRON_MESH, drops -> {
|
||||
drops.add(Items.QUARTZ, chance(0.15f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.07f));
|
||||
drops.add(Items.BONE, chance(0.08f));
|
||||
|
|
@ -828,7 +832,7 @@ class SieveRecipes {
|
|||
drops.add(Items.GLOWSTONE_DUST, chance(0.06f));
|
||||
drops.add(Items.NETHER_WART, chance(0.05f));
|
||||
});
|
||||
forMesh(writer, SOUL_SAND, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SOUL_SAND, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(Items.QUARTZ, chance(0.17f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.1f));
|
||||
drops.add(Items.BONE, chance(0.11f));
|
||||
|
|
@ -837,14 +841,14 @@ class SieveRecipes {
|
|||
drops.add(Items.NETHER_WART, chance(0.08f));
|
||||
drops.add(Items.GOLD_NUGGET, chance(0.15f));
|
||||
});
|
||||
forMesh(writer, SOUL_SAND, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SOUL_SAND, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(Items.QUARTZ, chance(0.19f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.11f));
|
||||
drops.add(Items.GHAST_TEAR, chance(0.09f));
|
||||
drops.add(Items.GLOWSTONE_DUST, chance(0.11f));
|
||||
drops.add(Items.NETHER_WART, chance(0.1f));
|
||||
});
|
||||
forMesh(writer, SOUL_SAND, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,SOUL_SAND, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(Items.QUARTZ, chance(0.21f));
|
||||
drops.add(Items.GUNPOWDER, chance(0.14f));
|
||||
drops.add(Items.GHAST_TEAR, chance(0.11f));
|
||||
|
|
@ -852,37 +856,37 @@ class SieveRecipes {
|
|||
drops.add(Items.NETHER_WART, chance(0.12f));
|
||||
});
|
||||
|
||||
forMesh(writer, CRUSHED_END_STONE, EItems.STRING_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_END_STONE, EItems.STRING_MESH, drops -> {
|
||||
drops.add(Items.ENDER_PEARL, chance(0.07f));
|
||||
drops.add(Items.CHORUS_FRUIT, chance(0.09f));
|
||||
drops.add(Items.CHORUS_FLOWER, chance(0.04f));
|
||||
drops.add(Items.ENDER_EYE, chance(0.02f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_END_STONE, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_END_STONE, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(Items.ENDER_PEARL, chance(0.08f));
|
||||
drops.add(Items.CHORUS_FRUIT, chance(0.11f));
|
||||
drops.add(Items.CHORUS_FLOWER, chance(0.06f));
|
||||
drops.add(Items.ENDER_EYE, chance(0.03f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_END_STONE, EItems.IRON_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_END_STONE, EItems.IRON_MESH, drops -> {
|
||||
drops.add(Items.ENDER_PEARL, chance(0.10f));
|
||||
drops.add(Items.CHORUS_FRUIT, chance(0.13f));
|
||||
drops.add(Items.CHORUS_FLOWER, chance(0.07f));
|
||||
drops.add(Items.ENDER_EYE, chance(0.04f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_END_STONE, EItems.GOLDEN_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_END_STONE, EItems.GOLDEN_MESH, drops -> {
|
||||
drops.add(Items.ENDER_PEARL, chance(0.12f));
|
||||
drops.add(Items.CHORUS_FRUIT, chance(0.12f));
|
||||
drops.add(Items.CHORUS_FLOWER, chance(0.06f));
|
||||
drops.add(Items.ENDER_EYE, chance(0.07f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_END_STONE, EItems.DIAMOND_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_END_STONE, EItems.DIAMOND_MESH, drops -> {
|
||||
drops.add(Items.ENDER_PEARL, chance(0.15f));
|
||||
drops.add(Items.CHORUS_FRUIT, chance(0.10f));
|
||||
drops.add(Items.CHORUS_FLOWER, chance(0.04f));
|
||||
drops.add(Items.ENDER_EYE, chance(0.09f));
|
||||
});
|
||||
forMesh(writer, CRUSHED_END_STONE, EItems.NETHERITE_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,CRUSHED_END_STONE, EItems.NETHERITE_MESH, drops -> {
|
||||
drops.add(Items.ENDER_PEARL, chance(0.17f));
|
||||
drops.add(Items.CHORUS_FRUIT, chance(0.10f));
|
||||
drops.add(Items.CHORUS_FLOWER, chance(0.04f));
|
||||
|
|
@ -894,7 +898,7 @@ class SieveRecipes {
|
|||
for (int i = 0; i < allMeshes.size(); i++) {
|
||||
var mesh = allMeshes.get(i);
|
||||
final int j = i;
|
||||
forMesh(writer, MOSS_BLOCK, mesh, drops -> {
|
||||
forMesh(writer, compressedVariants,MOSS_BLOCK, mesh, drops -> {
|
||||
drops.add(Items.OAK_SAPLING, chance(0.13f));
|
||||
drops.add(Items.SPRUCE_SAPLING, chance(0.11f));
|
||||
drops.add(Items.BIRCH_SAPLING, chance(0.11f));
|
||||
|
|
@ -938,7 +942,7 @@ class SieveRecipes {
|
|||
drops.addConditional(ModCompatData.SOURCEBERRY.get(), chance(0.01f), ars);
|
||||
});
|
||||
}
|
||||
forMesh(writer, MOSS_BLOCK, EItems.FLINT_MESH, drops -> {
|
||||
forMesh(writer, compressedVariants,MOSS_BLOCK, EItems.FLINT_MESH, drops -> {
|
||||
drops.add(Items.SWEET_BERRIES, chance(0.03f));
|
||||
drops.add(Items.FLOWERING_AZALEA, chance(0.03f));
|
||||
drops.add(Items.GLOW_LICHEN, chance(0.04f));
|
||||
|
|
@ -950,34 +954,34 @@ class SieveRecipes {
|
|||
return binomial(1, p);
|
||||
}
|
||||
|
||||
private static void forMesh(RecipeOutput output, Ingredient block, DeferredItem<? extends Item> mesh, Consumer<MeshDrops> addDrops) {
|
||||
private static void forMesh(RecipeOutput output, Map<Ingredient, Ingredient> compressedVariants, Ingredient block, DeferredItem<? extends Item> mesh, Consumer<MeshDrops> addDrops) {
|
||||
var folder = mesh.getId().getPath().replace("_mesh", "/");
|
||||
var basePath = path(block.getItems()[0].getItem()) + "/" + folder;
|
||||
var basePath = path(block.items().findFirst().orElseThrow().value()) + "/" + folder;
|
||||
|
||||
addDrops.accept(new MeshDrops(output, "sieve/" + basePath, "compressed_sieve/" + basePath, block, Ingredient.of(mesh.get())));
|
||||
addDrops.accept(new MeshDrops(output, "sieve/" + basePath, "compressed_sieve/" + basePath, block, Ingredient.of(mesh.get()), compressedVariants));
|
||||
}
|
||||
|
||||
private record MeshDrops(RecipeOutput output, String basePath, String baseCompressedPath, Ingredient block, Ingredient mesh) {
|
||||
private record MeshDrops(RecipeOutput output, String basePath, String baseCompressedPath, Ingredient block, Ingredient mesh, Map<Ingredient, Ingredient> compressedVariants) {
|
||||
private void add(Item result, NumberProvider resultAmount) {
|
||||
this.output.accept(modLoc(this.basePath + path(result)), new SieveRecipe(this.block, new ItemStack(result), resultAmount, this.mesh, false), null);
|
||||
this.output.accept(ResourceKey.create(Registries.RECIPE, modLoc(this.basePath + path(result))), new SieveRecipe(this.block, new ItemStack(result), resultAmount, this.mesh, false), null);
|
||||
|
||||
if (COMPRESSED_VARIANTS.containsKey(this.block)) {
|
||||
var compressedLoc = modLoc(this.baseCompressedPath + path(result));
|
||||
if (this.compressedVariants.containsKey(this.block)) {
|
||||
var compressedLoc = ResourceKey.create(Registries.RECIPE, modLoc(this.baseCompressedPath + path(result)));
|
||||
var multiplied = Recipes.compressedMultiplier(resultAmount);
|
||||
|
||||
this.output.accept(compressedLoc, new CompressedSieveRecipe(COMPRESSED_VARIANTS.get(this.block), new ItemStack(result), multiplied, this.mesh, false), null);
|
||||
this.output.accept(compressedLoc, new CompressedSieveRecipe(this.compressedVariants.get(this.block), new ItemStack(result), multiplied, this.mesh, false), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void addConditional(ItemLike result, NumberProvider resultAmount, ICondition condition) {
|
||||
var path = modLoc(this.basePath + path(result));
|
||||
this.output.accept(path, new SieveRecipe(this.block, new ItemStack(result), resultAmount, this.mesh, false), null, condition);
|
||||
var path = ResourceKey.create(Registries.RECIPE, modLoc(this.basePath + path(result)));
|
||||
this.output.withConditions(condition).accept(path, new SieveRecipe(this.block, new ItemStack(result), resultAmount, this.mesh, false), null);
|
||||
|
||||
if (COMPRESSED_VARIANTS.containsKey(this.block)) {
|
||||
var compressedLoc = modLoc(this.baseCompressedPath + path(result));
|
||||
if (this.compressedVariants.containsKey(this.block)) {
|
||||
var compressedLoc = ResourceKey.create(Registries.RECIPE, modLoc(this.baseCompressedPath + path(result)));
|
||||
var multiplied = Recipes.compressedMultiplier(resultAmount);
|
||||
|
||||
this.output.accept(compressedLoc, new CompressedSieveRecipe(COMPRESSED_VARIANTS.get(this.block), new ItemStack(result), multiplied, this.mesh, false), null, condition);
|
||||
this.output.withConditions(condition).accept(compressedLoc, new CompressedSieveRecipe(this.compressedVariants.get(this.block), new ItemStack(result), multiplied, this.mesh, false), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ public class PorcelainBucket extends Item {
|
|||
if (!target.isBaby()) {
|
||||
var level = player.level();
|
||||
player.playSound(SoundEvents.COW_MILK, 1.0f, 1.0f);
|
||||
if (!level.isClientSide) {
|
||||
if (!level.isClientSide()) {
|
||||
// have to make a copy to prevent player voiding the item stack in line 1056
|
||||
// when it calls interactLivingEntity and checks if the stack is empty afterwards
|
||||
var result = ItemUtils.createFilledResult(stack.getCount() == 1 ? stack.copy() : stack, player, new ItemStack(EItems.PORCELAIN_MILK_BUCKET.get()));
|
||||
player.setItemInHand(hand, result);
|
||||
}
|
||||
return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.sidedSuccess(level.isClientSide());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ public class PorcelainBucket extends Item {
|
|||
var i = pos.getX();
|
||||
var j = pos.getY();
|
||||
var k = pos.getZ();
|
||||
level.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (level.random.nextFloat() - level.random.nextFloat()) * 0.8F);
|
||||
level.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (level.getRandom().nextFloat() - level.getRandom().nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
level.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0, 0, 0);
|
||||
|
|
@ -195,7 +195,7 @@ public class PorcelainBucket extends Item {
|
|||
playEmptySound(player, level, pos);
|
||||
return true;
|
||||
} else {
|
||||
if (!level.isClientSide && replacing && !state.liquid()) {
|
||||
if (!level.isClientSide() && replacing && !state.liquid()) {
|
||||
level.destroyBlock(pos, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,15 @@ import net.minecraft.world.InteractionResult;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipDisplay;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import thedarkcolour.exdeorum.data.TranslationKeys;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RandomResultItem extends Item {
|
||||
private final TagKey<Item> possibilities;
|
||||
|
|
@ -49,7 +51,7 @@ public class RandomResultItem extends Item {
|
|||
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
||||
var stack = player.getItemInHand(hand);
|
||||
|
||||
if (!level.isClientSide) {
|
||||
if (!level.isClientSide()) {
|
||||
var possibleResults = new ArrayList<Item>();
|
||||
for (var holder : BuiltInRegistries.ITEM.getTagOrEmpty(this.possibilities)) {
|
||||
possibleResults.add(holder.value());
|
||||
|
|
@ -58,7 +60,7 @@ public class RandomResultItem extends Item {
|
|||
if (!player.getAbilities().instabuild) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
var newItem = new ItemStack(Util.getRandom(possibleResults, level.random));
|
||||
var newItem = new ItemStack(Util.getRandom(possibleResults, level.getRandom()));
|
||||
player.getInventory().placeItemBackInInventory(newItem);
|
||||
|
||||
return InteractionResult.CONSUME.heldItemTransformedTo(stack.isEmpty() ? player.getItemInHand(hand) : stack);
|
||||
|
|
@ -67,9 +69,9 @@ public class RandomResultItem extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack pStack, TooltipContext pLevel, List<Component> tooltip, TooltipFlag pIsAdvanced) {
|
||||
public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay display, Consumer<Component> tooltipAdder, TooltipFlag advanced) {
|
||||
if (this == EItems.RANDOM_ARMOR_TRIM.value()) {
|
||||
tooltip.add(Component.translatable(TranslationKeys.RANDOM_TRIM_DOES_NOT_CONTAIN_UPGRADE).withStyle(ChatFormatting.DARK_GRAY));
|
||||
tooltipAdder.accept(Component.translatable(TranslationKeys.RANDOM_TRIM_DOES_NOT_CONTAIN_UPGRADE).withStyle(ChatFormatting.DARK_GRAY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ public class SculkCoreItem extends Item {
|
|||
var stack = context.getItemInHand();
|
||||
var player = context.getPlayer();
|
||||
|
||||
if (!level.isClientSide) {
|
||||
if (!level.isClientSide()) {
|
||||
if (!player.getAbilities().instabuild) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
level.setBlock(pos, state.setValue(SculkShriekerBlock.CAN_SUMMON, true), 3);
|
||||
} else {
|
||||
var rand = level.random;
|
||||
var rand = level.getRandom();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int j = i * 36;
|
||||
double radians = Math.toRadians(j);
|
||||
|
|
@ -61,7 +61,7 @@ public class SculkCoreItem extends Item {
|
|||
}
|
||||
level.playSound(null, pos, ESounds.SCULK_CORE_ACTIVATE.get(), SoundSource.BLOCKS, 1.0f, 1.0f);
|
||||
|
||||
return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
return InteractionResult.sidedSuccess(level.isClientSide());
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class MaterialRegistry<M extends AbstractMaterial> implements Iterable<M>
|
|||
validBlocks.add(material.block.get());
|
||||
}
|
||||
|
||||
return new BlockEntityType<>(factory, validBlocks.build(), null);
|
||||
return new BlockEntityType<>(factory, validBlocks.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import net.minecraft.resources.Identifier;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.DataSlot;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.blockentity.MechanicalHammerBlockEntity;
|
||||
|
|
@ -44,7 +43,7 @@ public class MechanicalHammerMenu extends AbstractMachineMenu<MechanicalHammerBl
|
|||
// input slot
|
||||
addSlot(machine.inventory.createSlot(0, 32, 35));
|
||||
// hammer slot
|
||||
addSlot(machine.inventory.createSlot(1, 56, 35).setBackground(InventoryMenu.BLOCK_ATLAS, EMPTY_SLOT_HAMMER));
|
||||
addSlot(machine.inventory.createSlot(1, 56, 35).setBackground(EMPTY_SLOT_HAMMER));
|
||||
// output slot
|
||||
addSlot(machine.inventory.createSlot(2, 116, 35));
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import net.minecraft.network.FriendlyByteBuf;
|
|||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import thedarkcolour.exdeorum.ExDeorum;
|
||||
import thedarkcolour.exdeorum.blockentity.MechanicalSieveBlockEntity;
|
||||
|
|
@ -42,7 +41,7 @@ public class MechanicalSieveMenu extends AbstractMachineMenu<MechanicalSieveBloc
|
|||
// input slot
|
||||
addSlot(sieve.inventory.createSlot(0, 26, 30));
|
||||
// mesh slot
|
||||
addSlot(sieve.inventory.createSlot(1, 26, 53).setBackground(InventoryMenu.BLOCK_ATLAS, EMPTY_SLOT_MESH));
|
||||
addSlot(sieve.inventory.createSlot(1, 26, 53).setBackground(EMPTY_SLOT_MESH));
|
||||
// output slots
|
||||
for (int r = 0; r < 4; ++r) {
|
||||
for (int c = 0; c < 5; ++c) {
|
||||
|
|
|
|||
|
|
@ -66,9 +66,11 @@ public class OreChunkRecipe implements CraftingRecipe {
|
|||
return this.ore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
return this.pattern.ingredients();
|
||||
public List<Ingredient> getIngredients() {
|
||||
return this.pattern.ingredients().stream()
|
||||
.filter(java.util.Optional::isPresent)
|
||||
.map(java.util.Optional::get)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -102,7 +104,7 @@ public class OreChunkRecipe implements CraftingRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
public RecipeSerializer<OreChunkRecipe> getSerializer() {
|
||||
return ERecipeSerializers.ORE_CHUNK.get();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
import net.minecraft.world.item.crafting.RecipeMap;
|
||||
|
|
@ -40,12 +39,12 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.util.context.ContextMap;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.*;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import thedarkcolour.exdeorum.compat.PreferredOres;
|
||||
import thedarkcolour.exdeorum.loot.SummationGenerator;
|
||||
import thedarkcolour.exdeorum.recipe.barrel.BarrelCompostRecipe;
|
||||
import thedarkcolour.exdeorum.recipe.barrel.BarrelFluidMixingRecipe;
|
||||
|
|
@ -58,7 +57,6 @@ import thedarkcolour.exdeorum.recipe.hammer.CompressedHammerRecipe;
|
|||
import thedarkcolour.exdeorum.recipe.hammer.HammerRecipe;
|
||||
import thedarkcolour.exdeorum.recipe.sieve.CompressedSieveRecipe;
|
||||
import thedarkcolour.exdeorum.recipe.sieve.SieveRecipe;
|
||||
import thedarkcolour.exdeorum.registry.ENumberProviders;
|
||||
import thedarkcolour.exdeorum.registry.ERecipeTypes;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -158,21 +156,18 @@ public final class RecipeUtil {
|
|||
}
|
||||
|
||||
public static void toNetworkNumberProvider(FriendlyByteBuf buffer, NumberProvider provider) {
|
||||
if (provider.getType() == NumberProviders.CONSTANT) {
|
||||
if (provider instanceof ConstantValue constant) {
|
||||
buffer.writeByte(CONSTANT_TYPE);
|
||||
buffer.writeFloat(((ConstantValue) provider).value());
|
||||
} else if (provider.getType() == NumberProviders.UNIFORM) {
|
||||
var uniform = (UniformGenerator) provider;
|
||||
buffer.writeFloat(constant.value());
|
||||
} else if (provider instanceof UniformGenerator uniform) {
|
||||
buffer.writeByte(UNIFORM_TYPE);
|
||||
toNetworkNumberProvider(buffer, uniform.min());
|
||||
toNetworkNumberProvider(buffer, uniform.max());
|
||||
} else if (provider.getType() == NumberProviders.BINOMIAL) {
|
||||
var binomial = (BinomialDistributionGenerator) provider;
|
||||
} else if (provider instanceof BinomialDistributionGenerator binomial) {
|
||||
buffer.writeByte(BINOMIAL_TYPE);
|
||||
toNetworkNumberProvider(buffer, binomial.n());
|
||||
toNetworkNumberProvider(buffer, binomial.p());
|
||||
} else if (provider.getType() == ENumberProviders.SUMMATION.get()) {
|
||||
var summation = (SummationGenerator) provider;
|
||||
} else if (provider instanceof SummationGenerator summation) {
|
||||
var providers = summation.providers();
|
||||
int length = providers.size();
|
||||
buffer.writeByte(SUMMATION_TYPE);
|
||||
|
|
@ -272,11 +267,11 @@ public final class RecipeUtil {
|
|||
}
|
||||
|
||||
public static boolean isTagEmpty(TagKey<Item> tag) {
|
||||
return BuiltInRegistries.ITEM.getTag(tag).map(set -> !set.iterator().hasNext()).orElse(PreferredOres.getPreferredOre(tag) == Items.AIR);
|
||||
return !BuiltInRegistries.ITEM.getTagOrEmpty(tag).iterator().hasNext();
|
||||
}
|
||||
|
||||
public static LootContext emptyLootContext(ServerLevel level) {
|
||||
return new LootContext.Builder(new LootParams(level, Map.of(), Map.of(), 0)).create(Optional.empty());
|
||||
return new LootContext.Builder(new LootParams(level, ContextMap.EMPTY, Map.of(), 0f)).create(Optional.empty());
|
||||
}
|
||||
|
||||
public static List<CrookRecipe> getCrookRecipes(BlockState state) {
|
||||
|
|
@ -319,7 +314,7 @@ public final class RecipeUtil {
|
|||
|
||||
public static BlockState parseBlockState(String stateString) {
|
||||
try {
|
||||
return BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), stateString, false).blockState();
|
||||
return BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK, stateString, false).blockState();
|
||||
} catch (CommandSyntaxException e) {
|
||||
throw new IllegalArgumentException("Failed to parse BlockState string \"" + stateString + "\"");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ public record BarrelFluidMixingRecipe(
|
|||
boolean consumesAdditive
|
||||
) implements Recipe<RecipeInput> {
|
||||
public static final MapCodec<BarrelFluidMixingRecipe> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
|
||||
SizedFluidIngredient.FLAT_CODEC.fieldOf("base_fluid").forGetter(BarrelFluidMixingRecipe::baseFluid),
|
||||
FluidIngredient.CODEC_NON_EMPTY.fieldOf("additive_fluid").forGetter(BarrelFluidMixingRecipe::additiveFluid),
|
||||
SizedFluidIngredient.CODEC.fieldOf("base_fluid").forGetter(BarrelFluidMixingRecipe::baseFluid),
|
||||
FluidIngredient.CODEC.fieldOf("additive_fluid").forGetter(BarrelFluidMixingRecipe::additiveFluid),
|
||||
ItemStack.CODEC.fieldOf("result").forGetter(BarrelFluidMixingRecipe::result),
|
||||
Codec.BOOL.optionalFieldOf("consumes_additive", false).forGetter(BarrelFluidMixingRecipe::consumesAdditive)
|
||||
).apply(instance, BarrelFluidMixingRecipe::new));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import thedarkcolour.exdeorum.registry.ERecipeTypes;
|
|||
public class BarrelMixingRecipe extends SingleIngredientRecipe {
|
||||
public static final MapCodec<BarrelMixingRecipe> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
|
||||
CodecUtil.ingredientField(),
|
||||
SizedFluidIngredient.FLAT_CODEC.fieldOf("fluid").forGetter(BarrelMixingRecipe::getFluid),
|
||||
SizedFluidIngredient.CODEC.fieldOf("fluid").forGetter(BarrelMixingRecipe::getFluid),
|
||||
ItemStack.CODEC.fieldOf("result").forGetter(BarrelMixingRecipe::getResult)
|
||||
).apply(instance, BarrelMixingRecipe::new));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, BarrelMixingRecipe> STREAM_CODEC = StreamCodec.of(BarrelMixingRecipe::toNetwork, BarrelMixingRecipe::fromNetwork);
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ public class BarrelFluidMixingRecipeCache {
|
|||
|
||||
for (var holder : this.recipeManager.byType(ERecipeTypes.BARREL_FLUID_MIXING.get())) {
|
||||
var recipe = holder.value();
|
||||
for (var baseStack : recipe.baseFluid().ingredient().getStacks()) {
|
||||
var map = this.recipes.computeIfAbsent(baseStack.getFluid(), key -> new HashMap<>());
|
||||
for (var baseHolder : recipe.baseFluid().ingredient().fluids()) {
|
||||
var map = this.recipes.computeIfAbsent(baseHolder.value(), key -> new HashMap<>());
|
||||
|
||||
for (var additiveStack : recipe.additiveFluid().getStacks()) {
|
||||
map.put(additiveStack.getFluid(), recipe);
|
||||
for (var additiveHolder : recipe.additiveFluid().fluids()) {
|
||||
map.put(additiveHolder.value(), recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ public class FluidTransformationRecipeCache {
|
|||
for (var holder : this.recipeManager.byType(ERecipeTypes.BARREL_FLUID_TRANSFORMATION.get())) {
|
||||
var recipe = holder.value();
|
||||
recipe.catalyst().possibleStates().forEach(state -> {
|
||||
for (var stack : recipe.baseFluid().getStacks()) {
|
||||
this.recipes.computeIfAbsent(state, key -> new HashMap<>()).put(stack.getFluid(), recipe);
|
||||
for (var fluidHolder : recipe.baseFluid().fluids()) {
|
||||
this.recipes.computeIfAbsent(state, key -> new HashMap<>()).put(fluidHolder.value(), recipe);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ public class SieveRecipeCache<T extends SieveRecipe> {
|
|||
var tempMap = new HashMap<Item, List<T>>();
|
||||
for (var holder : this.recipeManager.byType(this.recipeType.get())) {
|
||||
var recipe = holder.value();
|
||||
for (var stack : recipe.mesh.getItems()) {
|
||||
tempMap.computeIfAbsent(stack.getItem(), k -> new ArrayList<>()).add(recipe);
|
||||
}
|
||||
recipe.mesh.items().forEach(meshHolder -> tempMap.computeIfAbsent(meshHolder.value(), k -> new ArrayList<>()).add(recipe));
|
||||
}
|
||||
this.meshCaches = new HashMap<>();
|
||||
for (var mesh : tempMap.entrySet()) {
|
||||
|
|
@ -80,9 +78,7 @@ public class SieveRecipeCache<T extends SieveRecipe> {
|
|||
var temp = new HashMap<Item, ImmutableList.Builder<T>>();
|
||||
|
||||
for (var recipe : recipes) {
|
||||
for (var item : recipe.ingredient.getItems()) {
|
||||
temp.computeIfAbsent(item.getItem(), k -> ImmutableList.builder()).add(recipe);
|
||||
}
|
||||
recipe.ingredient.items().forEach(holder -> temp.computeIfAbsent(holder.value(), k -> ImmutableList.builder()).add(recipe));
|
||||
}
|
||||
|
||||
for (var entry : temp.entrySet()) {
|
||||
|
|
|
|||
|
|
@ -108,9 +108,7 @@ public class SingleIngredientRecipeCache<T extends SingleIngredientRecipe> {
|
|||
var ingredient = recipe.ingredient();
|
||||
|
||||
if (ingredient.isSimple()) {
|
||||
for (var item : ingredient.getItems()) {
|
||||
this.simpleRecipes.put(item.getItem(), recipe);
|
||||
}
|
||||
ingredient.items().forEach(itemHolder -> this.simpleRecipes.put(itemHolder.value(), recipe));
|
||||
} else {
|
||||
complexRecipes.add(recipe);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@ public class HammerRecipe extends ProbabilityRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<HammerRecipe> getSerializer() {
|
||||
public RecipeSerializer<? extends HammerRecipe> getSerializer() {
|
||||
return ERecipeSerializers.HAMMER.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeType<HammerRecipe> getType() {
|
||||
public RecipeType<? extends HammerRecipe> getType() {
|
||||
return ERecipeTypes.HAMMER.get();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@ public class SieveRecipe extends ProbabilityRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<SieveRecipe> getSerializer() {
|
||||
public RecipeSerializer<? extends SieveRecipe> getSerializer() {
|
||||
return ERecipeSerializers.SIEVE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeType<SieveRecipe> getType() {
|
||||
public RecipeType<? extends SieveRecipe> getType() {
|
||||
return ERecipeTypes.SIEVE.get();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import net.minecraft.resources.ResourceKey;
|
|||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.NoiseColumn;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
|
|
@ -147,14 +148,14 @@ public class VoidChunkGenerator extends NoiseBasedChunkGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void createStructures(RegistryAccess registries, ChunkGeneratorStructureState pStructureState, StructureManager pStructureManager, ChunkAccess pChunk, StructureTemplateManager pStructureTemplateManager) {
|
||||
public void createStructures(RegistryAccess registries, ChunkGeneratorStructureState pStructureState, StructureManager pStructureManager, ChunkAccess pChunk, StructureTemplateManager pStructureTemplateManager, ResourceKey<Level> level) {
|
||||
if (this.generateNormal || hasStructures(registries)) {
|
||||
super.createStructures(registries, pStructureState, pStructureManager, pChunk, pStructureTemplateManager);
|
||||
super.createStructures(registries, pStructureState, pStructureManager, pChunk, pStructureTemplateManager, level);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasStructures(RegistryAccess registries) {
|
||||
return registries.registryOrThrow(Registries.STRUCTURE_SET).getTagOrEmpty(this.allowedStructureSets).iterator().hasNext();
|
||||
return registries.lookupOrThrow(Registries.STRUCTURE_SET).getTagOrEmpty(this.allowedStructureSets).iterator().hasNext();
|
||||
}
|
||||
|
||||
private record FilteredLookup(HolderLookup<StructureSet> parent,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user