mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-05 01:45:00 +01:00
1.19.3 Port Part II
This commit is contained in:
parent
db681959b6
commit
de412a74ea
47 changed files with 352 additions and 239 deletions
|
@ -243,6 +243,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -783,8 +784,8 @@ public class AllBlocks {
|
|||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
|
||||
.transform(pickaxeOnly())
|
||||
.loot((p, b) -> p.add(b, RegistrateBlockLootTables.createSingleItemTable(METAL_GIRDER.get())
|
||||
.withPool(RegistrateBlockLootTables.applyExplosionCondition(SHAFT.get(), LootPool.lootPool()
|
||||
.loot((p, b) -> p.add(b, p.createSingleItemTable(METAL_GIRDER.get())
|
||||
.withPool(p.applyExplosionCondition(SHAFT.get(), LootPool.lootPool()
|
||||
.setRolls(ConstantValue.exactly(1.0F))
|
||||
.add(LootItem.lootTableItem(SHAFT.get()))))))
|
||||
.onRegister(CreateRegistrate.blockModel(() -> ConnectedGirderModel::new))
|
||||
|
@ -900,7 +901,7 @@ public class AllBlocks {
|
|||
.properties(p -> p.color(colour.getMaterialColor()))
|
||||
.transform(pickaxeOnly())
|
||||
.transform(BuilderTransformers.valveHandle(colour))
|
||||
.recipe((c, p) -> ShapelessRecipeBuilder.shapeless(c.get())
|
||||
.recipe((c, p) -> ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, c.get())
|
||||
.requires(colour.getTag())
|
||||
.requires(AllItemTags.VALVE_HANDLES.tag)
|
||||
.unlockedBy("has_valve", RegistrateRecipeProvider.has(AllItemTags.VALVE_HANDLES.tag))
|
||||
|
@ -1328,12 +1329,12 @@ public class AllBlocks {
|
|||
.texture("2", p.modLoc("block/seat/side_" + colourName)));
|
||||
})
|
||||
.recipe((c, p) -> {
|
||||
ShapelessRecipeBuilder.shapeless(c.get())
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, c.get())
|
||||
.requires(DyeHelper.getWoolOfDye(colour))
|
||||
.requires(ItemTags.WOODEN_SLABS)
|
||||
.unlockedBy("has_wool", RegistrateRecipeProvider.has(ItemTags.WOOL))
|
||||
.save(p, Create.asResource("crafting/kinetics/" + c.getName()));
|
||||
ShapelessRecipeBuilder.shapeless(c.get())
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, c.get())
|
||||
.requires(colour.getTag())
|
||||
.requires(AllItemTags.SEATS.tag)
|
||||
.unlockedBy("has_seat", RegistrateRecipeProvider.has(AllItemTags.SEATS.tag))
|
||||
|
@ -1979,7 +1980,7 @@ public class AllBlocks {
|
|||
.transform(pickaxeOnly())
|
||||
.loot((lt, b) -> lt.add(b,
|
||||
RegistrateBlockLootTables.createSilkTouchDispatchTable(b,
|
||||
RegistrateBlockLootTables.applyExplosionDecay(b, LootItem.lootTableItem(AllItems.RAW_ZINC.get())
|
||||
lt.applyExplosionDecay(b, LootItem.lootTableItem(AllItems.RAW_ZINC.get())
|
||||
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE))))))
|
||||
.tag(BlockTags.NEEDS_IRON_TOOL)
|
||||
.tag(Tags.Blocks.ORES)
|
||||
|
@ -1996,7 +1997,7 @@ public class AllBlocks {
|
|||
.transform(pickaxeOnly())
|
||||
.loot((lt, b) -> lt.add(b,
|
||||
RegistrateBlockLootTables.createSilkTouchDispatchTable(b,
|
||||
RegistrateBlockLootTables.applyExplosionDecay(b, LootItem.lootTableItem(AllItems.RAW_ZINC.get())
|
||||
lt.applyExplosionDecay(b, LootItem.lootTableItem(AllItems.RAW_ZINC.get())
|
||||
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE))))))
|
||||
.tag(BlockTags.NEEDS_IRON_TOOL)
|
||||
.tag(Tags.Blocks.ORES)
|
||||
|
@ -2056,7 +2057,8 @@ public class AllBlocks {
|
|||
.transform(pickaxeOnly())
|
||||
.blockstate((c, p) -> p.axisBlock(c.get(), p.modLoc("block/palettes/rose_quartz_side"),
|
||||
p.modLoc("block/palettes/rose_quartz_top")))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.ROSE_QUARTZ), c::get, 2))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.ROSE_QUARTZ.get()),
|
||||
RecipeCategory.BUILDING_BLOCKS, c::get, 2))
|
||||
.simpleItem()
|
||||
.lang("Block of Rose Quartz")
|
||||
.register();
|
||||
|
@ -2067,7 +2069,8 @@ public class AllBlocks {
|
|||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("palettes/rose_quartz_tiles"))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.POLISHED_ROSE_QUARTZ), c::get, 2))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.POLISHED_ROSE_QUARTZ.get()),
|
||||
RecipeCategory.BUILDING_BLOCKS, c::get, 2))
|
||||
.simpleItem()
|
||||
.register();
|
||||
|
||||
|
@ -2078,18 +2081,21 @@ public class AllBlocks {
|
|||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("palettes/small_rose_quartz_tiles"))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.POLISHED_ROSE_QUARTZ), c::get, 2))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(AllItems.POLISHED_ROSE_QUARTZ.get()),
|
||||
RecipeCategory.BUILDING_BLOCKS, c::get, 2))
|
||||
.simpleItem()
|
||||
.register();
|
||||
|
||||
public static final CopperBlockSet COPPER_SHINGLES = new CopperBlockSet(REGISTRATE, "copper_shingles",
|
||||
"copper_roof_top", CopperBlockSet.DEFAULT_VARIANTS, (c, p) -> {
|
||||
p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("plates/copper")), c::get, 2);
|
||||
p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("plates/copper")), RecipeCategory.BUILDING_BLOCKS,
|
||||
c::get, 2);
|
||||
});
|
||||
|
||||
public static final CopperBlockSet COPPER_TILES =
|
||||
new CopperBlockSet(REGISTRATE, "copper_tiles", "copper_roof_top", CopperBlockSet.DEFAULT_VARIANTS, (c, p) -> {
|
||||
p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("plates/copper")), c::get, 2);
|
||||
p.stonecutting(DataIngredient.tag(AllTags.forgeItemTag("plates/copper")), RecipeCategory.BUILDING_BLOCKS,
|
||||
c::get, 2);
|
||||
});
|
||||
|
||||
// Load this class
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.simibubi.create.AllSoundEvents.SoundEntry;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
|
@ -347,15 +348,15 @@ public class AllSoundEvents {
|
|||
|
||||
private static class SoundEntryProvider implements DataProvider {
|
||||
|
||||
private DataGenerator generator;
|
||||
private PackOutput output;
|
||||
|
||||
public SoundEntryProvider(DataGenerator generator) {
|
||||
this.generator = generator;
|
||||
output = generator.getPackOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(CachedOutput cache) throws IOException {
|
||||
generate(generator.getOutputFolder(), cache);
|
||||
public CompletableFuture<?> run(CachedOutput cache) {
|
||||
return generate(output.getOutputFolder(), cache);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -363,23 +364,17 @@ public class AllSoundEvents {
|
|||
return "Create's Custom Sounds";
|
||||
}
|
||||
|
||||
public void generate(Path path, CachedOutput cache) {
|
||||
public CompletableFuture<?> generate(Path path, CachedOutput cache) {
|
||||
path = path.resolve("assets/create");
|
||||
|
||||
try {
|
||||
JsonObject json = new JsonObject();
|
||||
ALL.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.forEach(entry -> {
|
||||
entry.getValue()
|
||||
.write(json);
|
||||
});
|
||||
DataProvider.saveStable(cache, json, path.resolve("sounds.json"));
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JsonObject json = new JsonObject();
|
||||
ALL.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.forEach(entry -> {
|
||||
entry.getValue()
|
||||
.write(json);
|
||||
});
|
||||
return DataProvider.saveStable(cache, json, path.resolve("sounds.json"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -443,6 +438,10 @@ public class AllSoundEvents {
|
|||
public SoundEntryBuilder playExisting(SoundEvent event) {
|
||||
return playExisting(event, 1, 1);
|
||||
}
|
||||
|
||||
public SoundEntryBuilder playExisting(Holder<SoundEvent> event) {
|
||||
return playExisting(event::get, 1, 1);
|
||||
}
|
||||
|
||||
public SoundEntry build() {
|
||||
SoundEntry entry =
|
||||
|
@ -561,7 +560,7 @@ public class AllSoundEvents {
|
|||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
for (CompiledSoundEvent compiledEvent : compiledEvents) {
|
||||
ResourceLocation location = compiledEvent.event().getId();
|
||||
helper.register(location, new SoundEvent(location));
|
||||
helper.register(location, SoundEvent.createVariableRangeEvent(location));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -637,7 +636,7 @@ public class AllSoundEvents {
|
|||
@Override
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
ResourceLocation location = event.getId();
|
||||
helper.register(location, new SoundEvent(location));
|
||||
helper.register(location, SoundEvent.createVariableRangeEvent(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.simibubi.create.foundation.worldgen.AllPlacementModifiers;
|
|||
import com.simibubi.create.foundation.worldgen.WorldgenDataProvider;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
|
@ -155,16 +156,17 @@ public class Create {
|
|||
public static void gatherData(GatherDataEvent event) {
|
||||
TagGen.datagen();
|
||||
DataGenerator gen = event.getGenerator();
|
||||
PackOutput output = gen.getPackOutput();
|
||||
if (event.includeClient()) {
|
||||
gen.addProvider(true, new LangMerger(gen, ID, "Create", AllLangPartials.values()));
|
||||
gen.addProvider(true, AllSoundEvents.provider(gen));
|
||||
}
|
||||
if (event.includeServer()) {
|
||||
gen.addProvider(true, new AllAdvancements(gen));
|
||||
gen.addProvider(true, new StandardRecipeGen(gen));
|
||||
gen.addProvider(true, new MechanicalCraftingRecipeGen(gen));
|
||||
gen.addProvider(true, new SequencedAssemblyRecipeGen(gen));
|
||||
ProcessingRecipeGen.registerAll(gen);
|
||||
gen.addProvider(true, new AllAdvancements(output));
|
||||
gen.addProvider(true, new StandardRecipeGen(output));
|
||||
gen.addProvider(true, new MechanicalCraftingRecipeGen(output));
|
||||
gen.addProvider(true, new SequencedAssemblyRecipeGen(output));
|
||||
ProcessingRecipeGen.registerAll(gen, output);
|
||||
gen.addProvider(true, WorldgenDataProvider.makeFactory(event.getLookupProvider()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.item.DyeColor;
|
|||
import net.minecraft.world.item.DyeItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.CraftingBookCategory;
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.ShapelessRecipe;
|
||||
|
@ -43,7 +44,7 @@ public final class ToolboxColoringRecipeMaker {
|
|||
.get();
|
||||
ItemStack output = new ItemStack(coloredShulkerBox);
|
||||
ResourceLocation id = Create.asResource(group + "." + output.getDescriptionId());
|
||||
return new ShapelessRecipe(id, group, output, inputs);
|
||||
return new ShapelessRecipe(id, group, CraftingBookCategory.MISC, output, inputs);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.CraftingBookCategory;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
|
@ -21,7 +22,7 @@ public class MechanicalCraftingRecipe extends ShapedRecipe {
|
|||
|
||||
public MechanicalCraftingRecipe(ResourceLocation idIn, String groupIn, int recipeWidthIn, int recipeHeightIn,
|
||||
NonNullList<Ingredient> recipeItemsIn, ItemStack recipeOutputIn, boolean acceptMirrored) {
|
||||
super(idIn, groupIn, recipeWidthIn, recipeHeightIn, recipeItemsIn, recipeOutputIn);
|
||||
super(idIn, groupIn, CraftingBookCategory.MISC, recipeWidthIn, recipeHeightIn, recipeItemsIn, recipeOutputIn);
|
||||
this.acceptMirrored = acceptMirrored;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public class WhistleBlock extends Block implements ITE<WhistleTileEntity>, IWren
|
|||
for (int i = 1; i <= 6; i++) {
|
||||
BlockState blockState = pLevel.getBlockState(currentPos);
|
||||
float pVolume = (soundtype.getVolume() + 1.0F) / 2.0F;
|
||||
SoundEvent growSound = SoundEvents.NOTE_BLOCK_XYLOPHONE;
|
||||
SoundEvent growSound = SoundEvents.NOTE_BLOCK_XYLOPHONE.get();
|
||||
SoundEvent hitSound = soundtype.getHitSound();
|
||||
|
||||
if (AllBlocks.STEAM_WHISTLE_EXTENSION.has(blockState)) {
|
||||
|
|
|
@ -9,6 +9,8 @@ import com.simibubi.create.foundation.block.ITE;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -51,7 +53,7 @@ public class SlidingDoorBlock extends DoorBlock implements IWrenchable, ITE<Slid
|
|||
public static final BooleanProperty VISIBLE = BooleanProperty.create("visible");
|
||||
|
||||
public SlidingDoorBlock(Properties p_52737_) {
|
||||
super(p_52737_);
|
||||
super(p_52737_, SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +138,7 @@ public class SlidingDoorBlock extends DoorBlock implements IWrenchable, ITE<Slid
|
|||
if (isDoubleDoor(changedState, hinge, facing, otherDoor))
|
||||
setOpen(entity, level, otherDoor, otherPos, open);
|
||||
|
||||
this.playSound(level, pos, open);
|
||||
this.playSound(entity, level, pos, open);
|
||||
level.gameEvent(entity, open ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos);
|
||||
}
|
||||
|
||||
|
@ -160,7 +162,7 @@ public class SlidingDoorBlock extends DoorBlock implements IWrenchable, ITE<Slid
|
|||
changedState = changedState.setValue(VISIBLE, false);
|
||||
|
||||
if (isPowered != pState.getValue(OPEN)) {
|
||||
this.playSound(pLevel, pPos, isPowered);
|
||||
this.playSound(null, pLevel, pPos, isPowered);
|
||||
pLevel.gameEvent(null, isPowered ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pPos);
|
||||
|
||||
DoorHingeSide hinge = changedState.getValue(HINGE);
|
||||
|
@ -215,7 +217,7 @@ public class SlidingDoorBlock extends DoorBlock implements IWrenchable, ITE<Slid
|
|||
if (isDoubleDoor(pState, hinge, facing, otherDoor))
|
||||
use(otherDoor, pLevel, otherPos, pPlayer, pHand, pHit);
|
||||
else if (pState.getValue(OPEN))
|
||||
pLevel.levelEvent(pPlayer, getOpenSound(), pPos, 0);
|
||||
pLevel.gameEvent(pPlayer, GameEvent.BLOCK_OPEN, pPos);
|
||||
|
||||
return InteractionResult.sidedSuccess(pLevel.isClientSide);
|
||||
}
|
||||
|
@ -235,13 +237,10 @@ public class SlidingDoorBlock extends DoorBlock implements IWrenchable, ITE<Slid
|
|||
return pState.getValue(VISIBLE) ? RenderShape.MODEL : RenderShape.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
private void playSound(Level pLevel, BlockPos pPos, boolean pIsOpening) {
|
||||
if (pIsOpening)
|
||||
pLevel.levelEvent((Player) null, this.getOpenSound(), pPos, 0);
|
||||
}
|
||||
|
||||
private int getOpenSound() {
|
||||
return 1005;
|
||||
private void playSound(@Nullable Entity pSource, Level pLevel, BlockPos pPos, boolean pIsOpening) {
|
||||
pLevel.playSound(pSource, pPos, pIsOpening ? SoundEvents.IRON_DOOR_OPEN : SoundEvents.IRON_DOOR_CLOSE,
|
||||
SoundSource.BLOCKS, 1.0F, pLevel.getRandom()
|
||||
.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -18,7 +19,7 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
public class TrainTrapdoorBlock extends TrapDoorBlock implements IWrenchable {
|
||||
|
||||
public TrainTrapdoorBlock(Properties p_57526_) {
|
||||
super(p_57526_);
|
||||
super(p_57526_, SoundEvents.IRON_TRAPDOOR_CLOSE, SoundEvents.IRON_TRAPDOOR_OPEN);
|
||||
}
|
||||
|
||||
public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand,
|
||||
|
|
|
@ -135,7 +135,8 @@ public class ArrivalSoundQueue {
|
|||
if (state.getBlock() instanceof NoteBlock nb) {
|
||||
float f = (float) Math.pow(2, (state.getValue(NoteBlock.NOTE) - 12) / 12.0);
|
||||
playSimple(entity, state.getValue(NoteBlock.INSTRUMENT)
|
||||
.getSoundEvent(), 1, f);
|
||||
.getSoundEvent()
|
||||
.get(), 1, f);
|
||||
}
|
||||
|
||||
if (state.getBlock() instanceof WhistleBlock && info.nbt != null) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.tterrag.registrate.util.DataIngredient;
|
|||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -41,7 +42,8 @@ public class AllPaletteBlocks {
|
|||
public static final BlockEntry<GlassBlock> TILED_GLASS = REGISTRATE.block("tiled_glass", GlassBlock::new)
|
||||
.initialProperties(() -> Blocks.GLASS)
|
||||
.addLayer(() -> RenderType::cutout)
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(Tags.Items.GLASS_COLORLESS), c::get))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(Tags.Items.GLASS_COLORLESS), RecipeCategory.BUILDING_BLOCKS,
|
||||
c::get))
|
||||
.blockstate((c, p) -> BlockStateGen.cubeAll(c, p, "palettes/"))
|
||||
.tag(Tags.Blocks.GLASS_COLORLESS, BlockTags.IMPERMEABLE)
|
||||
.item()
|
||||
|
|
|
@ -13,11 +13,11 @@ import com.tterrag.registrate.builders.ItemBuilder;
|
|||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.providers.RegistrateRecipeProvider;
|
||||
import com.tterrag.registrate.providers.loot.RegistrateBlockLootTables;
|
||||
import com.tterrag.registrate.util.DataIngredient;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonnullType;
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -133,9 +133,10 @@ public abstract class PaletteBlockPartial<B extends Block> {
|
|||
@Override
|
||||
protected void createRecipes(AllPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p) {
|
||||
p.stairs(DataIngredient.items(patternBlock), c::get, c.getName(), false);
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), c::get, 1);
|
||||
p.stonecutting(DataIngredient.items(type.getBaseBlock()), c::get, 1);
|
||||
RecipeCategory category = RecipeCategory.BUILDING_BLOCKS;
|
||||
p.stairs(DataIngredient.items(patternBlock.get()), category, c::get, c.getName(), false);
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), category, c::get, 1);
|
||||
p.stonecutting(DataIngredient.items(type.getBaseBlock()), category, c::get, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -196,11 +197,12 @@ public abstract class PaletteBlockPartial<B extends Block> {
|
|||
@Override
|
||||
protected void createRecipes(AllPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p) {
|
||||
p.slab(DataIngredient.items(patternBlock), c::get, c.getName(), false);
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), c::get, 2);
|
||||
p.stonecutting(DataIngredient.items(type.getBaseBlock()), c::get, 2);
|
||||
RecipeCategory category = RecipeCategory.BUILDING_BLOCKS;
|
||||
p.slab(DataIngredient.items(patternBlock.get()), category, c::get, c.getName(), false);
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), category, c::get, 2);
|
||||
p.stonecutting(DataIngredient.items(type.getBaseBlock()), category, c::get, 2);
|
||||
DataIngredient ingredient = DataIngredient.items(c.get());
|
||||
ShapelessRecipeBuilder.shapeless(patternBlock.get())
|
||||
ShapelessRecipeBuilder.shapeless(category, patternBlock.get())
|
||||
.requires(ingredient)
|
||||
.requires(ingredient)
|
||||
.unlockedBy("has_" + c.getName(), ingredient.getCritereon(p))
|
||||
|
@ -210,7 +212,7 @@ public abstract class PaletteBlockPartial<B extends Block> {
|
|||
@Override
|
||||
protected BlockBuilder<SlabBlock, CreateRegistrate> transformBlock(
|
||||
BlockBuilder<SlabBlock, CreateRegistrate> builder, String variantName, PaletteBlockPattern pattern) {
|
||||
builder.loot((lt, block) -> lt.add(block, RegistrateBlockLootTables.createSlabItemTable(block)));
|
||||
builder.loot((lt, block) -> lt.add(block, lt.createSlabItemTable(block)));
|
||||
return super.transformBlock(builder, variantName, pattern);
|
||||
}
|
||||
|
||||
|
@ -254,10 +256,11 @@ public abstract class PaletteBlockPartial<B extends Block> {
|
|||
@Override
|
||||
protected void createRecipes(AllPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p) {
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), c::get, 1);
|
||||
p.stonecutting(DataIngredient.items(type.getBaseBlock()), c::get, 1);
|
||||
DataIngredient ingredient = DataIngredient.items(patternBlock);
|
||||
ShapedRecipeBuilder.shaped(c.get(), 6)
|
||||
RecipeCategory category = RecipeCategory.BUILDING_BLOCKS;
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), category, c::get, 1);
|
||||
p.stonecutting(DataIngredient.items(type.getBaseBlock()), category, c::get, 1);
|
||||
DataIngredient ingredient = DataIngredient.items(patternBlock.get());
|
||||
ShapedRecipeBuilder.shaped(category, c.get(), 6)
|
||||
.pattern("XXX")
|
||||
.pattern("XXX")
|
||||
.define('X', ingredient)
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
|||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -129,7 +130,7 @@ public class PaletteBlockPattern {
|
|||
|
||||
public void addRecipes(NonNullSupplier<Block> baseBlock, DataGenContext<Block, ? extends Block> c,
|
||||
RegistrateRecipeProvider p) {
|
||||
p.stonecutting(DataIngredient.items(baseBlock), c::get);
|
||||
p.stonecutting(DataIngredient.items(baseBlock), RecipeCategory.BUILDING_BLOCKS, c::get);
|
||||
additionalRecipes.apply(baseBlock)
|
||||
.accept(c, p);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.tterrag.registrate.util.entry.BlockEntry;
|
|||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -55,7 +56,7 @@ public class PalettesVariantEntry {
|
|||
.ifPresent(b -> builder.onRegister(connectedTextures(b)));
|
||||
|
||||
builder.recipe((c, p) -> {
|
||||
p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), c);
|
||||
p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), RecipeCategory.BUILDING_BLOCKS, c);
|
||||
pattern.addRecipes(baseBlock, c, p);
|
||||
});
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.sounds.SoundSource;
|
|||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -210,6 +211,15 @@ public class SchematicChunkSource extends ChunkSource {
|
|||
public LevelTickAccess<Fluid> getFluidTicks() {
|
||||
return BlackholeTickAccess.emptyLevelList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureFlagSet enabledFeatures() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player pPlayer, double pX, double pY, double pZ, Holder<SoundEvent> pSound,
|
||||
SoundSource pSource, float pVolume, float pPitch, long pSeed) {}
|
||||
}
|
||||
|
||||
private static final DummyLevel DUMMY_LEVEL = new DummyLevel(null, null, RegistryAccess.BUILTIN.get()
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.foundation.utility.BlockHelper;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
|
@ -89,7 +90,8 @@ public class SchematicPrinter {
|
|||
if (!blueprint.hasTag() || !blueprint.getTag().getBoolean("Deployed"))
|
||||
return;
|
||||
|
||||
StructureTemplate activeTemplate = SchematicItem.loadSchematic(blueprint);
|
||||
StructureTemplate activeTemplate =
|
||||
SchematicItem.loadSchematic(originalWorld.holderLookup(Registries.BLOCK), blueprint);
|
||||
StructurePlaceSettings settings = SchematicItem.getSettings(blueprint, processNBT);
|
||||
|
||||
schematicAnchor = NbtUtils.readBlockPos(blueprint.getTag()
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.client.player.LocalPlayer;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
@ -145,12 +146,13 @@ public class SchematicHandler {
|
|||
}
|
||||
|
||||
private void setupRenderer() {
|
||||
StructureTemplate schematic = SchematicItem.loadSchematic(activeSchematicItem);
|
||||
Level clientWorld = Minecraft.getInstance().level;
|
||||
StructureTemplate schematic =
|
||||
SchematicItem.loadSchematic(clientWorld.holderLookup(Registries.BLOCK), activeSchematicItem);
|
||||
Vec3i size = schematic.getSize();
|
||||
if (size.equals(Vec3i.ZERO))
|
||||
return;
|
||||
|
||||
Level clientWorld = Minecraft.getInstance().level;
|
||||
SchematicWorld w = new SchematicWorld(clientWorld);
|
||||
SchematicWorld wMirroredFB = new SchematicWorld(clientWorld);
|
||||
SchematicWorld wMirroredLR = new SchematicWorld(clientWorld);
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.foundation.utility.WorldAttached;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -53,7 +54,8 @@ public class SchematicInstances {
|
|||
.getBoolean("Deployed"))
|
||||
return null;
|
||||
|
||||
StructureTemplate activeTemplate = SchematicItem.loadSchematic(schematic);
|
||||
StructureTemplate activeTemplate =
|
||||
SchematicItem.loadSchematic(wrapped.holderLookup(Registries.BLOCK), schematic);
|
||||
|
||||
if (activeTemplate.getSize()
|
||||
.equals(Vec3i.ZERO))
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.simibubi.create.foundation.utility.NBTHelper;
|
|||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderGetter;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtAccounter;
|
||||
|
@ -42,6 +43,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
|
@ -59,7 +61,7 @@ public class SchematicItem extends Item {
|
|||
super(properties);
|
||||
}
|
||||
|
||||
public static ItemStack create(String schematic, String owner) {
|
||||
public static ItemStack create(HolderGetter<Block> lookup, String schematic, String owner) {
|
||||
ItemStack blueprint = AllItems.SCHEMATIC.asStack();
|
||||
|
||||
CompoundTag tag = new CompoundTag();
|
||||
|
@ -71,7 +73,7 @@ public class SchematicItem extends Item {
|
|||
tag.putString("Mirror", Mirror.NONE.name());
|
||||
blueprint.setTag(tag);
|
||||
|
||||
writeSize(blueprint);
|
||||
writeSize(lookup, blueprint);
|
||||
return blueprint;
|
||||
}
|
||||
|
||||
|
@ -92,9 +94,9 @@ public class SchematicItem extends Item {
|
|||
super.appendHoverText(stack, worldIn, tooltip, flagIn);
|
||||
}
|
||||
|
||||
public static void writeSize(ItemStack blueprint) {
|
||||
public static void writeSize(HolderGetter<Block> lookup, ItemStack blueprint) {
|
||||
CompoundTag tag = blueprint.getTag();
|
||||
StructureTemplate t = loadSchematic(blueprint);
|
||||
StructureTemplate t = loadSchematic(lookup, blueprint);
|
||||
tag.put("Bounds", NBTHelper.writeVec3i(t.getSize()));
|
||||
blueprint.setTag(tag);
|
||||
SchematicInstances.clearHash(blueprint);
|
||||
|
@ -114,7 +116,7 @@ public class SchematicItem extends Item {
|
|||
return settings;
|
||||
}
|
||||
|
||||
public static StructureTemplate loadSchematic(ItemStack blueprint) {
|
||||
public static StructureTemplate loadSchematic(HolderGetter<Block> lookup, ItemStack blueprint) {
|
||||
StructureTemplate t = new StructureTemplate();
|
||||
String owner = blueprint.getTag()
|
||||
.getString("Owner");
|
||||
|
@ -142,7 +144,7 @@ public class SchematicItem extends Item {
|
|||
try (DataInputStream stream = new DataInputStream(new BufferedInputStream(
|
||||
new GZIPInputStream(Files.newInputStream(path, StandardOpenOption.READ))))) {
|
||||
CompoundTag nbt = NbtIo.read(stream, new NbtAccounter(0x20000000L));
|
||||
t.load(nbt);
|
||||
t.load(lookup, nbt);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("Failed to read schematic", e);
|
||||
}
|
||||
|
|
|
@ -5,19 +5,16 @@ import static com.simibubi.create.foundation.advancement.CreateAdvancement.TaskT
|
|||
import static com.simibubi.create.foundation.advancement.CreateAdvancement.TaskType.SECRET;
|
||||
import static com.simibubi.create.foundation.advancement.CreateAdvancement.TaskType.SILENT;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.AllItems;
|
||||
|
@ -25,8 +22,9 @@ import com.simibubi.create.foundation.advancement.CreateAdvancement.Builder;
|
|||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.PackOutput.PathProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -616,41 +614,31 @@ public class AllAdvancements implements DataProvider {
|
|||
|
||||
// Datagen
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final DataGenerator generator;
|
||||
private final PackOutput output;
|
||||
|
||||
public AllAdvancements(DataGenerator generatorIn) {
|
||||
this.generator = generatorIn;
|
||||
public AllAdvancements(PackOutput output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(CachedOutput cache) throws IOException {
|
||||
Path path = this.generator.getOutputFolder();
|
||||
public CompletableFuture<?> run(CachedOutput cache) {
|
||||
PathProvider pathProvider = output.createPathProvider(PackOutput.Target.DATA_PACK, "advancements");
|
||||
List<CompletableFuture<?>> futures = new ArrayList<>();
|
||||
|
||||
Set<ResourceLocation> set = Sets.newHashSet();
|
||||
Consumer<Advancement> consumer = (p_204017_3_) -> {
|
||||
if (!set.add(p_204017_3_.getId()))
|
||||
throw new IllegalStateException("Duplicate advancement " + p_204017_3_.getId());
|
||||
|
||||
Path path1 = getPath(path, p_204017_3_);
|
||||
|
||||
try {
|
||||
DataProvider.saveStable(cache, p_204017_3_.deconstruct()
|
||||
.serializeToJson(), path1);
|
||||
} catch (IOException ioexception) {
|
||||
LOGGER.error("Couldn't save advancement {}", path1, ioexception);
|
||||
}
|
||||
Consumer<Advancement> consumer = (advancement) -> {
|
||||
ResourceLocation id = advancement.getId();
|
||||
if (!set.add(id))
|
||||
throw new IllegalStateException("Duplicate advancement " + id);
|
||||
Path path = pathProvider.json(id);
|
||||
futures.add(DataProvider.saveStable(cache, advancement.deconstruct()
|
||||
.serializeToJson(), path));
|
||||
};
|
||||
|
||||
for (CreateAdvancement advancement : ENTRIES)
|
||||
advancement.save(consumer);
|
||||
}
|
||||
|
||||
private static Path getPath(Path pathIn, Advancement advancementIn) {
|
||||
return pathIn.resolve("data/" + advancementIn.getId()
|
||||
.getNamespace() + "/advancements/"
|
||||
+ advancementIn.getId()
|
||||
.getPath()
|
||||
+ ".json");
|
||||
return CompletableFuture.allOf(futures.toArray((entry) -> new CompletableFuture[entry]));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.tterrag.registrate.util.entry.BlockEntry;
|
|||
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -136,7 +137,7 @@ public class CopperBlockSet {
|
|||
if (waxed) {
|
||||
builder.recipe((ctx, prov) -> {
|
||||
Block unwaxed = get(variant, state, false).get();
|
||||
ShapelessRecipeBuilder.shapeless(ctx.get())
|
||||
ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ctx.get())
|
||||
.requires(unwaxed)
|
||||
.requires(Items.HONEYCOMB)
|
||||
.unlockedBy("has_unwaxed", RegistrateRecipeProvider.has(unwaxed))
|
||||
|
@ -273,7 +274,7 @@ public class CopperBlockSet {
|
|||
@Override
|
||||
public void generateLootTable(RegistrateBlockLootTables lootTable, SlabBlock block, CopperBlockSet blocks,
|
||||
WeatherState state, boolean waxed) {
|
||||
lootTable.add(block, RegistrateBlockLootTables.createSlabItemTable(block));
|
||||
lootTable.add(block, lootTable.createSlabItemTable(block));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -292,7 +293,7 @@ public class CopperBlockSet {
|
|||
@Override
|
||||
public void generateRecipes(BlockEntry<?> blockVariant, DataGenContext<Block, SlabBlock> ctx,
|
||||
RegistrateRecipeProvider prov) {
|
||||
prov.slab(DataIngredient.items(blockVariant.get()), ctx::get, null, true);
|
||||
prov.slab(DataIngredient.items(blockVariant.get()), RecipeCategory.BUILDING_BLOCKS, ctx::get, null, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,7 +347,7 @@ public class CopperBlockSet {
|
|||
@Override
|
||||
public void generateRecipes(BlockEntry<?> blockVariant, DataGenContext<Block, StairBlock> ctx,
|
||||
RegistrateRecipeProvider prov) {
|
||||
prov.stairs(DataIngredient.items(blockVariant.get()), ctx::get, null, true);
|
||||
prov.stairs(DataIngredient.items(blockVariant.get()), RecipeCategory.BUILDING_BLOCKS, ctx::get, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,8 +136,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
|
|||
|
||||
String command = change.annotations.get("Execute");
|
||||
if (minecraft.player != null && command != null && command.startsWith("/")) {
|
||||
minecraft.player.commandSigned(command.substring(1), null);
|
||||
//AllPackets.channel.sendToServer(new CChatMessagePacket(command));
|
||||
minecraft.player.connection.sendCommand(command.substring(1));
|
||||
}
|
||||
});
|
||||
clearChanges();
|
||||
|
|
|
@ -47,7 +47,7 @@ import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
|||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.data.loot.BlockLoot;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
|
@ -126,7 +126,7 @@ public class BuilderTransformers {
|
|||
.tag(BlockTags.DOORS)
|
||||
.tag(BlockTags.WOODEN_DOORS) // for villager AI
|
||||
.tag(AllBlockTags.NON_DOUBLE_DOOR.tag)
|
||||
.loot((lr, block) -> lr.add(block, BlockLoot.createDoorTable(block)))
|
||||
.loot((lr, block) -> lr.add(block, lr.createDoorTable(block)))
|
||||
.item()
|
||||
.tag(ItemTags.DOORS)
|
||||
.model((c, p) -> p.blockSprite(c, p.modLoc("item/" + type + "_door")))
|
||||
|
@ -206,7 +206,7 @@ public class BuilderTransformers {
|
|||
.recipe((c, p) -> {
|
||||
if (name.equals("andesite"))
|
||||
return;
|
||||
p.stonecutting(ingredient.get(), c::get, 2);
|
||||
p.stonecutting(ingredient.get(), RecipeCategory.DECORATIONS, c::get, 2);
|
||||
})
|
||||
.model((c, p) -> p.blockSprite(c::get, p.modLoc("block/ladder_" + name)))
|
||||
.build();
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
|
@ -24,9 +25,12 @@ import com.google.gson.JsonObject;
|
|||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.ponder.PonderScene;
|
||||
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
|
||||
public class LangMerger implements DataProvider {
|
||||
|
@ -73,15 +77,24 @@ public class LangMerger implements DataProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(CachedOutput cache) throws IOException {
|
||||
Path path = this.gen.getOutputFolder()
|
||||
.resolve("assets/" + modid + "/lang/" + "en_us.json");
|
||||
public CompletableFuture<?> run(CachedOutput cache) {
|
||||
Path path = this.gen.getPackOutput()
|
||||
.createPathProvider(PackOutput.Target.RESOURCE_PACK, "lang")
|
||||
.json(new ResourceLocation(modid, "en_us"));
|
||||
|
||||
collectExistingEntries(path);
|
||||
collectEntries();
|
||||
if (mergedLangData.isEmpty())
|
||||
return;
|
||||
save(cache, mergedLangData, path, "Merging en_us.json with hand-written lang entries...");
|
||||
return CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
collectExistingEntries(path);
|
||||
collectEntries();
|
||||
if (mergedLangData.isEmpty())
|
||||
return;
|
||||
save(cache, mergedLangData, path, "Merging en_us.json with hand-written lang entries...");
|
||||
|
||||
} catch (IOException ioexception) {
|
||||
LOGGER.error("Failed to run LangMerger", ioexception);
|
||||
}
|
||||
|
||||
}, Util.backgroundExecutor());
|
||||
}
|
||||
|
||||
private void collectExistingEntries(Path path) throws IOException {
|
||||
|
@ -180,8 +193,7 @@ public class LangMerger implements DataProvider {
|
|||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void save(CachedOutput cache, List<Object> dataIn, Path target, String message)
|
||||
throws IOException {
|
||||
private void save(CachedOutput cache, List<Object> dataIn, Path target, String message) throws IOException {
|
||||
|
||||
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
|
||||
HashingOutputStream hashingoutputstream = new HashingOutputStream(Hashing.sha1(), bytearrayoutputstream);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.simibubi.create.foundation.data;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.AllTags.AllBlockTags;
|
||||
import com.simibubi.create.AllTags.AllFluidTags;
|
||||
|
@ -12,9 +15,14 @@ import com.tterrag.registrate.providers.ProviderType;
|
|||
import com.tterrag.registrate.providers.RegistrateTagsProvider;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.tags.TagsProvider;
|
||||
import net.minecraft.data.tags.TagsProvider.TagAppender;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagBuilder;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -68,7 +76,9 @@ public class TagGen {
|
|||
Create.REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, TagGen::genFluidTags);
|
||||
}
|
||||
|
||||
private static void genBlockTags(RegistrateTagsProvider<Block> prov) {
|
||||
private static void genBlockTags(RegistrateTagsProvider<Block> provIn) {
|
||||
CreateTagsProvider<Block> prov = new CreateTagsProvider<>(provIn, Block::builtInRegistryHolder);
|
||||
|
||||
prov.tag(AllBlockTags.BRITTLE.tag)
|
||||
.add(Blocks.BELL, Blocks.COCOA, Blocks.FLOWER_POT)
|
||||
.addTag(BlockTags.BEDS)
|
||||
|
@ -127,7 +137,9 @@ public class TagGen {
|
|||
}
|
||||
}
|
||||
|
||||
private static void genItemTags(RegistrateTagsProvider<Item> prov) {
|
||||
private static void genItemTags(RegistrateTagsProvider<Item> provIn) {
|
||||
CreateTagsProvider<Item> prov = new CreateTagsProvider<>(provIn, Item::builtInRegistryHolder);
|
||||
|
||||
prov.tag(AllItemTags.SLEEPERS.tag)
|
||||
.add(Items.STONE_SLAB, Items.SMOOTH_STONE_SLAB, Items.ANDESITE_SLAB);
|
||||
|
||||
|
@ -175,7 +187,7 @@ public class TagGen {
|
|||
}
|
||||
}
|
||||
|
||||
private static void genStrippedWood(RegistrateTagsProvider<Item> prov) {
|
||||
private static void genStrippedWood(CreateTagsProvider<Item> prov) {
|
||||
TagAppender<Item> logAppender = prov.tag(AllItemTags.MODDED_STRIPPED_LOGS.tag);
|
||||
TagAppender<Item> woodAppender = prov.tag(AllItemTags.MODDED_STRIPPED_WOOD.tag);
|
||||
StrippedWoodHelper helper = new StrippedWoodHelper(logAppender, woodAppender);
|
||||
|
@ -204,7 +216,9 @@ public class TagGen {
|
|||
addOptional(woodAppender, Mods.BYG, "stripped_bulbis_wood");
|
||||
}
|
||||
|
||||
private static void genFluidTags(RegistrateTagsProvider<Fluid> prov) {
|
||||
private static void genFluidTags(RegistrateTagsProvider<Fluid> provIn) {
|
||||
CreateTagsProvider<Fluid> prov = new CreateTagsProvider<>(provIn, Fluid::builtInRegistryHolder);
|
||||
|
||||
prov.tag(AllFluidTags.BOTTOMLESS_ALLOW.tag)
|
||||
.add(Fluids.WATER, Fluids.LAVA);
|
||||
|
||||
|
@ -235,4 +249,50 @@ public class TagGen {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class CreateTagsProvider<T> {
|
||||
|
||||
private RegistrateTagsProvider<T> provider;
|
||||
private Function<T, ResourceKey<T>> keyExtractor;
|
||||
|
||||
public CreateTagsProvider(RegistrateTagsProvider<T> provider, Function<T, Holder.Reference<T>> refExtractor) {
|
||||
this.provider = provider;
|
||||
this.keyExtractor = refExtractor.andThen(Holder.Reference::key);
|
||||
}
|
||||
|
||||
public CreateTagAppender<T> tag(TagKey<T> tag) {
|
||||
TagBuilder tagbuilder = provider.getOrCreateRawBuilder(tag);
|
||||
return new CreateTagAppender<>(tagbuilder, keyExtractor, Create.ID);
|
||||
}
|
||||
|
||||
public TagBuilder getOrCreateRawBuilder(TagKey<T> tag) {
|
||||
return provider.getOrCreateRawBuilder(tag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class CreateTagAppender<T> extends TagsProvider.TagAppender<T> {
|
||||
|
||||
private Function<T, ResourceKey<T>> keyExtractor;
|
||||
|
||||
public CreateTagAppender(TagBuilder pBuilder, Function<T, ResourceKey<T>> pKeyExtractor, String modId) {
|
||||
super(pBuilder, modId);
|
||||
this.keyExtractor = pKeyExtractor;
|
||||
}
|
||||
|
||||
public CreateTagAppender<T> add(T entry) {
|
||||
this.add(this.keyExtractor.apply(entry));
|
||||
return this;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final CreateTagAppender<T> add(T... entries) {
|
||||
Stream.<T>of(entries)
|
||||
.map(this.keyExtractor)
|
||||
.forEach(this::add);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.tterrag.registrate.util.nullness.NonNullFunction;
|
|||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -90,7 +91,7 @@ public class WindowGen {
|
|||
return REGISTRATE.block(name, p -> new WindowBlock(p, translucent))
|
||||
.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(ct.get())))
|
||||
.addLayer(renderType)
|
||||
.recipe((c, p) -> ShapedRecipeBuilder.shaped(c.get(), 2)
|
||||
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get(), 2)
|
||||
.pattern(" # ")
|
||||
.pattern("#X#")
|
||||
.define('#', ingredient.get())
|
||||
|
@ -116,7 +117,8 @@ public class WindowGen {
|
|||
.initialProperties(() -> Blocks.GLASS)
|
||||
.properties(WindowGen::glassProperties)
|
||||
.loot((t, g) -> t.dropWhenSilkTouch(g))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(Tags.Items.GLASS_COLORLESS), c::get))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.tag(Tags.Items.GLASS_COLORLESS),
|
||||
RecipeCategory.BUILDING_BLOCKS, c::get))
|
||||
.blockstate((c, p) -> BlockStateGen.cubeAll(c, p, "palettes/", "framed_glass"))
|
||||
.tag(Tags.Blocks.GLASS_COLORLESS, BlockTags.IMPERMEABLE)
|
||||
.item()
|
||||
|
@ -210,7 +212,7 @@ public class WindowGen {
|
|||
.properties(p -> p.color(parent.get()
|
||||
.defaultMaterialColor()))
|
||||
.blockstate(stateProvider)
|
||||
.recipe((c, p) -> ShapedRecipeBuilder.shaped(c.get(), 16)
|
||||
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get(), 16)
|
||||
.pattern("###")
|
||||
.pattern("###")
|
||||
.define('#', parent.get())
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.simibubi.create.AllItems;
|
|||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.AllTags.AllFluidTags;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
@ -46,8 +46,8 @@ public class CompactingRecipeGen extends ProcessingRecipeGen {
|
|||
|
||||
;
|
||||
|
||||
public CompactingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public CompactingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.simibubi.create.AllItems;
|
|||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
|
@ -23,16 +23,18 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
|
||||
protected final List<GeneratedRecipe> all = new ArrayList<>();
|
||||
|
||||
public CreateRecipeProvider(DataGenerator generator) {
|
||||
super(generator);
|
||||
public CreateRecipeProvider(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildCraftingRecipes(Consumer<FinishedRecipe> p_200404_1_) {
|
||||
protected void buildRecipes(Consumer<FinishedRecipe> p_200404_1_) {
|
||||
all.forEach(c -> c.register(p_200404_1_));
|
||||
Create.LOGGER.info(getName() + " registered " + all.size() + " recipe" + (all.size() == 1 ? "" : "s"));
|
||||
Create.LOGGER.info(getProviderName() + " registered " + all.size() + " recipe" + (all.size() == 1 ? "" : "s"));
|
||||
}
|
||||
|
||||
protected abstract String getProviderName();
|
||||
|
||||
protected GeneratedRecipe register(GeneratedRecipe recipe) {
|
||||
all.add(recipe);
|
||||
return recipe;
|
||||
|
@ -115,7 +117,7 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
static TagKey<Item> ironSheet() {
|
||||
return AllTags.forgeItemTag("plates/iron");
|
||||
}
|
||||
|
||||
|
||||
static TagKey<Item> sturdySheet() {
|
||||
return AllTags.forgeItemTag("plates/obsidian");
|
||||
}
|
||||
|
@ -123,7 +125,7 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
static ItemLike brassCasing() {
|
||||
return AllBlocks.BRASS_CASING.get();
|
||||
}
|
||||
|
||||
|
||||
static ItemLike railwayCasing() {
|
||||
return AllBlocks.RAILWAY_CASING.get();
|
||||
}
|
||||
|
@ -135,7 +137,7 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
static ItemLike precisionMechanism() {
|
||||
return AllItems.PRECISION_MECHANISM.get();
|
||||
}
|
||||
|
||||
|
||||
static ItemLike copperBlock() {
|
||||
return Items.COPPER_BLOCK;
|
||||
}
|
||||
|
@ -147,7 +149,7 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
static TagKey<Item> zincBlock() {
|
||||
return AllTags.forgeItemTag("storage_blocks/zinc");
|
||||
}
|
||||
|
||||
|
||||
static TagKey<Item> wheatFlour() {
|
||||
return AllTags.forgeItemTag("flour/wheat");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuild
|
|||
import com.simibubi.create.content.palettes.AllPaletteStoneTypes;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -261,8 +261,8 @@ public class CrushingRecipeGen extends ProcessingRecipeGen {
|
|||
});
|
||||
}
|
||||
|
||||
public CrushingRecipeGen(DataGenerator dataGenerator) {
|
||||
super(dataGenerator);
|
||||
public CrushingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.data.recipe;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
|
@ -145,8 +145,8 @@ public class CuttingRecipeGen extends ProcessingRecipeGen {
|
|||
return null;
|
||||
}
|
||||
|
||||
public CuttingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public CuttingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.AllRecipeTypes;
|
|||
import com.simibubi.create.foundation.block.CopperBlockSet;
|
||||
import com.simibubi.create.foundation.block.CopperBlockSet.Variant;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -64,8 +64,8 @@ public class DeployingRecipeGen extends ProcessingRecipeGen {
|
|||
.output(waxed.get()));
|
||||
}
|
||||
|
||||
public DeployingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public DeployingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.simibubi.create.AllFluids;
|
|||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
|
||||
|
@ -31,8 +31,8 @@ public class EmptyingRecipeGen extends ProcessingRecipeGen {
|
|||
|
||||
;
|
||||
|
||||
public EmptyingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public EmptyingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.AllRecipeTypes;
|
|||
import com.simibubi.create.AllTags.AllFluidTags;
|
||||
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
@ -63,8 +63,8 @@ public class FillingRecipeGen extends ProcessingRecipeGen {
|
|||
|
||||
;
|
||||
|
||||
public FillingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public FillingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.AllRecipeTypes;
|
|||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
@ -59,8 +59,8 @@ public class HauntingRecipeGen extends ProcessingRecipeGen {
|
|||
.output(result.get()));
|
||||
}
|
||||
|
||||
public HauntingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public HauntingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.function.Supplier;
|
|||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.AllTags.AllItemTags;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
@ -38,8 +38,8 @@ public class ItemApplicationRecipeGen extends ProcessingRecipeGen {
|
|||
.output(output.get()));
|
||||
}
|
||||
|
||||
public ItemApplicationRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public ItemApplicationRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.AllItems;
|
|||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
@ -64,7 +64,7 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
|||
|
||||
;
|
||||
|
||||
public MechanicalCraftingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
public MechanicalCraftingRecipeGen(PackOutput p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
protected String getProviderName() {
|
||||
return "Create's Mechanical Crafting Recipes";
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.simibubi.create.AllRecipeTypes;
|
|||
import com.simibubi.create.AllTags;
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -196,10 +196,10 @@ public class MillingRecipeGen extends ProcessingRecipeGen {
|
|||
.output(crushed.get()));
|
||||
}
|
||||
|
||||
public MillingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public MillingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected AllRecipeTypes getRecipeType() {
|
||||
return AllRecipeTypes.MILLING;
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.AllRecipeTypes;
|
|||
import com.simibubi.create.content.contraptions.processing.HeatCondition;
|
||||
import com.simibubi.create.foundation.utility.recipe.BlockTagIngredient;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -65,8 +65,8 @@ public class MixingRecipeGen extends ProcessingRecipeGen {
|
|||
|
||||
;
|
||||
|
||||
public MixingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public MixingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.data.recipe;
|
|||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
|
||||
public class PolishingRecipeGen extends ProcessingRecipeGen {
|
||||
|
||||
|
@ -13,8 +13,8 @@ public class PolishingRecipeGen extends ProcessingRecipeGen {
|
|||
|
||||
;
|
||||
|
||||
public PolishingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public PolishingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.data.recipe;
|
|||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class PressingRecipeGen extends ProcessingRecipeGen {
|
|||
|
||||
;
|
||||
|
||||
public PressingRecipeGen(DataGenerator p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
public PressingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.simibubi.create.foundation.data.recipe;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
|
@ -16,6 +16,7 @@ import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo;
|
|||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
@ -27,20 +28,20 @@ public abstract class ProcessingRecipeGen extends CreateRecipeProvider {
|
|||
protected static final int BUCKET = FluidType.BUCKET_VOLUME;
|
||||
protected static final int BOTTLE = 250;
|
||||
|
||||
public static void registerAll(DataGenerator gen) {
|
||||
GENERATORS.add(new CrushingRecipeGen(gen));
|
||||
GENERATORS.add(new MillingRecipeGen(gen));
|
||||
GENERATORS.add(new CuttingRecipeGen(gen));
|
||||
GENERATORS.add(new WashingRecipeGen(gen));
|
||||
GENERATORS.add(new PolishingRecipeGen(gen));
|
||||
GENERATORS.add(new DeployingRecipeGen(gen));
|
||||
GENERATORS.add(new MixingRecipeGen(gen));
|
||||
GENERATORS.add(new CompactingRecipeGen(gen));
|
||||
GENERATORS.add(new PressingRecipeGen(gen));
|
||||
GENERATORS.add(new FillingRecipeGen(gen));
|
||||
GENERATORS.add(new EmptyingRecipeGen(gen));
|
||||
GENERATORS.add(new HauntingRecipeGen(gen));
|
||||
GENERATORS.add(new ItemApplicationRecipeGen(gen));
|
||||
public static void registerAll(DataGenerator gen, PackOutput output) {
|
||||
GENERATORS.add(new CrushingRecipeGen(output));
|
||||
GENERATORS.add(new MillingRecipeGen(output));
|
||||
GENERATORS.add(new CuttingRecipeGen(output));
|
||||
GENERATORS.add(new WashingRecipeGen(output));
|
||||
GENERATORS.add(new PolishingRecipeGen(output));
|
||||
GENERATORS.add(new DeployingRecipeGen(output));
|
||||
GENERATORS.add(new MixingRecipeGen(output));
|
||||
GENERATORS.add(new CompactingRecipeGen(output));
|
||||
GENERATORS.add(new PressingRecipeGen(output));
|
||||
GENERATORS.add(new FillingRecipeGen(output));
|
||||
GENERATORS.add(new EmptyingRecipeGen(output));
|
||||
GENERATORS.add(new HauntingRecipeGen(output));
|
||||
GENERATORS.add(new ItemApplicationRecipeGen(output));
|
||||
|
||||
gen.addProvider(true, new DataProvider() {
|
||||
|
||||
|
@ -50,19 +51,15 @@ public abstract class ProcessingRecipeGen extends CreateRecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(CachedOutput dc) throws IOException {
|
||||
GENERATORS.forEach(g -> {
|
||||
try {
|
||||
g.run(dc);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
public CompletableFuture<?> run(CachedOutput dc) {
|
||||
return CompletableFuture.allOf(GENERATORS.stream()
|
||||
.map(gen -> gen.run(dc))
|
||||
.toArray(size -> new CompletableFuture[size]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ProcessingRecipeGen(DataGenerator generator) {
|
||||
public ProcessingRecipeGen(PackOutput generator) {
|
||||
super(generator);
|
||||
}
|
||||
|
||||
|
@ -137,7 +134,7 @@ public abstract class ProcessingRecipeGen extends CreateRecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getProviderName() {
|
||||
return "Create's Processing Recipes: " + getRecipeType().getId()
|
||||
.getPath();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.simibubi.create.content.contraptions.components.press.PressingRecipe;
|
|||
import com.simibubi.create.content.contraptions.fluids.actors.FillingRecipe;
|
||||
import com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipeBuilder;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
@ -73,7 +73,7 @@ public class SequencedAssemblyRecipeGen extends CreateRecipeProvider {
|
|||
|
||||
;
|
||||
|
||||
public SequencedAssemblyRecipeGen(DataGenerator p_i48262_1_) {
|
||||
public SequencedAssemblyRecipeGen(PackOutput p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class SequencedAssemblyRecipeGen extends CreateRecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getProviderName() {
|
||||
return "Create's Sequenced Assembly Recipes";
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ import com.tterrag.registrate.util.entry.ItemEntry;
|
|||
import com.tterrag.registrate.util.entry.ItemProviderEntry;
|
||||
|
||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
|
||||
|
@ -46,9 +47,9 @@ import net.minecraft.tags.TagKey;
|
|||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.SimpleCookingSerializer;
|
||||
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -1255,9 +1256,10 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
return this;
|
||||
}
|
||||
|
||||
// FIXME 5.1 refactor - recipe categories as markers instead of sections?
|
||||
GeneratedRecipe viaShaped(UnaryOperator<ShapedRecipeBuilder> builder) {
|
||||
return register(consumer -> {
|
||||
ShapedRecipeBuilder b = builder.apply(ShapedRecipeBuilder.shaped(result.get(), amount));
|
||||
ShapedRecipeBuilder b = builder.apply(ShapedRecipeBuilder.shaped(RecipeCategory.MISC, result.get(), amount));
|
||||
if (unlockedBy != null)
|
||||
b.unlockedBy("has_item", inventoryTrigger(unlockedBy.get()));
|
||||
b.save(consumer, createLocation("crafting"));
|
||||
|
@ -1266,7 +1268,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
|
||||
GeneratedRecipe viaShapeless(UnaryOperator<ShapelessRecipeBuilder> builder) {
|
||||
return register(consumer -> {
|
||||
ShapelessRecipeBuilder b = builder.apply(ShapelessRecipeBuilder.shapeless(result.get(), amount));
|
||||
ShapelessRecipeBuilder b = builder.apply(ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, result.get(), amount));
|
||||
if (unlockedBy != null)
|
||||
b.unlockedBy("has_item", inventoryTrigger(unlockedBy.get()));
|
||||
b.save(consumer, createLocation("crafting"));
|
||||
|
@ -1304,7 +1306,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
private float exp;
|
||||
private int cookingTime;
|
||||
|
||||
private final SimpleCookingSerializer<?> FURNACE = RecipeSerializer.SMELTING_RECIPE,
|
||||
private final RecipeSerializer<? extends AbstractCookingRecipe> FURNACE = RecipeSerializer.SMELTING_RECIPE,
|
||||
SMOKER = RecipeSerializer.SMOKING_RECIPE, BLAST = RecipeSerializer.BLASTING_RECIPE,
|
||||
CAMPFIRE = RecipeSerializer.CAMPFIRE_COOKING_RECIPE;
|
||||
|
||||
|
@ -1351,16 +1353,18 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
return create(BLAST, builder, .5f);
|
||||
}
|
||||
|
||||
private GeneratedRecipe create(SimpleCookingSerializer<?> serializer,
|
||||
private GeneratedRecipe create(RecipeSerializer<? extends AbstractCookingRecipe> serializer,
|
||||
UnaryOperator<SimpleCookingRecipeBuilder> builder, float cookingTimeModifier) {
|
||||
return register(consumer -> {
|
||||
boolean isOtherMod = compatDatagenOutput != null;
|
||||
|
||||
SimpleCookingRecipeBuilder b = builder.apply(
|
||||
SimpleCookingRecipeBuilder.cooking(ingredient.get(), isOtherMod ? Items.DIRT : result.get(),
|
||||
exp, (int) (cookingTime * cookingTimeModifier), serializer));
|
||||
SimpleCookingRecipeBuilder b = builder.apply(SimpleCookingRecipeBuilder.generic(ingredient.get(),
|
||||
RecipeCategory.MISC, isOtherMod ? Items.DIRT : result.get(), exp,
|
||||
(int) (cookingTime * cookingTimeModifier), serializer));
|
||||
|
||||
if (unlockedBy != null)
|
||||
b.unlockedBy("has_item", inventoryTrigger(unlockedBy.get()));
|
||||
|
||||
b.save(result -> {
|
||||
consumer.accept(
|
||||
isOtherMod ? new ModdedCookingRecipeResult(result, compatDatagenOutput, recipeConditions)
|
||||
|
@ -1373,11 +1377,11 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getProviderName() {
|
||||
return "Create's Standard Recipes";
|
||||
}
|
||||
|
||||
public StandardRecipeGen(DataGenerator p_i48262_1_) {
|
||||
public StandardRecipeGen(PackOutput p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.simibubi.create.AllItems;
|
|||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -109,8 +109,8 @@ public class WashingRecipeGen extends ProcessingRecipeGen {
|
|||
return null;
|
||||
}
|
||||
|
||||
public WashingRecipeGen(DataGenerator dataGenerator) {
|
||||
super(dataGenerator);
|
||||
public WashingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
|||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.ProfilePublicKey;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -19,8 +18,8 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@Mixin(LocalPlayer.class)
|
||||
public abstract class HeavyBootsOnPlayerMixin extends AbstractClientPlayer {
|
||||
|
||||
private HeavyBootsOnPlayerMixin(ClientLevel level, GameProfile profile, ProfilePublicKey profileKey) {
|
||||
super(level, profile, profileKey);
|
||||
private HeavyBootsOnPlayerMixin(ClientLevel level, GameProfile profile) {
|
||||
super(level, profile);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "isUnderWater", cancellable = true)
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.simibubi.create.foundation.ponder.content.SharedText;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtAccounter;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
|
@ -118,7 +119,7 @@ public class PonderRegistry {
|
|||
DataInputStream stream =
|
||||
new DataInputStream(new BufferedInputStream(new GZIPInputStream(resourceStream)));
|
||||
CompoundTag nbt = NbtIo.read(stream, new NbtAccounter(0x20000000L));
|
||||
t.load(nbt);
|
||||
t.load(Minecraft.getInstance().level.holderLookup(Registries.BLOCK), nbt);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.animal.Parrot;
|
||||
import net.minecraft.world.entity.animal.Parrot.Variant;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
|
@ -163,8 +164,9 @@ public class ParrotElement extends AnimatedSceneElement {
|
|||
|
||||
Parrot create(PonderWorld world) {
|
||||
Parrot entity = new Parrot(EntityType.PARROT, world);
|
||||
int nextInt = Create.RANDOM.nextInt(5);
|
||||
entity.setVariant(nextInt == 1 ? 0 : nextInt); // blue parrots are kinda hard to see
|
||||
Variant[] variants = Parrot.Variant.values();
|
||||
Parrot.Variant variant = variants[Create.RANDOM.nextInt(variants.length)];
|
||||
entity.setVariant(variant == Variant.BLUE ? Variant.RED_BLUE : variant); // blue parrots are difficult to see
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.sounds.SoundEvent;
|
|||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
@ -115,11 +116,15 @@ public class WrappedWorld extends Level {
|
|||
|
||||
@Override
|
||||
public void playSeededSound(Player p_220363_, double p_220364_, double p_220365_, double p_220366_,
|
||||
SoundEvent p_220367_, SoundSource p_220368_, float p_220369_, float p_220370_, long p_220371_) {}
|
||||
SoundEvent p_220367_, SoundSource p_220368_, float p_220369_, float p_220370_, long p_220371_) {}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player p_220372_, Entity p_220373_, SoundEvent p_220374_, SoundSource p_220375_,
|
||||
float p_220376_, float p_220377_, long p_220378_) {}
|
||||
public void playSeededSound(Player pPlayer, double pX, double pY, double pZ, Holder<SoundEvent> pSound,
|
||||
SoundSource pSource, float pVolume, float pPitch, long pSeed) {}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(Player pPlayer, Entity pEntity, Holder<SoundEvent> pSound, SoundSource pCategory,
|
||||
float pVolume, float pPitch, long pSeed) {}
|
||||
|
||||
@Override
|
||||
public void playSound(@Nullable Player player, double x, double y, double z, SoundEvent soundIn,
|
||||
|
@ -252,4 +257,10 @@ public class WrappedWorld extends Level {
|
|||
public int getSectionYFromSectionIndex(int sectionIndex) {
|
||||
return sectionIndex + this.getMinSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureFlagSet enabledFeatures() {
|
||||
return world.enabledFeatures();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue