Sponge drop fix

This commit is contained in:
paulevsGitch 2020-12-23 13:10:11 +03:00
parent d58ca85e4c
commit 113aab6d24
7 changed files with 46 additions and 13 deletions

View file

@ -81,7 +81,7 @@ public class BlockMengerSpongeWet extends BlockBaseNotFull implements IRenderTyp
@Override @Override
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
super.onBreak(world, pos, state, player); world.breakBlock(pos, !player.isCreative());
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR); BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
} }

View file

@ -19,6 +19,7 @@ import ru.betterend.recipe.CraftingRecipes;
import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.recipe.builders.GridRecipe;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
import ru.betterend.registry.EndTags;
import ru.betterend.util.TagHelper; import ru.betterend.util.TagHelper;
public class StoneMaterial { public class StoneMaterial {
@ -91,5 +92,6 @@ public class StoneMaterial {
TagHelper.addTag(BlockTags.WALLS, wall, brick_wall); TagHelper.addTag(BlockTags.WALLS, wall, brick_wall);
TagHelper.addTag(BlockTags.SLABS, slab, brick_slab); TagHelper.addTag(BlockTags.SLABS, slab, brick_slab);
TagHelper.addTags(pressure_plate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES); TagHelper.addTags(pressure_plate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES);
TagHelper.addTag(EndTags.END_STONES, stone);
} }
} }

View file

@ -125,6 +125,7 @@ public class WoodenMaterial {
TagHelper.addTags(slab, ItemTags.WOODEN_SLABS, ItemTags.SLABS); TagHelper.addTags(slab, ItemTags.WOODEN_SLABS, ItemTags.SLABS);
TagHelper.addTags(stairs, ItemTags.WOODEN_STAIRS, ItemTags.STAIRS); TagHelper.addTags(stairs, ItemTags.WOODEN_STAIRS, ItemTags.STAIRS);
TagHelper.addTags(trapdoor, ItemTags.WOODEN_TRAPDOORS, ItemTags.TRAPDOORS); TagHelper.addTags(trapdoor, ItemTags.WOODEN_TRAPDOORS, ItemTags.TRAPDOORS);
TagHelper.addTag(EndTags.ITEM_CHEST, chest);
// Block Tags // // Block Tags //
TagHelper.addTag(BlockTags.PLANKS, planks); TagHelper.addTag(BlockTags.PLANKS, planks);
@ -139,6 +140,7 @@ public class WoodenMaterial {
TagHelper.addTags(stairs, BlockTags.WOODEN_STAIRS, BlockTags.STAIRS); TagHelper.addTags(stairs, BlockTags.WOODEN_STAIRS, BlockTags.STAIRS);
TagHelper.addTags(trapdoor, BlockTags.WOODEN_TRAPDOORS, BlockTags.TRAPDOORS); TagHelper.addTags(trapdoor, BlockTags.WOODEN_TRAPDOORS, BlockTags.TRAPDOORS);
TagHelper.addTag(EndTags.BOOKSHELVES, shelf); TagHelper.addTag(EndTags.BOOKSHELVES, shelf);
TagHelper.addTag(EndTags.BLOCK_CHEST, chest);
logBlockTag = EndTags.makeBlockTag(name + "_logs"); logBlockTag = EndTags.makeBlockTag(name + "_logs");
logItemTag = EndTags.makeItemTag(name + "_logs"); logItemTag = EndTags.makeItemTag(name + "_logs");

View file

@ -12,6 +12,7 @@ import ru.betterend.item.GuideBook;
import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.recipe.builders.GridRecipe;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
import ru.betterend.registry.EndTags;
public class CraftingRecipes { public class CraftingRecipes {
@ -166,6 +167,18 @@ public class CraftingRecipes {
.addMaterial('S', EndItems.ETERNAL_CRYSTAL) .addMaterial('S', EndItems.ETERNAL_CRYSTAL)
.addMaterial('A', EndBlocks.AMBER_BLOCK) .addMaterial('A', EndBlocks.AMBER_BLOCK)
.build(); .build();
GridRecipe.make("hopper", Blocks.HOPPER)
.setShape("I I", "ICI", " I ")
.addMaterial('I', Items.IRON_INGOT)
.addMaterial('C', EndTags.ITEM_CHEST)
.build();;
GridRecipe.make("shulker_box", Blocks.SHULKER_BOX)
.setShape("S", "C", "S")
.addMaterial('S', Items.SHULKER_SHELL)
.addMaterial('C', EndTags.ITEM_CHEST)
.build();
} }
private static void registerLantern(String name, Block lantern, Block slab) { private static void registerLantern(String name, Block lantern, Block slab) {

View file

@ -56,7 +56,7 @@ public class EndFeatures {
public static final EndFeature DRAGON_TREE = new EndFeature("dragon_tree", new DragonTreeFeature(), 3); public static final EndFeature DRAGON_TREE = new EndFeature("dragon_tree", new DragonTreeFeature(), 3);
public static final EndFeature TENANEA = new EndFeature("tenanea", new TenaneaFeature(), 3); public static final EndFeature TENANEA = new EndFeature("tenanea", new TenaneaFeature(), 3);
public static final EndFeature HELIX_TREE = new EndFeature("helix_tree", new HelixTreeFeature(), 2); public static final EndFeature HELIX_TREE = new EndFeature("helix_tree", new HelixTreeFeature(), 2);
public static final EndFeature UMBRELLA_TREE = new EndFeature("umbrella_tree", new UmbrellaTreeFeature(), 2); public static final EndFeature UMBRELLA_TREE = new EndFeature("umbrella_tree", new UmbrellaTreeFeature(), 4);
// Bushes // // Bushes //
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new BushFeature(EndBlocks.PYTHADENDRON_LEAVES, EndBlocks.PYTHADENDRON.bark), 4); public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new BushFeature(EndBlocks.PYTHADENDRON_LEAVES, EndBlocks.PYTHADENDRON.bark), 4);

View file

@ -31,12 +31,15 @@ import ru.betterend.util.TagHelper;
public class EndTags { public class EndTags {
// Block Tags // Block Tags
public static final Tag.Identified<Block> END_GROUND = makeBlockTag("end_ground"); public static final Tag.Identified<Block> BOOKSHELVES = makeCommonBlockTag("bookshelves");
public static final Tag.Identified<Block> GEN_TERRAIN = makeBlockTag("gen_terrain"); public static final Tag.Identified<Block> GEN_TERRAIN = makeBlockTag("gen_terrain");
public static final Tag.Identified<Block> BOOKSHELVES = makeCommonTag("bookshelves"); public static final Tag.Identified<Block> END_GROUND = makeBlockTag("end_ground");
public static final Tag.Identified<Block> PEDESTALS = makeBlockTag("pedestal"); public static final Tag.Identified<Block> PEDESTALS = makeBlockTag("pedestal");
public static final Tag.Identified<Block> BLOCK_CHEST = makeCommonBlockTag("chest");
public static final Tag.Identified<Block> END_STONES = makeCommonBlockTag("end_stones");
// Item Tags // Item Tags
public static final Tag.Identified<Item> ITEM_CHEST = makeCommonItemTag("chest");
public final static Tag<Item> HAMMERS = registerFabricItemTag("hammers"); public final static Tag<Item> HAMMERS = registerFabricItemTag("hammers");
public static Tag.Identified<Block> makeBlockTag(String name) { public static Tag.Identified<Block> makeBlockTag(String name) {
@ -51,12 +54,18 @@ public class EndTags {
return tag == null ? (Identified<Item>) TagRegistry.item(id) : (Identified<Item>) tag; return tag == null ? (Identified<Item>) TagRegistry.item(id) : (Identified<Item>) tag;
} }
public static Tag.Identified<Block> makeCommonTag(String name) { public static Tag.Identified<Block> makeCommonBlockTag(String name) {
Identifier id = new Identifier("c", name); Identifier id = new Identifier("c", name);
Tag<Block> tag = BlockTags.getTagGroup().getTag(id); Tag<Block> tag = BlockTags.getTagGroup().getTag(id);
return tag == null ? (Identified<Block>) TagRegistry.block(id) : (Identified<Block>) tag; return tag == null ? (Identified<Block>) TagRegistry.block(id) : (Identified<Block>) tag;
} }
public static Tag.Identified<Item> makeCommonItemTag(String name) {
Identifier id = new Identifier("c", name);
Tag<Item> tag = ItemTags.getTagGroup().getTag(id);
return tag == null ? (Identified<Item>) TagRegistry.item(id) : (Identified<Item>) tag;
}
public static void register() { public static void register() {
addSurfaceBlock(Blocks.END_STONE); addSurfaceBlock(Blocks.END_STONE);
addSurfaceBlock(EndBlocks.ENDSTONE_DUST); addSurfaceBlock(EndBlocks.ENDSTONE_DUST);
@ -106,9 +115,15 @@ public class EndTags {
biomeRegistry.forEach((biome) -> { biomeRegistry.forEach((biome) -> {
if (biome.getCategory() == Category.THEEND) { if (biome.getCategory() == Category.THEEND) {
SurfaceConfig config = biome.getGenerationSettings().getSurfaceConfig(); SurfaceConfig config = biome.getGenerationSettings().getSurfaceConfig();
TagHelper.addTag(GEN_TERRAIN, config.getTopMaterial().getBlock(), config.getUnderMaterial().getBlock()); Block under = config.getUnderMaterial().getBlock();
Block surface = config.getTopMaterial().getBlock();
TagHelper.addTag(GEN_TERRAIN, under, surface);
TagHelper.addTag(END_GROUND, surface);
} }
}); });
END_STONES.values().forEach((block) -> {
addSurfaceBlock(block);
});
} }
public static boolean validGenBlock(BlockState block) { public static boolean validGenBlock(BlockState block) {

View file

@ -10,7 +10,6 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.client.util.math.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@ -31,6 +30,7 @@ import ru.betterend.world.features.DefaultFeature;
public class UmbrellaTreeFeature extends DefaultFeature { public class UmbrellaTreeFeature extends DefaultFeature {
private static final Function<BlockState, Boolean> REPLACE; private static final Function<BlockState, Boolean> REPLACE;
private static final Function<BlockState, Boolean> IGNORE;
private static final Function<PosInfo, BlockState> POST; private static final Function<PosInfo, BlockState> POST;
private static final List<Vector3f> SPLINE; private static final List<Vector3f> SPLINE;
private static final List<Vector3f> ROOT; private static final List<Vector3f> ROOT;
@ -48,9 +48,6 @@ public class UmbrellaTreeFeature extends DefaultFeature {
float var = MHelper.PI2 / (float) (count * 3); float var = MHelper.PI2 / (float) (count * 3);
float start = MHelper.randRange(0, MHelper.PI2, random); float start = MHelper.randRange(0, MHelper.PI2, random);
SDF sdf = null; SDF sdf = null;
int x1 = ((pos.getX() >> 4) << 4) - 16;
int z1 = ((pos.getZ() >> 4) << 4) - 16;
Box limits = new Box(x1, pos.getY() - 5, z1, x1 + 47, pos.getY() + size * 2, z1 + 47);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
float angle = (float) i / (float) count * MHelper.PI2 + MHelper.randRange(0, var, random) + start; float angle = (float) i / (float) count * MHelper.PI2 + MHelper.randRange(0, var, random) + start;
List<Vector3f> spline = SplineHelper.copySpline(SPLINE); List<Vector3f> spline = SplineHelper.copySpline(SPLINE);
@ -61,7 +58,7 @@ public class UmbrellaTreeFeature extends DefaultFeature {
SplineHelper.offsetParts(spline, random, 0.5F, 0, 0.5F); SplineHelper.offsetParts(spline, random, 0.5F, 0, 0.5F);
if (SplineHelper.canGenerate(spline, pos, world, REPLACE)) { if (SplineHelper.canGenerate(spline, pos, world, REPLACE)) {
SDF branch = SplineHelper.buildSDF(spline, 1.3F, 0.8F, (bpos) -> { SDF branch = SplineHelper.buildSDF(spline, 1.2F, 0.8F, (bpos) -> {
return wood; return wood;
}); });
@ -83,8 +80,8 @@ public class UmbrellaTreeFeature extends DefaultFeature {
return false; return false;
} }
makeRoots(world, pos.add(0, 3, 0), size * 0.4F + 5, random, wood); sdf.setReplaceFunction(REPLACE).setPostProcess(POST).fillRecursiveIgnore(world, pos, IGNORE);
sdf.setReplaceFunction(REPLACE).setPostProcess(POST).fillArea(world, pos, limits); makeRoots(world, pos.add(0, 2, 0), size * 0.3F + 3, random, wood);
return true; return true;
} }
@ -150,6 +147,10 @@ public class UmbrellaTreeFeature extends DefaultFeature {
return state.getMaterial().isReplaceable(); return state.getMaterial().isReplaceable();
}; };
IGNORE = (state) -> {
return EndBlocks.UMBRELLA_TREE.isTreeLog(state);
};
POST = (info) -> { POST = (info) -> {
if (EndBlocks.UMBRELLA_TREE.isTreeLog(info.getStateUp()) && EndBlocks.UMBRELLA_TREE.isTreeLog(info.getStateDown())) { if (EndBlocks.UMBRELLA_TREE.isTreeLog(info.getStateUp()) && EndBlocks.UMBRELLA_TREE.isTreeLog(info.getStateDown())) {
return EndBlocks.UMBRELLA_TREE.log.getDefaultState(); return EndBlocks.UMBRELLA_TREE.log.getDefaultState();