-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove mud bricks in favor of the vanilla block
The casting recipe now produces mud (water bottle + dirt is a vanilla recipe) Still considering if there is a good way to get muddy mangrove roots or packed mud with the smeltery, both require a solid + solid so probably not
- Loading branch information
1 parent
e811288
commit 1bd76e9
Showing
39 changed files
with
157 additions
and
395 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
src/generated/resources/data/minecraft/tags/blocks/mineable/shovel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
...urces/data/tconstruct/advancements/recipes/tconstruct/general/common/mud_bricks_slab.json
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
...ces/data/tconstruct/advancements/recipes/tconstruct/general/common/mud_bricks_stairs.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/generated/resources/data/tconstruct/loot_tables/blocks/mud_bricks.json
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
src/generated/resources/data/tconstruct/loot_tables/blocks/mud_bricks_slab.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/generated/resources/data/tconstruct/loot_tables/blocks/mud_bricks_stairs.json
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/generated/resources/data/tconstruct/recipes/common/mud_bricks_slab.json
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
src/generated/resources/data/tconstruct/recipes/common/mud_bricks_stairs.json
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
src/generated/resources/data/tconstruct/recipes/smeltery/casting/water/mud.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"type": "tconstruct:casting_basin", | ||
"cast": { | ||
"type": "tconstruct:block_tag", | ||
"tag": "minecraft:convertable_to_mud" | ||
}, | ||
"cast_consumed": true, | ||
"cooling_time": 47, | ||
"fluid": { | ||
"amount": 250, | ||
"fluid": "minecraft:water" | ||
}, | ||
"result": "minecraft:mud" | ||
} |
13 changes: 0 additions & 13 deletions
13
src/generated/resources/data/tconstruct/recipes/smeltery/casting/water/mud_bricks.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
src/main/java/slimeknights/tconstruct/library/recipe/ingredient/BlockTagIngredient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
package slimeknights.tconstruct.library.recipe.ingredient; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import it.unimi.dsi.fastutil.ints.IntArrayList; | ||
import it.unimi.dsi.fastutil.ints.IntComparators; | ||
import it.unimi.dsi.fastutil.ints.IntList; | ||
import lombok.RequiredArgsConstructor; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.resources.ResourceLocation; | ||
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.level.block.Block; | ||
import net.minecraftforge.common.crafting.AbstractIngredient; | ||
import net.minecraftforge.common.crafting.IIngredientSerializer; | ||
import slimeknights.mantle.data.loadable.Loadables; | ||
import slimeknights.mantle.util.RegistryHelper; | ||
import slimeknights.tconstruct.TConstruct; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.Arrays; | ||
import java.util.LinkedHashSet; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
/** Item ingredient matching items with a block form in the given tag */ | ||
@RequiredArgsConstructor | ||
public class BlockTagIngredient extends AbstractIngredient { | ||
private final TagKey<Block> tag; | ||
@Nullable | ||
private Set<Item> matchingItems; | ||
@Nullable | ||
private ItemStack[] items; | ||
@Nullable | ||
private IntList stackingIds; | ||
|
||
@Override | ||
public boolean test(@Nullable ItemStack stack) { | ||
return stack != null && getMatchingItems().contains(stack.getItem()); | ||
} | ||
|
||
@Override | ||
public boolean isSimple() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected void invalidate() { | ||
this.matchingItems = null; | ||
this.items = null; | ||
this.stackingIds = null; | ||
} | ||
|
||
/** Gets the ordered matching items set */ | ||
private Set<Item> getMatchingItems() { | ||
if (matchingItems == null || checkInvalidation()) { | ||
markValid(); | ||
matchingItems = RegistryHelper.getTagValueStream(Registry.BLOCK, tag) | ||
.map(Block::asItem) | ||
.filter(item -> item != Items.AIR) | ||
.collect(Collectors.toCollection(LinkedHashSet::new)); | ||
} | ||
return matchingItems; | ||
} | ||
|
||
@Override | ||
public ItemStack[] getItems() { | ||
if (items == null || checkInvalidation()) { | ||
markValid(); | ||
items = getMatchingItems().stream().map(ItemStack::new).toArray(ItemStack[]::new); | ||
} | ||
return items; | ||
} | ||
|
||
@Override | ||
public IntList getStackingIds() { | ||
if (stackingIds == null || checkInvalidation()) { | ||
markValid(); | ||
Set<Item> items = getMatchingItems(); | ||
stackingIds = new IntArrayList(items.size()); | ||
for (Item item : items) { | ||
stackingIds.add(Registry.ITEM.getId(item)); | ||
} | ||
stackingIds.sort(IntComparators.NATURAL_COMPARATOR); | ||
} | ||
return stackingIds; | ||
} | ||
|
||
@Override | ||
public IIngredientSerializer<? extends Ingredient> getSerializer() { | ||
return Serializer.INSTANCE; | ||
} | ||
|
||
@Override | ||
public JsonElement toJson() { | ||
JsonObject json = new JsonObject(); | ||
json.addProperty("type", Serializer.ID.toString()); | ||
json.add("tag", Loadables.BLOCK_TAG.serialize(tag)); | ||
return json; | ||
} | ||
|
||
/** Serializer instance */ | ||
public enum Serializer implements IIngredientSerializer<Ingredient> { | ||
INSTANCE; | ||
|
||
public static final ResourceLocation ID = TConstruct.getResource("block_tag"); | ||
|
||
@Override | ||
public Ingredient parse(JsonObject json) { | ||
return new BlockTagIngredient(Loadables.BLOCK_TAG.getIfPresent(json, "tag")); | ||
} | ||
|
||
@Override | ||
public void write(FriendlyByteBuf buffer, Ingredient ingredient) { | ||
// just write the item list, will become a vanilla ingredient client side | ||
buffer.writeCollection(Arrays.asList(ingredient.getItems()), FriendlyByteBuf::writeItem); | ||
} | ||
|
||
@Override | ||
public Ingredient parse(FriendlyByteBuf buffer) { | ||
int size = buffer.readVarInt(); | ||
return Ingredient.fromValues(Stream.generate(() -> new Ingredient.ItemValue(buffer.readItem())).limit(size)); | ||
} | ||
} | ||
} |
Oops, something went wrong.