mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 20:52:20 +00:00
Bump forge, reorganize gog seed inject so the table is separate from the loot modifier
This commit is contained in:
1 parent
4b8d5c2a33
commit
e71a62f0f8
11 files changed
+79
-78
No files matched your search
+1
-1
@@ -101,7 +101,7 @@ test {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${mc_version}-32.0.32"
|
||||
minecraft "net.minecraftforge:forge:${mc_version}-32.0.66"
|
||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.16-38:api")
|
||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.16-38")
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"entries": [
|
||||
"botania:skyblock_seeds"
|
||||
"gardenofglass:skyblock_seeds"
|
||||
]
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:alternative",
|
||||
"terms": [
|
||||
{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "minecraft:grass"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "minecraft:tall_grass",
|
||||
"properties": {
|
||||
"half": "lower"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"type": "botania:call_table",
|
||||
"table": "gardenofglass:extra_seeds"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"name": "main",
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:melon_seeds"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:pumpkin_seeds"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:random_chance",
|
||||
"chance": 0.03125
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"item": "minecraft:shears"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -22,11 +22,4 @@ public class BlockModPane extends PaneBlock {
|
||||
public BlockModPane(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeConnectedTo(BlockState state, IBlockReader world, BlockPos pos, Direction facing) {
|
||||
Block block = world.getBlockState(pos.offset(facing)).getBlock();
|
||||
return block == ModBlocks.elfGlass || block == ModBlocks.manaGlass || block == ModBlocks.bifrostPerm
|
||||
|| super.canBeConnectedTo(state, world, pos, facing);
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -126,11 +126,10 @@ public class SubTileMarimorphosis extends TileEntityFunctionalFlower {
|
||||
int range = getRange();
|
||||
int rangeY = getRangeY();
|
||||
|
||||
BlockStateMatcher matcher = BlockStateMatcher.forBlock(Blocks.STONE);
|
||||
for (BlockPos pos : BlockPos.getAllInBoxMutable(getEffectivePos().add(-range, -rangeY, -range),
|
||||
getEffectivePos().add(range, rangeY, range))) {
|
||||
BlockState state = getWorld().getBlockState(pos);
|
||||
if (state.getBlock().isReplaceableOreGen(state, getWorld(), pos, matcher)) {
|
||||
if (state.getBlock() == Blocks.STONE) {
|
||||
possibleCoords.add(pos.toImmutable());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SubTileOrechid extends TileEntityFunctionalFlower {
|
||||
for (BlockPos pos : BlockPos.getAllInBoxMutable(getEffectivePos().add(-RANGE, -RANGE_Y, -RANGE),
|
||||
getEffectivePos().add(RANGE, RANGE_Y, RANGE))) {
|
||||
BlockState state = getWorld().getBlockState(pos);
|
||||
if (state.getBlock().isReplaceableOreGen(state, getWorld(), pos, getReplaceMatcher())) {
|
||||
if (getReplaceMatcher().test(state)) {
|
||||
possibleCoords.add(pos.toImmutable());
|
||||
}
|
||||
}
|
||||
|
||||
+14
-18
@@ -8,17 +8,14 @@
|
||||
*/
|
||||
package vazkii.botania.common.core.loot;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.LootContext;
|
||||
import net.minecraft.loot.LootTable;
|
||||
import net.minecraft.loot.conditions.ILootCondition;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
|
||||
import net.minecraftforge.common.loot.LootModifier;
|
||||
|
||||
@@ -26,31 +23,30 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AddRandomItemModifier extends LootModifier {
|
||||
private final List<ItemStack> items;
|
||||
/**
|
||||
* Global loot modifier that calls another loot table and appends all of the yielded stacks to the existing loot
|
||||
*/
|
||||
public class CallTableModifier extends LootModifier {
|
||||
private final ResourceLocation tableId;
|
||||
|
||||
protected AddRandomItemModifier(ILootCondition[] conditionsIn, List<ItemStack> items) {
|
||||
protected CallTableModifier(ILootCondition[] conditionsIn, ResourceLocation table) {
|
||||
super(conditionsIn);
|
||||
this.items = items;
|
||||
this.tableId = table;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) {
|
||||
ItemStack stack = items.get(context.getRandom().nextInt(items.size()));
|
||||
generatedLoot.add(stack.copy());
|
||||
LootTable table = context.getWorld().getServer().getLootTableManager().getLootTableFromLocation(tableId);
|
||||
table.generate(context, generatedLoot::add);
|
||||
return generatedLoot;
|
||||
}
|
||||
|
||||
public static class Serializer extends GlobalLootModifierSerializer<AddRandomItemModifier> {
|
||||
public static class Serializer extends GlobalLootModifierSerializer<CallTableModifier> {
|
||||
@Override
|
||||
public AddRandomItemModifier read(ResourceLocation location, JsonObject object, ILootCondition[] ailootcondition) {
|
||||
JsonArray items = JSONUtils.getJsonArray(object, "items");
|
||||
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
|
||||
for (JsonElement item : items) {
|
||||
builder.add(CraftingHelper.getItemStack(item.getAsJsonObject(), true));
|
||||
}
|
||||
return new AddRandomItemModifier(ailootcondition, builder.build());
|
||||
public CallTableModifier read(ResourceLocation location, JsonObject object, ILootCondition[] ailootcondition) {
|
||||
String table = JSONUtils.getString(object, "table");
|
||||
return new CallTableModifier(ailootcondition, new ResourceLocation(table));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class DisposeModifier extends LootModifier {
|
||||
|
||||
public static void register(RegistryEvent.Register<GlobalLootModifierSerializer<?>> evt) {
|
||||
evt.getRegistry().register(new Serializer().setRegistryName(prefix("dispose")));
|
||||
evt.getRegistry().register(new AddRandomItemModifier.Serializer().setRegistryName(prefix("add_item")));
|
||||
evt.getRegistry().register(new CallTableModifier.Serializer().setRegistryName(prefix("call_table")));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -72,8 +72,7 @@ public class EntityEnderAirBottle extends ThrowableEntity implements IRendersAsI
|
||||
for (BlockPos bPos : BlockPos.getAllInBoxMutable(pos.add(-range, -rangeY, -range),
|
||||
pos.add(range, rangeY, range))) {
|
||||
BlockState state = world.getBlockState(bPos);
|
||||
Block block = state.getBlock();
|
||||
if (block.isReplaceableOreGen(state, world, bPos, BlockStateMatcher.forBlock(Blocks.STONE))) {
|
||||
if (state.getBlock() == Blocks.STONE) {
|
||||
possibleCoords.add(bPos.toImmutable());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:alternative",
|
||||
"terms": [
|
||||
{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "minecraft:grass"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "minecraft:tall_grass",
|
||||
"properties": {
|
||||
"half": "lower"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:random_chance",
|
||||
"chance": 0.03125
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"item": "minecraft:shears"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "botania:add_item",
|
||||
"items": [
|
||||
{
|
||||
"item": "minecraft:melon_seeds"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:pumpkin_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user