New sounds, registry rename

This commit is contained in:
paulevsGitch 2020-10-27 03:16:55 +03:00
parent c609f98ec2
commit 1c03ecb5e3
105 changed files with 1449 additions and 1447 deletions

View file

@ -11,16 +11,15 @@ import ru.betterend.recipe.AlloyingRecipes;
import ru.betterend.recipe.CraftingRecipes;
import ru.betterend.recipe.SmeltigRecipes;
import ru.betterend.recipe.SmithingRecipes;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.BlockEntityRegistry;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.ItemTagRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlockEntities;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndItems;
import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures;
import ru.betterend.registry.EndTags;
import ru.betterend.util.Logger;
import ru.betterend.util.TranslationHelper;
import ru.betterend.world.generator.BetterEndBiomeSource;
@ -32,23 +31,22 @@ public class BetterEnd implements ModInitializer {
@Override
public void onInitialize() {
SoundRegistry.register();
ItemRegistry.register();
BlockRegistry.register();
BlockEntityRegistry.register();
FeatureRegistry.register();
EntityRegistry.register();
BiomeRegistry.register();
EndSounds.register();
EndItems.register();
EndBlocks.register();
EndBlockEntities.register();
EndFeatures.register();
EndEntities.register();
EndBiomes.register();
BetterEndBiomeSource.register();
ItemTagRegistry.register();
BlockTagRegistry.register();
EndTags.register();
EndEnchantments.register();
EndPotions.register();
CraftingRecipes.register();
SmeltigRecipes.register();
AlloyingRecipes.register();
SmithingRecipes.register();
StructureRegistry.register();
EndStructures.register();
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);

View file

@ -22,7 +22,7 @@ import net.minecraft.util.math.Vec3i;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.interfaces.IColorProvider;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndItems;
import ru.betterend.util.MHelper;
public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTypeable, IColorProvider {
@ -88,13 +88,13 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
int min = MathHelper.clamp(MIN_DROP + enchant, MIN_DROP, MAX_DROP);
int max = MAX_DROP + (enchant / Enchantments.FORTUNE.getMaxLevel());
if (min == max) {
return Lists.newArrayList(new ItemStack(ItemRegistry.CRYSTAL_SHARDS, max));
return Lists.newArrayList(new ItemStack(EndItems.CRYSTAL_SHARDS, max));
}
count = MHelper.randRange(min, max, MHelper.RANDOM);
} else {
count = MHelper.randRange(MIN_DROP, MAX_DROP, MHelper.RANDOM);
}
return Lists.newArrayList(new ItemStack(ItemRegistry.CRYSTAL_SHARDS, count));
return Lists.newArrayList(new ItemStack(EndItems.CRYSTAL_SHARDS, count));
}
return Lists.newArrayList();
}

View file

@ -6,7 +6,7 @@ import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockUpDownPlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class BlockBlueVine extends BlockUpDownPlant {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
@ -18,6 +18,6 @@ public class BlockBlueVine extends BlockUpDownPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
}
}

View file

@ -14,7 +14,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class BlockBlueVineLantern extends BlockBase {
public static final BooleanProperty NATURAL = BooleanProperty.of("natural");
@ -26,7 +26,7 @@ public class BlockBlueVineLantern extends BlockBase {
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return state.get(NATURAL) ? world.getBlockState(pos.down()).getBlock() == BlockRegistry.BLUE_VINE : true;
return state.get(NATURAL) ? world.getBlockState(pos.down()).getBlock() == EndBlocks.BLUE_VINE : true;
}
@Override

View file

@ -9,7 +9,7 @@ import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -21,29 +21,29 @@ public class BlockBlueVineSeed extends BlockPlantWithAge {
if (h < height + 1) {
return;
}
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.BLUE_VINE.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BLUE_VINE.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
for (int i = 1; i < height; i++) {
BlocksHelper.setWithoutUpdate(world, pos.up(i), BlockRegistry.BLUE_VINE.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(world, pos.up(i), EndBlocks.BLUE_VINE.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
}
BlocksHelper.setWithoutUpdate(world, pos.up(height), BlockRegistry.BLUE_VINE.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
BlocksHelper.setWithoutUpdate(world, pos.up(height), EndBlocks.BLUE_VINE.getDefaultState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
placeLantern(world, pos.up(height + 1));
}
private void placeLantern(StructureWorldAccess world, BlockPos pos) {
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.BLUE_VINE_LANTERN.getDefaultState().with(BlockBlueVineLantern.NATURAL, true));
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BLUE_VINE_LANTERN.getDefaultState().with(BlockBlueVineLantern.NATURAL, true));
for (Direction dir: BlocksHelper.HORIZONTAL) {
BlockPos p = pos.offset(dir);
if (world.isAir(p)) {
BlocksHelper.setWithoutUpdate(world, p, BlockRegistry.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
}
}
if (world.isAir(pos.up())) {
BlocksHelper.setWithoutUpdate(world, pos.up(), BlockRegistry.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.UP));
BlocksHelper.setWithoutUpdate(world, pos.up(), EndBlocks.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.UP));
}
}
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
}
}

View file

@ -2,7 +2,7 @@ package ru.betterend.blocks;
import net.minecraft.block.BlockState;
import ru.betterend.blocks.basis.BlockPlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class BlockChorusGrass extends BlockPlant {
public BlockChorusGrass() {
@ -11,6 +11,6 @@ public class BlockChorusGrass extends BlockPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.CHORUS_NYLIUM;
return state.getBlock() == EndBlocks.CHORUS_NYLIUM;
}
}

View file

@ -28,8 +28,8 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockUnderwaterPlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems;
import ru.betterend.util.MHelper;
public class BlockEndLily extends BlockUnderwaterPlant {
@ -91,7 +91,7 @@ public class BlockEndLily extends BlockUnderwaterPlant {
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
if (state.get(SHAPE) == TripleShape.TOP) {
return Lists.newArrayList(new ItemStack(ItemRegistry.END_LILY_LEAF, MHelper.randRange(1, 2, MHelper.RANDOM)), new ItemStack(BlockRegistry.END_LILY_SEED, MHelper.randRange(1, 2, MHelper.RANDOM)));
return Lists.newArrayList(new ItemStack(EndItems.END_LILY_LEAF, MHelper.randRange(1, 2, MHelper.RANDOM)), new ItemStack(EndBlocks.END_LILY_SEED, MHelper.randRange(1, 2, MHelper.RANDOM)));
}
return Collections.emptyList();
}

View file

@ -7,20 +7,20 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockUnderwaterPlantWithAge;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class BlockEndLilySeed extends BlockUnderwaterPlantWithAge {
@Override
public void grow(StructureWorldAccess world, Random random, BlockPos pos) {
if (canGrow(world, pos)) {
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM));
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM));
BlockPos up = pos.up();
while (world.getFluidState(up).isStill()) {
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE));
up = up.up();
}
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.TOP));
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.TOP));
}
}

View file

@ -16,7 +16,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.BlockPlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.MHelper;
public class BlockEndLotusFlower extends BlockPlant {
@ -29,7 +29,7 @@ public class BlockEndLotusFlower extends BlockPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(BlockRegistry.END_LOTUS_STEM);
return state.isOf(EndBlocks.END_LOTUS_STEM);
}
@Override
@ -50,6 +50,6 @@ public class BlockEndLotusFlower extends BlockPlant {
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
int count = MHelper.randRange(1, 2, MHelper.RANDOM);
return Lists.newArrayList(new ItemStack(BlockRegistry.END_LOTUS_SEED, count));
return Lists.newArrayList(new ItemStack(EndBlocks.END_LOTUS_SEED, count));
}
}

View file

@ -10,17 +10,17 @@ import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockUnderwaterPlantWithAge;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
@Override
public void grow(StructureWorldAccess world, Random random, BlockPos pos) {
if (canGrow(world, pos)) {
BlockState startLeaf = BlockRegistry.END_LOTUS_STEM.getDefaultState().with(BlockEndLotusStem.LEAF, true);
BlockState roots = BlockRegistry.END_LOTUS_STEM.getDefaultState().with(BlockEndLotusStem.SHAPE, TripleShape.BOTTOM).with(BlockEndLotusStem.WATERLOGGED, true);
BlockState stem = BlockRegistry.END_LOTUS_STEM.getDefaultState();
BlockState flower = BlockRegistry.END_LOTUS_FLOWER.getDefaultState();
BlockState startLeaf = EndBlocks.END_LOTUS_STEM.getDefaultState().with(BlockEndLotusStem.LEAF, true);
BlockState roots = EndBlocks.END_LOTUS_STEM.getDefaultState().with(BlockEndLotusStem.SHAPE, TripleShape.BOTTOM).with(BlockEndLotusStem.WATERLOGGED, true);
BlockState stem = EndBlocks.END_LOTUS_STEM.getDefaultState();
BlockState flower = EndBlocks.END_LOTUS_FLOWER.getDefaultState();
BlocksHelper.setWithoutUpdate(world, pos, roots);
Mutable bpos = new Mutable().set(pos);
@ -63,14 +63,14 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
BlocksHelper.setWithoutUpdate(world, bpos, flower);
bpos.setY(bpos.getY() - 1);
stem = world.getBlockState(bpos);
if (!stem.isOf(BlockRegistry.END_LOTUS_STEM)) {
stem = BlockRegistry.END_LOTUS_STEM.getDefaultState();
if (!stem.isOf(EndBlocks.END_LOTUS_STEM)) {
stem = EndBlocks.END_LOTUS_STEM.getDefaultState();
if (!world.getBlockState(bpos.north()).getFluidState().isEmpty()) {
stem = stem.with(BlockEndLotusStem.WATERLOGGED, true);
}
}
if (world.getBlockState(bpos.offset(dir)).isOf(BlockRegistry.END_LOTUS_LEAF)) {
if (world.getBlockState(bpos.offset(dir)).isOf(EndBlocks.END_LOTUS_LEAF)) {
stem = stem.with(BlockEndLotusStem.LEAF, true).with(BlockEndLotusStem.FACING, dir);
}
@ -89,7 +89,7 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
private void generateLeaf(StructureWorldAccess world, BlockPos pos) {
Mutable p = new Mutable();
BlockState leaf = BlockRegistry.END_LOTUS_LEAF.getDefaultState();
BlockState leaf = EndBlocks.END_LOTUS_LEAF.getDefaultState();
BlocksHelper.setWithoutUpdate(world, pos, leaf.with(BlockEndLotusLeaf.SHAPE, TripleShape.BOTTOM));
for (Direction move: BlocksHelper.HORIZONTAL) {
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.with(BlockEndLotusLeaf.HORIZONTAL_FACING, move).with(BlockEndLotusLeaf.SHAPE, TripleShape.MIDDLE));

View file

@ -6,7 +6,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.BlockPlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class BlockGlowingMoss extends BlockPlant {
public BlockGlowingMoss(int light) {
@ -15,7 +15,7 @@ public class BlockGlowingMoss extends BlockPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
}
@Environment(EnvType.CLIENT)

View file

@ -9,7 +9,7 @@ import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class BlockMossyGlowshroomCap extends Block {
public static final BooleanProperty TRANSITION = BooleanProperty.of("transition");
@ -20,7 +20,7 @@ public class BlockMossyGlowshroomCap extends Block {
}
public BlockState getPlacementState(ItemPlacementContext ctx) {
return this.getDefaultState().with(TRANSITION, BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(ctx.getWorld().getBlockState(ctx.getBlockPos().down())));
return this.getDefaultState().with(TRANSITION, EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(ctx.getWorld().getBlockState(ctx.getBlockPos().down())));
}
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {

View file

@ -2,7 +2,7 @@ package ru.betterend.blocks;
import net.minecraft.world.gen.feature.Feature;
import ru.betterend.blocks.basis.BlockFeatureSapling;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.EndFeatures;
public class BlockMossyGlowshroomSapling extends BlockFeatureSapling {
public BlockMossyGlowshroomSapling() {
@ -11,6 +11,6 @@ public class BlockMossyGlowshroomSapling extends BlockFeatureSapling {
@Override
protected Feature<?> getFeature() {
return FeatureRegistry.MOSSY_GLOWSHROOM.getFeature();
return EndFeatures.MOSSY_GLOWSHROOM.getFeature();
}
}

View file

@ -2,7 +2,7 @@ package ru.betterend.blocks;
import net.minecraft.world.gen.feature.Feature;
import ru.betterend.blocks.basis.BlockFeatureSapling;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.EndFeatures;
public class BlockMossyPythadendronSapling extends BlockFeatureSapling {
public BlockMossyPythadendronSapling() {
@ -11,6 +11,6 @@ public class BlockMossyPythadendronSapling extends BlockFeatureSapling {
@Override
protected Feature<?> getFeature() {
return FeatureRegistry.PYTHADENDRON_TREE.getFeature();
return EndFeatures.PYTHADENDRON_TREE.getFeature();
}
}

View file

@ -11,7 +11,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import ru.betterend.blocks.basis.BlockDoublePlant;
import ru.betterend.blocks.basis.BlockPlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class BlockUmbrellaMoss extends BlockPlant {
@ -21,7 +21,7 @@ public class BlockUmbrellaMoss extends BlockPlant {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
}
@Environment(EnvType.CLIENT)
@ -42,7 +42,7 @@ public class BlockUmbrellaMoss extends BlockPlant {
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
int rot = world.random.nextInt(4);
BlockState bs = BlockRegistry.UMBRELLA_MOSS_TALL.getDefaultState().with(BlockDoublePlant.ROTATION, rot);
BlockState bs = EndBlocks.UMBRELLA_MOSS_TALL.getDefaultState().with(BlockDoublePlant.ROTATION, rot);
BlocksHelper.setWithoutUpdate(world, pos, bs);
BlocksHelper.setWithoutUpdate(world, pos.up(), bs.with(BlockDoublePlant.TOP, true));
}

View file

@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import ru.betterend.blocks.basis.BlockDoublePlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class BlockUmbrellaMossTall extends BlockDoublePlant {
public BlockUmbrellaMossTall() {
@ -17,12 +17,12 @@ public class BlockUmbrellaMossTall extends BlockDoublePlant {
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, new ItemStack(BlockRegistry.UMBRELLA_MOSS));
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, new ItemStack(EndBlocks.UMBRELLA_MOSS));
world.spawnEntity(item);
}
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
}
}

View file

@ -26,8 +26,8 @@ import net.minecraft.world.gen.feature.ConfiguredFeatures;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.interfaces.TeleportingEntity;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.ParticleRegistry;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndTags;
import ru.betterend.util.PortalFrameHelper;
public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable {
@ -54,7 +54,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
z = pos.getZ() + 0.5D + 0.25D * k;
}
world.addParticle(ParticleRegistry.PORTAL_SPHERE, x, y, z, 0, 0, 0);
world.addParticle(EndParticles.PORTAL_SPHERE, x, y, z, 0, 0, 0);
}
@Override
@ -164,7 +164,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
BlockState state = world.getBlockState(position);
if (state.isAir()) airBlocks++;
if (world.getRegistryKey().equals(World.END)) {
free &= state.isAir() || BlockTagRegistry.validGenBlock(state);
free &= state.isAir() || EndTags.validGenBlock(state);
} else {
BlockState surfaceBlock = world.getBiome(pos).getGenerationSettings().getSurfaceConfig().getTopMaterial();
free &= this.validBlock(state, surfaceBlock.getBlock());

View file

@ -16,14 +16,14 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.explosion.Explosion;
import ru.betterend.blocks.basis.BlockSlab;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class EternalPedestal extends BlockSlab {
public static final BooleanProperty ACTIVATED = BooleanProperty.of("active");
public static final BooleanProperty HAS_ITEM = BooleanProperty.of("has_item");
public EternalPedestal() {
super(BlockRegistry.FLAVOLITE_RUNED_ETERNAL);
super(EndBlocks.FLAVOLITE_RUNED_ETERNAL);
this.setDefaultState(stateManager.getDefaultState().with(ACTIVATED, false).with(HAS_ITEM, false));
}

View file

@ -10,7 +10,7 @@ import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.PortalFrameHelper;
@ -18,7 +18,7 @@ public class RunedFlavolite extends BlockBase {
public static final BooleanProperty ACTIVATED = BooleanProperty.of("active");
public RunedFlavolite() {
super(FabricBlockSettings.copyOf(BlockRegistry.FLAVOLITE.polished).resistance(Blocks.OBSIDIAN.getBlastResistance()).luminance(state -> {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).resistance(Blocks.OBSIDIAN.getBlastResistance()).luminance(state -> {
return state.get(ACTIVATED) ? 8 : 0;
}));
this.setDefaultState(stateManager.getDefaultState().with(ACTIVATED, false));
@ -40,7 +40,7 @@ public class RunedFlavolite extends BlockBase {
BlockState posState = world.getBlockState(position);
if (posState.getBlock() instanceof RunedFlavolite && posState.get(ACTIVATED)) {
BlocksHelper.setWithoutUpdate(world, position, posState.with(ACTIVATED, false));
} else if (posState.isOf(BlockRegistry.END_PORTAL_BLOCK)) {
} else if (posState.isOf(EndBlocks.END_PORTAL_BLOCK)) {
world.removeBlock(position, false);
}
}

View file

@ -27,7 +27,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import ru.betterend.blocks.entities.EBarrelBlockEntity;
import ru.betterend.interfaces.Patterned;
import ru.betterend.registry.BlockEntityRegistry;
import ru.betterend.registry.EndBlockEntities;
public class BlockBarrel extends BarrelBlock implements Patterned {
public BlockBarrel(Block source) {
@ -36,7 +36,7 @@ public class BlockBarrel extends BarrelBlock implements Patterned {
@Override
public BlockEntity createBlockEntity(BlockView world) {
return BlockEntityRegistry.BARREL.instantiate();
return EndBlockEntities.BARREL.instantiate();
}
@Override

View file

@ -14,7 +14,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.BlockView;
import ru.betterend.interfaces.Patterned;
import ru.betterend.registry.BlockEntityRegistry;
import ru.betterend.registry.EndBlockEntities;
public class BlockChest extends ChestBlock implements Patterned {
@ -22,7 +22,7 @@ public class BlockChest extends ChestBlock implements Patterned {
public BlockChest(Block source) {
super(FabricBlockSettings.copyOf(source).nonOpaque(), () -> {
return BlockEntityRegistry.CHEST;
return EndBlockEntities.CHEST;
});
this.parent = source;
}
@ -30,7 +30,7 @@ public class BlockChest extends ChestBlock implements Patterned {
@Override
public BlockEntity createBlockEntity(BlockView world)
{
return BlockEntityRegistry.CHEST.instantiate();
return EndBlockEntities.CHEST.instantiate();
}
@Override

View file

@ -36,7 +36,7 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
public class BlockDoublePlant extends BlockBaseNotFull implements IRenderTypeable, Fertilizable {
@ -93,7 +93,7 @@ public class BlockDoublePlant extends BlockBaseNotFull implements IRenderTypeabl
}
protected boolean isTerrain(BlockState state) {
return state.isIn(BlockTagRegistry.END_GROUND);
return state.isIn(EndTags.END_GROUND);
}
@Override

View file

@ -25,7 +25,7 @@ import net.minecraft.world.gen.feature.Feature;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.interfaces.Patterned;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
public abstract class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizable, IRenderTypeable {
@ -59,7 +59,7 @@ public abstract class BlockFeatureSapling extends BlockBaseNotFull implements Fe
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND);
return world.getBlockState(pos.down()).isIn(EndTags.END_GROUND);
}
@Override

View file

@ -32,7 +32,7 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndTags;
public class BlockPlant extends BlockBaseNotFull implements IRenderTypeable, Fertilizable {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 0, 4, 12, 14, 12);
@ -84,7 +84,7 @@ public class BlockPlant extends BlockBaseNotFull implements IRenderTypeable, Fer
}
protected boolean isTerrain(BlockState state) {
return state.isIn(BlockTagRegistry.END_GROUND);
return state.isIn(EndTags.END_GROUND);
}
@Override

View file

@ -36,8 +36,8 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
public class BlockUnderwaterPlant extends BlockBaseNotFull implements IRenderTypeable, Fertilizable, FluidFillable {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 0, 4, 12, 14, 12);
@ -82,7 +82,7 @@ public class BlockUnderwaterPlant extends BlockBaseNotFull implements IRenderTyp
}
protected boolean isTerrain(BlockState state) {
return state.isIn(BlockTagRegistry.END_GROUND) || state.getBlock() == BlockRegistry.ENDSTONE_DUST;
return state.isIn(EndTags.END_GROUND) || state.getBlock() == EndBlocks.ENDSTONE_DUST;
}
@Override

View file

@ -28,7 +28,7 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndTags;
public class BlockUpDownPlant extends BlockBaseNotFull implements IRenderTypeable {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 0, 4, 12, 16, 12);
@ -54,7 +54,7 @@ public class BlockUpDownPlant extends BlockBaseNotFull implements IRenderTypeabl
}
protected boolean isTerrain(BlockState state) {
return state.isIn(BlockTagRegistry.END_GROUND);
return state.isIn(EndTags.END_GROUND);
}
protected boolean isSupport(BlockState state, WorldView world, BlockPos pos) {

View file

@ -14,7 +14,7 @@ import ru.betterend.blocks.basis.BlockStoneButton;
import ru.betterend.blocks.basis.BlockStonePressurePlate;
import ru.betterend.blocks.basis.BlockWall;
import ru.betterend.recipe.builders.RecipeBuilder;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.TagHelper;
public class StoneMaterial {
@ -37,20 +37,20 @@ public class StoneMaterial {
public StoneMaterial(String name, MaterialColor color) {
FabricBlockSettings material = FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color);
stone = BlockRegistry.registerBlock(name, new BlockBase(material));
polished = BlockRegistry.registerBlock(name + "_polished", new BlockBase(material));
tiles = BlockRegistry.registerBlock(name + "_tiles", new BlockBase(material));
pillar = BlockRegistry.registerBlock(name + "_pillar", new BlockPillar(material));
stairs = BlockRegistry.registerBlock(name + "_stairs", new BlockStairs(stone));
slab = BlockRegistry.registerBlock(name + "_slab", new BlockSlab(stone));
wall = BlockRegistry.registerBlock(name + "_wall", new BlockWall(stone));
button = BlockRegistry.registerBlock(name + "_button", new BlockStoneButton(stone));
pressure_plate = BlockRegistry.registerBlock(name + "_plate", new BlockStonePressurePlate(stone));
stone = EndBlocks.registerBlock(name, new BlockBase(material));
polished = EndBlocks.registerBlock(name + "_polished", new BlockBase(material));
tiles = EndBlocks.registerBlock(name + "_tiles", new BlockBase(material));
pillar = EndBlocks.registerBlock(name + "_pillar", new BlockPillar(material));
stairs = EndBlocks.registerBlock(name + "_stairs", new BlockStairs(stone));
slab = EndBlocks.registerBlock(name + "_slab", new BlockSlab(stone));
wall = EndBlocks.registerBlock(name + "_wall", new BlockWall(stone));
button = EndBlocks.registerBlock(name + "_button", new BlockStoneButton(stone));
pressure_plate = EndBlocks.registerBlock(name + "_plate", new BlockStonePressurePlate(stone));
bricks = BlockRegistry.registerBlock(name + "_bricks", new BlockBase(material));
brick_stairs = BlockRegistry.registerBlock(name + "_bricks_stairs", new BlockStairs(bricks));
brick_slab = BlockRegistry.registerBlock(name + "_bricks_slab", new BlockSlab(bricks));
brick_wall = BlockRegistry.registerBlock(name + "_bricks_wall", new BlockWall(bricks));
bricks = EndBlocks.registerBlock(name + "_bricks", new BlockBase(material));
brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BlockStairs(bricks));
brick_slab = EndBlocks.registerBlock(name + "_bricks_slab", new BlockSlab(bricks));
brick_wall = EndBlocks.registerBlock(name + "_bricks_wall", new BlockWall(bricks));
// Recipes //
RecipeBuilder.make(name + "_bricks", bricks).setOutputCount(4).setShape("##", "##").addMaterial('#', stone).setGroup("end_bricks").build();

View file

@ -27,7 +27,7 @@ import ru.betterend.blocks.basis.BlockStairs;
import ru.betterend.blocks.basis.BlockTrapdoor;
import ru.betterend.blocks.basis.BlockWoodenButton;
import ru.betterend.recipe.builders.RecipeBuilder;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.TagHelper;
public class WoodenMaterial {
@ -58,28 +58,28 @@ public class WoodenMaterial {
public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor) {
FabricBlockSettings materialPlanks = FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(planksColor);
log_stripped = BlockRegistry.registerBlock(name + "_stripped_log", new BlockPillar(materialPlanks));
bark_stripped = BlockRegistry.registerBlock(name + "_stripped_bark", new BlockBark(materialPlanks));
log_stripped = EndBlocks.registerBlock(name + "_stripped_log", new BlockPillar(materialPlanks));
bark_stripped = EndBlocks.registerBlock(name + "_stripped_bark", new BlockBark(materialPlanks));
log = BlockRegistry.registerBlock(name + "_log", new BlockLogStripable(woodColor, log_stripped));
bark = BlockRegistry.registerBlock(name + "_bark", new BlockBarkStripable(woodColor, bark_stripped));
log = EndBlocks.registerBlock(name + "_log", new BlockLogStripable(woodColor, log_stripped));
bark = EndBlocks.registerBlock(name + "_bark", new BlockBarkStripable(woodColor, bark_stripped));
planks = BlockRegistry.registerBlock(name + "_planks", new BlockBase(materialPlanks));
stairs = BlockRegistry.registerBlock(name + "_stairs", new BlockStairs(planks));
slab = BlockRegistry.registerBlock(name + "_slab", new BlockSlab(planks));
fence = BlockRegistry.registerBlock(name + "_fence", new BlockFence(planks));
gate = BlockRegistry.registerBlock(name + "_gate", new BlockGate(planks));
button = BlockRegistry.registerBlock(name + "_button", new BlockWoodenButton(planks));
pressure_plate = BlockRegistry.registerBlock(name + "_plate", new BlockPressurePlate(planks));
trapdoor = BlockRegistry.registerBlock(name + "_trapdoor", new BlockTrapdoor(planks));
door = BlockRegistry.registerBlock(name + "_door", new BlockDoor(planks));
planks = EndBlocks.registerBlock(name + "_planks", new BlockBase(materialPlanks));
stairs = EndBlocks.registerBlock(name + "_stairs", new BlockStairs(planks));
slab = EndBlocks.registerBlock(name + "_slab", new BlockSlab(planks));
fence = EndBlocks.registerBlock(name + "_fence", new BlockFence(planks));
gate = EndBlocks.registerBlock(name + "_gate", new BlockGate(planks));
button = EndBlocks.registerBlock(name + "_button", new BlockWoodenButton(planks));
pressure_plate = EndBlocks.registerBlock(name + "_plate", new BlockPressurePlate(planks));
trapdoor = EndBlocks.registerBlock(name + "_trapdoor", new BlockTrapdoor(planks));
door = EndBlocks.registerBlock(name + "_door", new BlockDoor(planks));
crafting_table = BlockRegistry.registerBlock(name + "_crafting_table", new BlockCraftingTable(planks));
ladder = BlockRegistry.registerBlock(name + "_ladder", new BlockLadder(planks));
sign = BlockRegistry.registerBlock(name + "_sign", new BlockSign(planks));
crafting_table = EndBlocks.registerBlock(name + "_crafting_table", new BlockCraftingTable(planks));
ladder = EndBlocks.registerBlock(name + "_ladder", new BlockLadder(planks));
sign = EndBlocks.registerBlock(name + "_sign", new BlockSign(planks));
chest = BlockRegistry.registerBlock(name + "_chest", new BlockChest(planks));
barrel = BlockRegistry.registerBlock(name + "_barrel", new BlockBarrel(planks));
chest = EndBlocks.registerBlock(name + "_chest", new BlockChest(planks));
barrel = EndBlocks.registerBlock(name + "_barrel", new BlockBarrel(planks));
// Recipes //
RecipeBuilder.make(name + "_planks", planks).setOutputCount(4).setList("#").addMaterial('#', log, bark, log_stripped, bark_stripped).setGroup("end_planks").build();

View file

@ -21,7 +21,7 @@ import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3i;
import ru.betterend.blocks.basis.BlockBarrel;
import ru.betterend.registry.BlockEntityRegistry;
import ru.betterend.registry.EndBlockEntities;
public class EBarrelBlockEntity extends LootableContainerBlockEntity {
private DefaultedList<ItemStack> inventory;
@ -33,7 +33,7 @@ public class EBarrelBlockEntity extends LootableContainerBlockEntity {
}
public EBarrelBlockEntity() {
this(BlockEntityRegistry.BARREL);
this(EndBlockEntities.BARREL);
}
public CompoundTag toTag(CompoundTag tag) {

View file

@ -1,10 +1,10 @@
package ru.betterend.blocks.entities;
import net.minecraft.block.entity.ChestBlockEntity;
import ru.betterend.registry.BlockEntityRegistry;
import ru.betterend.registry.EndBlockEntities;
public class EChestBlockEntity extends ChestBlockEntity {
public EChestBlockEntity() {
super(BlockEntityRegistry.CHEST);
super(EndBlockEntities.CHEST);
}
}

View file

@ -25,7 +25,7 @@ import net.minecraft.text.Texts;
import net.minecraft.util.DyeColor;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
import ru.betterend.registry.BlockEntityRegistry;
import ru.betterend.registry.EndBlockEntities;
public class ESignBlockEntity extends BlockEntity {
private final Text[] text;
@ -35,7 +35,7 @@ public class ESignBlockEntity extends BlockEntity {
private DyeColor textColor;
public ESignBlockEntity() {
super(BlockEntityRegistry.SIGN);
super(EndBlockEntities.SIGN);
this.text = new Text[] { LiteralText.EMPTY, LiteralText.EMPTY, LiteralText.EMPTY, LiteralText.EMPTY };
this.editable = true;
this.textBeingEdited = new OrderedText[4];

View file

@ -1,481 +1,481 @@
package ru.betterend.blocks.entities;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.LockableContainerBlockEntity;
import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.recipe.BlastingRecipe;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeFinder;
import net.minecraft.recipe.RecipeInputProvider;
import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.RecipeUnlocker;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.tag.Tag;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.minecraft.util.Tickable;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndStoneSmelter;
import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.BlockEntityRegistry;
public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity implements SidedInventory, RecipeUnlocker, RecipeInputProvider, Tickable {
private static final int[] TOP_SLOTS = new int[] { 0, 1 };
private static final int[] BOTTOM_SLOTS = new int[] { 2, 3 };
private static final int[] SIDE_SLOTS = new int[] { 3 };
private static final Map<Item, Integer> availableFuels = Maps.newHashMap();
private final Object2IntOpenHashMap<Identifier> recipesUsed;
protected DefaultedList<ItemStack> inventory;
protected final PropertyDelegate propertyDelegate;
private Recipe<?> lastRecipe;
private int smeltTimeTotal;
private int smeltTime;
private int burnTime;
private int fuelTime;
public EndStoneSmelterBlockEntity() {
super(BlockEntityRegistry.END_STONE_SMELTER);
this.inventory = DefaultedList.ofSize(4, ItemStack.EMPTY);
this.recipesUsed = new Object2IntOpenHashMap<Identifier>();
this.propertyDelegate = new PropertyDelegate() {
public int get(int index) {
switch(index) {
case 0:
return EndStoneSmelterBlockEntity.this.burnTime;
case 1:
return EndStoneSmelterBlockEntity.this.fuelTime;
case 2:
return EndStoneSmelterBlockEntity.this.smeltTime;
case 3:
return EndStoneSmelterBlockEntity.this.smeltTimeTotal;
default:
return 0;
}
}
public void set(int index, int value) {
switch(index) {
case 0:
EndStoneSmelterBlockEntity.this.burnTime = value;
break;
case 1:
EndStoneSmelterBlockEntity.this.fuelTime = value;
break;
case 2:
EndStoneSmelterBlockEntity.this.smeltTime = value;
break;
case 3:
EndStoneSmelterBlockEntity.this.smeltTimeTotal = value;
}
}
public int size() {
return 4;
}
};
this.registerFuels();
}
private void registerFuels() {
registerFuel(Items.LAVA_BUCKET, 16000);
registerFuel(Blocks.COAL_BLOCK, 12000);
registerFuel(Items.BLAZE_ROD, 2000);
}
private boolean isBurning() {
return this.burnTime > 0;
}
@Override
public int size() {
return this.inventory.size();
}
@Override
public boolean isEmpty() {
Iterator<ItemStack> iterator = this.inventory.iterator();
ItemStack itemStack;
do {
if (!iterator.hasNext()) {
return true;
}
itemStack = iterator.next();
} while (itemStack.isEmpty());
return false;
}
@Override
public ItemStack getStack(int slot) {
return this.inventory.get(slot);
}
@Override
public ItemStack removeStack(int slot, int amount) {
return Inventories.splitStack(this.inventory, slot, amount);
}
@Override
public ItemStack removeStack(int slot) {
return Inventories.removeStack(this.inventory, slot);
}
@Override
public void setStack(int slot, ItemStack stack) {
ItemStack itemStack = this.inventory.get(slot);
boolean stackValid = !stack.isEmpty() && stack.isItemEqualIgnoreDamage(itemStack) && ItemStack.areTagsEqual(stack, itemStack);
this.inventory.set(slot, stack);
if (stack.getCount() > getMaxCountPerStack()) {
stack.setCount(getMaxCountPerStack());
}
if ((slot == 0 || slot == 1) && !stackValid) {
this.smeltTimeTotal = this.getSmeltTime();
this.smeltTime = 0;
this.markDirty();
}
}
protected int getSmeltTime() {
int smeltTime = this.world.getRecipeManager().getFirstMatch(AlloyingRecipe.TYPE, this, world)
.map(AlloyingRecipe::getSmeltTime).orElse(0);
if (smeltTime == 0) {
smeltTime = this.world.getRecipeManager().getFirstMatch(RecipeType.BLASTING, this, world)
.map(BlastingRecipe::getCookTime).orElse(200);
smeltTime /= 1.5;
}
return smeltTime;
}
public void dropExperience(PlayerEntity player) {
List<Recipe<?>> list = Lists.newArrayList();
ObjectIterator<Entry<Identifier>> usedRecipes = this.recipesUsed.object2IntEntrySet().iterator();
while(usedRecipes.hasNext()) {
Entry<Identifier> entry = usedRecipes.next();
world.getRecipeManager().get(entry.getKey()).ifPresent((recipe) -> {
list.add(recipe);
if (recipe instanceof AlloyingRecipe) {
AlloyingRecipe alloying = (AlloyingRecipe) recipe;
this.dropExperience(player.world, player.getPos(), entry.getIntValue(), alloying.getExperience());
} else {
BlastingRecipe blasting = (BlastingRecipe) recipe;
this.dropExperience(player.world, player.getPos(), entry.getIntValue(), blasting.getExperience());
}
});
}
player.unlockRecipes(list);
this.recipesUsed.clear();
}
private void dropExperience(World world, Vec3d vec3d, int i, float f) {
int j = MathHelper.floor(i * f);
float g = MathHelper.fractionalPart(i * f);
if (g != 0.0F && Math.random() < g) {
j++;
}
while(j > 0) {
int k = ExperienceOrbEntity.roundToOrbSize(j);
j -= k;
world.spawnEntity(new ExperienceOrbEntity(world, vec3d.x, vec3d.y, vec3d.z, k));
}
}
@Override
public boolean canPlayerUse(PlayerEntity player) {
if (this.world.getBlockEntity(this.pos) != this) {
return false;
} else {
return player.squaredDistanceTo(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
}
}
@Override
public void clear() {
this.inventory.clear();
}
@Override
protected Text getContainerName() {
return new TranslatableText(String.format("block.%s.%s", BetterEnd.MOD_ID, EndStoneSmelter.ID));
}
@Override
protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) {
return new EndStoneSmelterScreenHandler(syncId, playerInventory, this, propertyDelegate);
}
@Override
public void tick() {
boolean initialBurning = this.isBurning();
boolean smelting = false;
if (initialBurning) {
this.burnTime--;
}
boolean burning = this.isBurning();
if (!this.world.isClient) {
ItemStack fuel = this.inventory.get(2);
if (!burning && (fuel.isEmpty() || inventory.get(0).isEmpty() && inventory.get(1).isEmpty())) {
if (!burning && smeltTime > 0) {
this.smeltTime = MathHelper.clamp(smeltTime - 2, 0, smeltTimeTotal);
}
} else {
Recipe<?> recipe = this.world.getRecipeManager().getFirstMatch(AlloyingRecipe.TYPE, this, world).orElse(null);
if (recipe == null) {
recipe = this.world.getRecipeManager().getFirstMatch(RecipeType.BLASTING, this, world).orElse(null);
}
boolean accepted = this.canAcceptRecipeOutput(recipe);
if (!burning && accepted) {
this.burnTime = this.getFuelTime(fuel);
this.fuelTime = this.burnTime;
burning = this.isBurning();
if (burning) {
smelting = true;
if (!fuel.isEmpty()) {
Item item = fuel.getItem();
fuel.decrement(1);
if (fuel.isEmpty()) {
Item remainFuel = item.getRecipeRemainder();
this.inventory.set(2, remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel));
}
}
}
}
if (burning && accepted) {
this.smeltTime++;
if (smeltTime == smeltTimeTotal) {
this.smeltTime = 0;
this.smeltTimeTotal = this.getSmeltTime();
this.craftRecipe(recipe);
smelting = true;
}
} else {
this.smeltTime = 0;
}
}
if (initialBurning != burning) {
smelting = true;
this.world.setBlockState(pos, world.getBlockState(pos).with(EndStoneSmelter.LIT, burning), 3);
}
}
if (smelting) {
this.markDirty();
}
}
protected boolean canAcceptRecipeOutput(Recipe<?> recipe) {
if (recipe == null) return false;
boolean validInput = false;
if (recipe instanceof AlloyingRecipe) {
validInput = !inventory.get(0).isEmpty() &&
!inventory.get(1).isEmpty();
} else {
validInput = !inventory.get(0).isEmpty() ||
!inventory.get(1).isEmpty();
}
if (validInput) {
ItemStack result = recipe.getOutput();
if (result.isEmpty()) {
return false;
} else {
ItemStack output = this.inventory.get(3);
int outCount = output.getCount();
int total = outCount + result.getCount();
if (output.isEmpty()) {
return true;
} else if (!output.isItemEqualIgnoreDamage(result)) {
return false;
} else if (outCount < this.getMaxCountPerStack() && outCount < output.getMaxCount()) {
return this.getMaxCountPerStack() >= total;
} else {
return output.getCount() < result.getMaxCount();
}
}
}
return false;
}
private void craftRecipe(Recipe<?> recipe) {
if (recipe == null || !canAcceptRecipeOutput(recipe)) return;
ItemStack result = recipe.getOutput();
ItemStack output = this.inventory.get(3);
if (output.isEmpty()) {
this.inventory.set(3, result.copy());
} else if (output.getItem() == result.getItem()) {
output.increment(result.getCount());
}
if (!this.world.isClient) {
this.setLastRecipe(recipe);
}
if (recipe instanceof AlloyingRecipe) {
this.inventory.get(0).decrement(1);
this.inventory.get(1).decrement(1);
} else {
if (!this.inventory.get(0).isEmpty()) {
this.inventory.get(0).decrement(1);
} else {
this.inventory.get(1).decrement(1);
}
}
}
@Override
public void provideRecipeInputs(RecipeFinder finder) {
Iterator<ItemStack> inventory = this.inventory.iterator();
while(inventory.hasNext()) {
ItemStack itemStack = inventory.next();
finder.addItem(itemStack);
}
}
@Override
public void setLastRecipe(Recipe<?> recipe) {
if (recipe != null) {
Identifier recipeId = recipe.getId();
this.recipesUsed.addTo(recipeId, 1);
this.lastRecipe = recipe;
}
}
@Override
public Recipe<?> getLastRecipe() {
return this.lastRecipe;
}
@Override
public int[] getAvailableSlots(Direction side) {
if (side == Direction.DOWN) {
return BOTTOM_SLOTS;
} else {
return side == Direction.UP ? TOP_SLOTS : SIDE_SLOTS;
}
}
@Override
public boolean canInsert(int slot, ItemStack stack, Direction dir) {
return this.isValid(slot, stack);
}
@Override
public boolean canExtract(int slot, ItemStack stack, Direction dir) {
if (dir == Direction.DOWN && slot == 2) {
if (stack.getItem() != Items.BUCKET) {
return false;
}
}
return true;
}
protected int getFuelTime(ItemStack fuel) {
if (fuel.isEmpty()) {
return 0;
} else {
Item item = fuel.getItem();
return availableFuels.getOrDefault(item, 0);
}
}
@Override
public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag);
this.inventory = DefaultedList.ofSize(size(), ItemStack.EMPTY);
Inventories.fromTag(tag, inventory);
this.burnTime = tag.getShort("BurnTime");
this.fuelTime = tag.getShort("FuelTime");
this.smeltTime = tag.getShort("SmeltTime");
this.smeltTimeTotal = tag.getShort("SmeltTimeTotal");
CompoundTag compoundTag = tag.getCompound("RecipesUsed");
Iterator<String> recipes = compoundTag.getKeys().iterator();
while(recipes.hasNext()) {
String id = recipes.next();
this.recipesUsed.put(new Identifier(id), compoundTag.getInt(id));
}
}
@Override
public CompoundTag toTag(CompoundTag tag) {
super.toTag(tag);
tag.putShort("BurnTime", (short) burnTime);
tag.putShort("FuelTime", (short) fuelTime);
tag.putShort("SmeltTime", (short) smeltTime);
tag.putShort("SmeltTimeTotal", (short) smeltTimeTotal);
Inventories.toTag(tag, inventory);
CompoundTag usedRecipes = new CompoundTag();
this.recipesUsed.forEach((identifier, integer) -> {
usedRecipes.putInt(identifier.toString(), integer);
});
tag.put("RecipesUsed", usedRecipes);
return tag;
}
public boolean isValid(int slot, ItemStack stack) {
if (slot == 3) {
return false;
} else if (slot != 0 || slot != 1) {
return true;
} else {
ItemStack itemStack = this.inventory.get(2);
return canUseAsFuel(stack) || stack.getItem() == Items.BUCKET && itemStack.getItem() != Items.BUCKET;
}
}
public static boolean canUseAsFuel(ItemStack stack) {
return availableFuels.containsKey(stack.getItem());
}
public static void registerFuel(ItemConvertible fuel, int time) {
if (availableFuels.containsKey(fuel)) {
availableFuels.replace(fuel.asItem(), time);
} else {
availableFuels.put(fuel.asItem(), time);
}
}
public static void registerFuel(Tag<Item> tag, int time) {
Iterator<Item> tagItems = tag.values().iterator();
tagItems.forEachRemaining(item -> registerFuel(item, time));
}
public static Map<Item, Integer> availableFuels() {
return availableFuels;
}
}
package ru.betterend.blocks.entities;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.LockableContainerBlockEntity;
import net.minecraft.entity.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.recipe.BlastingRecipe;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeFinder;
import net.minecraft.recipe.RecipeInputProvider;
import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.RecipeUnlocker;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.tag.Tag;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.minecraft.util.Tickable;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndStoneSmelter;
import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.EndBlockEntities;
public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity implements SidedInventory, RecipeUnlocker, RecipeInputProvider, Tickable {
private static final int[] TOP_SLOTS = new int[] { 0, 1 };
private static final int[] BOTTOM_SLOTS = new int[] { 2, 3 };
private static final int[] SIDE_SLOTS = new int[] { 3 };
private static final Map<Item, Integer> availableFuels = Maps.newHashMap();
private final Object2IntOpenHashMap<Identifier> recipesUsed;
protected DefaultedList<ItemStack> inventory;
protected final PropertyDelegate propertyDelegate;
private Recipe<?> lastRecipe;
private int smeltTimeTotal;
private int smeltTime;
private int burnTime;
private int fuelTime;
public EndStoneSmelterBlockEntity() {
super(EndBlockEntities.END_STONE_SMELTER);
this.inventory = DefaultedList.ofSize(4, ItemStack.EMPTY);
this.recipesUsed = new Object2IntOpenHashMap<Identifier>();
this.propertyDelegate = new PropertyDelegate() {
public int get(int index) {
switch(index) {
case 0:
return EndStoneSmelterBlockEntity.this.burnTime;
case 1:
return EndStoneSmelterBlockEntity.this.fuelTime;
case 2:
return EndStoneSmelterBlockEntity.this.smeltTime;
case 3:
return EndStoneSmelterBlockEntity.this.smeltTimeTotal;
default:
return 0;
}
}
public void set(int index, int value) {
switch(index) {
case 0:
EndStoneSmelterBlockEntity.this.burnTime = value;
break;
case 1:
EndStoneSmelterBlockEntity.this.fuelTime = value;
break;
case 2:
EndStoneSmelterBlockEntity.this.smeltTime = value;
break;
case 3:
EndStoneSmelterBlockEntity.this.smeltTimeTotal = value;
}
}
public int size() {
return 4;
}
};
this.registerFuels();
}
private void registerFuels() {
registerFuel(Items.LAVA_BUCKET, 16000);
registerFuel(Blocks.COAL_BLOCK, 12000);
registerFuel(Items.BLAZE_ROD, 2000);
}
private boolean isBurning() {
return this.burnTime > 0;
}
@Override
public int size() {
return this.inventory.size();
}
@Override
public boolean isEmpty() {
Iterator<ItemStack> iterator = this.inventory.iterator();
ItemStack itemStack;
do {
if (!iterator.hasNext()) {
return true;
}
itemStack = iterator.next();
} while (itemStack.isEmpty());
return false;
}
@Override
public ItemStack getStack(int slot) {
return this.inventory.get(slot);
}
@Override
public ItemStack removeStack(int slot, int amount) {
return Inventories.splitStack(this.inventory, slot, amount);
}
@Override
public ItemStack removeStack(int slot) {
return Inventories.removeStack(this.inventory, slot);
}
@Override
public void setStack(int slot, ItemStack stack) {
ItemStack itemStack = this.inventory.get(slot);
boolean stackValid = !stack.isEmpty() && stack.isItemEqualIgnoreDamage(itemStack) && ItemStack.areTagsEqual(stack, itemStack);
this.inventory.set(slot, stack);
if (stack.getCount() > getMaxCountPerStack()) {
stack.setCount(getMaxCountPerStack());
}
if ((slot == 0 || slot == 1) && !stackValid) {
this.smeltTimeTotal = this.getSmeltTime();
this.smeltTime = 0;
this.markDirty();
}
}
protected int getSmeltTime() {
int smeltTime = this.world.getRecipeManager().getFirstMatch(AlloyingRecipe.TYPE, this, world)
.map(AlloyingRecipe::getSmeltTime).orElse(0);
if (smeltTime == 0) {
smeltTime = this.world.getRecipeManager().getFirstMatch(RecipeType.BLASTING, this, world)
.map(BlastingRecipe::getCookTime).orElse(200);
smeltTime /= 1.5;
}
return smeltTime;
}
public void dropExperience(PlayerEntity player) {
List<Recipe<?>> list = Lists.newArrayList();
ObjectIterator<Entry<Identifier>> usedRecipes = this.recipesUsed.object2IntEntrySet().iterator();
while(usedRecipes.hasNext()) {
Entry<Identifier> entry = usedRecipes.next();
world.getRecipeManager().get(entry.getKey()).ifPresent((recipe) -> {
list.add(recipe);
if (recipe instanceof AlloyingRecipe) {
AlloyingRecipe alloying = (AlloyingRecipe) recipe;
this.dropExperience(player.world, player.getPos(), entry.getIntValue(), alloying.getExperience());
} else {
BlastingRecipe blasting = (BlastingRecipe) recipe;
this.dropExperience(player.world, player.getPos(), entry.getIntValue(), blasting.getExperience());
}
});
}
player.unlockRecipes(list);
this.recipesUsed.clear();
}
private void dropExperience(World world, Vec3d vec3d, int i, float f) {
int j = MathHelper.floor(i * f);
float g = MathHelper.fractionalPart(i * f);
if (g != 0.0F && Math.random() < g) {
j++;
}
while(j > 0) {
int k = ExperienceOrbEntity.roundToOrbSize(j);
j -= k;
world.spawnEntity(new ExperienceOrbEntity(world, vec3d.x, vec3d.y, vec3d.z, k));
}
}
@Override
public boolean canPlayerUse(PlayerEntity player) {
if (this.world.getBlockEntity(this.pos) != this) {
return false;
} else {
return player.squaredDistanceTo(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
}
}
@Override
public void clear() {
this.inventory.clear();
}
@Override
protected Text getContainerName() {
return new TranslatableText(String.format("block.%s.%s", BetterEnd.MOD_ID, EndStoneSmelter.ID));
}
@Override
protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) {
return new EndStoneSmelterScreenHandler(syncId, playerInventory, this, propertyDelegate);
}
@Override
public void tick() {
boolean initialBurning = this.isBurning();
boolean smelting = false;
if (initialBurning) {
this.burnTime--;
}
boolean burning = this.isBurning();
if (!this.world.isClient) {
ItemStack fuel = this.inventory.get(2);
if (!burning && (fuel.isEmpty() || inventory.get(0).isEmpty() && inventory.get(1).isEmpty())) {
if (!burning && smeltTime > 0) {
this.smeltTime = MathHelper.clamp(smeltTime - 2, 0, smeltTimeTotal);
}
} else {
Recipe<?> recipe = this.world.getRecipeManager().getFirstMatch(AlloyingRecipe.TYPE, this, world).orElse(null);
if (recipe == null) {
recipe = this.world.getRecipeManager().getFirstMatch(RecipeType.BLASTING, this, world).orElse(null);
}
boolean accepted = this.canAcceptRecipeOutput(recipe);
if (!burning && accepted) {
this.burnTime = this.getFuelTime(fuel);
this.fuelTime = this.burnTime;
burning = this.isBurning();
if (burning) {
smelting = true;
if (!fuel.isEmpty()) {
Item item = fuel.getItem();
fuel.decrement(1);
if (fuel.isEmpty()) {
Item remainFuel = item.getRecipeRemainder();
this.inventory.set(2, remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel));
}
}
}
}
if (burning && accepted) {
this.smeltTime++;
if (smeltTime == smeltTimeTotal) {
this.smeltTime = 0;
this.smeltTimeTotal = this.getSmeltTime();
this.craftRecipe(recipe);
smelting = true;
}
} else {
this.smeltTime = 0;
}
}
if (initialBurning != burning) {
smelting = true;
this.world.setBlockState(pos, world.getBlockState(pos).with(EndStoneSmelter.LIT, burning), 3);
}
}
if (smelting) {
this.markDirty();
}
}
protected boolean canAcceptRecipeOutput(Recipe<?> recipe) {
if (recipe == null) return false;
boolean validInput = false;
if (recipe instanceof AlloyingRecipe) {
validInput = !inventory.get(0).isEmpty() &&
!inventory.get(1).isEmpty();
} else {
validInput = !inventory.get(0).isEmpty() ||
!inventory.get(1).isEmpty();
}
if (validInput) {
ItemStack result = recipe.getOutput();
if (result.isEmpty()) {
return false;
} else {
ItemStack output = this.inventory.get(3);
int outCount = output.getCount();
int total = outCount + result.getCount();
if (output.isEmpty()) {
return true;
} else if (!output.isItemEqualIgnoreDamage(result)) {
return false;
} else if (outCount < this.getMaxCountPerStack() && outCount < output.getMaxCount()) {
return this.getMaxCountPerStack() >= total;
} else {
return output.getCount() < result.getMaxCount();
}
}
}
return false;
}
private void craftRecipe(Recipe<?> recipe) {
if (recipe == null || !canAcceptRecipeOutput(recipe)) return;
ItemStack result = recipe.getOutput();
ItemStack output = this.inventory.get(3);
if (output.isEmpty()) {
this.inventory.set(3, result.copy());
} else if (output.getItem() == result.getItem()) {
output.increment(result.getCount());
}
if (!this.world.isClient) {
this.setLastRecipe(recipe);
}
if (recipe instanceof AlloyingRecipe) {
this.inventory.get(0).decrement(1);
this.inventory.get(1).decrement(1);
} else {
if (!this.inventory.get(0).isEmpty()) {
this.inventory.get(0).decrement(1);
} else {
this.inventory.get(1).decrement(1);
}
}
}
@Override
public void provideRecipeInputs(RecipeFinder finder) {
Iterator<ItemStack> inventory = this.inventory.iterator();
while(inventory.hasNext()) {
ItemStack itemStack = inventory.next();
finder.addItem(itemStack);
}
}
@Override
public void setLastRecipe(Recipe<?> recipe) {
if (recipe != null) {
Identifier recipeId = recipe.getId();
this.recipesUsed.addTo(recipeId, 1);
this.lastRecipe = recipe;
}
}
@Override
public Recipe<?> getLastRecipe() {
return this.lastRecipe;
}
@Override
public int[] getAvailableSlots(Direction side) {
if (side == Direction.DOWN) {
return BOTTOM_SLOTS;
} else {
return side == Direction.UP ? TOP_SLOTS : SIDE_SLOTS;
}
}
@Override
public boolean canInsert(int slot, ItemStack stack, Direction dir) {
return this.isValid(slot, stack);
}
@Override
public boolean canExtract(int slot, ItemStack stack, Direction dir) {
if (dir == Direction.DOWN && slot == 2) {
if (stack.getItem() != Items.BUCKET) {
return false;
}
}
return true;
}
protected int getFuelTime(ItemStack fuel) {
if (fuel.isEmpty()) {
return 0;
} else {
Item item = fuel.getItem();
return availableFuels.getOrDefault(item, 0);
}
}
@Override
public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag);
this.inventory = DefaultedList.ofSize(size(), ItemStack.EMPTY);
Inventories.fromTag(tag, inventory);
this.burnTime = tag.getShort("BurnTime");
this.fuelTime = tag.getShort("FuelTime");
this.smeltTime = tag.getShort("SmeltTime");
this.smeltTimeTotal = tag.getShort("SmeltTimeTotal");
CompoundTag compoundTag = tag.getCompound("RecipesUsed");
Iterator<String> recipes = compoundTag.getKeys().iterator();
while(recipes.hasNext()) {
String id = recipes.next();
this.recipesUsed.put(new Identifier(id), compoundTag.getInt(id));
}
}
@Override
public CompoundTag toTag(CompoundTag tag) {
super.toTag(tag);
tag.putShort("BurnTime", (short) burnTime);
tag.putShort("FuelTime", (short) fuelTime);
tag.putShort("SmeltTime", (short) smeltTime);
tag.putShort("SmeltTimeTotal", (short) smeltTimeTotal);
Inventories.toTag(tag, inventory);
CompoundTag usedRecipes = new CompoundTag();
this.recipesUsed.forEach((identifier, integer) -> {
usedRecipes.putInt(identifier.toString(), integer);
});
tag.put("RecipesUsed", usedRecipes);
return tag;
}
public boolean isValid(int slot, ItemStack stack) {
if (slot == 3) {
return false;
} else if (slot != 0 || slot != 1) {
return true;
} else {
ItemStack itemStack = this.inventory.get(2);
return canUseAsFuel(stack) || stack.getItem() == Items.BUCKET && itemStack.getItem() != Items.BUCKET;
}
}
public static boolean canUseAsFuel(ItemStack stack) {
return availableFuels.containsKey(stack.getItem());
}
public static void registerFuel(ItemConvertible fuel, int time) {
if (availableFuels.containsKey(fuel)) {
availableFuels.replace(fuel.asItem(), time);
} else {
availableFuels.put(fuel.asItem(), time);
}
}
public static void registerFuel(Tag<Item> tag, int time) {
Iterator<Item> tagItems = tag.values().iterator();
tagItems.forEachRemaining(item -> registerFuel(item, time));
}
public static Map<Item, Integer> availableFuels() {
return availableFuels;
}
}

View file

@ -33,7 +33,7 @@ import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.basis.BlockChest;
import ru.betterend.blocks.entities.EChestBlockEntity;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndItems;
public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEntity> {
private static final HashMap<Integer, RenderLayer[]> LAYERS = Maps.newHashMap();
@ -162,7 +162,7 @@ public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEn
RenderLayer.getEntitySolid(new Identifier("textures/entity/chest/normal_right.png"))
};
ItemRegistry.getModBlocks().forEach((item) -> {
EndItems.getModBlocks().forEach((item) -> {
if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockChest) {

View file

@ -30,7 +30,7 @@ import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.basis.BlockSign;
import ru.betterend.blocks.entities.ESignBlockEntity;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndItems;
public class ESignBlockEntityRenderer extends BlockEntityRenderer<ESignBlockEntity> {
private static final HashMap<Integer, RenderLayer> LAYERS = Maps.newHashMap();
@ -106,7 +106,7 @@ public class ESignBlockEntityRenderer extends BlockEntityRenderer<ESignBlockEnti
static {
defaultLayer = RenderLayer.getEntitySolid(new Identifier("textures/entity/sign/oak.png"));
ItemRegistry.getModBlocks().forEach((item) -> {
EndItems.getModBlocks().forEach((item) -> {
if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockSign) {

View file

@ -4,19 +4,19 @@ import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.registry.Registry;
import ru.betterend.registry.BlockEntityRenderRegistry;
import ru.betterend.registry.EntityRenderRegistry;
import ru.betterend.registry.ParticleRegistry;
import ru.betterend.registry.ScreensRegistry;
import ru.betterend.registry.EndBlockEntityRenders;
import ru.betterend.registry.EndEntitiesRenders;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndScreens;
public class BetterEndClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
registerRenderLayers();
BlockEntityRenderRegistry.register();
ScreensRegistry.register();
ParticleRegistry.register();
EntityRenderRegistry.register();
EndBlockEntityRenders.register();
EndScreens.register();
EndParticles.register();
EndEntitiesRenders.register();
}
private void registerRenderLayers() {

View file

@ -1,90 +1,90 @@
package ru.betterend.compat;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.util.LangUtil;
public class REIAlloyingCategory implements TransferRecipeCategory<REIAlloyingDisplay> {
@Override
public @NotNull Identifier getIdentifier() {
return AlloyingRecipe.ID;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(BlockRegistry.END_STONE_SMELTER.getTranslationKey());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.END_STONE_SMELTER;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
double smeltTime = display.getSmeltTime();
DecimalFormat df = new DecimalFormat("###.##");
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5),
new TranslatableText("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
List<List<EntryStack>> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1)).markInput());
} else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList()).markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
return widgets;
}
@Override
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.push();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
DrawableHelper.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16, startPoint.y + 1 + 16, 1090453504);
DrawableHelper.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504);
}
matrices.pop();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 49;
}
}
package ru.betterend.compat;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.LangUtil;
public class REIAlloyingCategory implements TransferRecipeCategory<REIAlloyingDisplay> {
@Override
public @NotNull Identifier getIdentifier() {
return AlloyingRecipe.ID;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(EndBlocks.END_STONE_SMELTER.getTranslationKey());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.END_STONE_SMELTER;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
double smeltTime = display.getSmeltTime();
DecimalFormat df = new DecimalFormat("###.##");
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5),
new TranslatableText("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
List<List<EntryStack>> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1)).markInput());
} else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList()).markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
return widgets;
}
@Override
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.push();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
DrawableHelper.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16, startPoint.y + 1 + 16, 1090453504);
DrawableHelper.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504);
}
matrices.pop();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 49;
}
}

View file

@ -1,50 +1,50 @@
package ru.betterend.compat;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.api.plugins.REIPluginV0;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Blocks;
import net.minecraft.recipe.BlastingRecipe;
import net.minecraft.util.Identifier;
import ru.betterend.BetterEnd;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.recipe.builders.AnvilSmithingRecipe;
import ru.betterend.registry.BlockRegistry;
@Environment(EnvType.CLIENT)
public class REIPlugin implements REIPluginV0 {
public final static Identifier PLUGIN_ID = BetterEnd.makeID("rei_plugin");
public final static Identifier ALLOYING = AlloyingRecipe.ID;
public final static Identifier SMITHING = AnvilSmithingRecipe.ID;
public final static EntryStack END_STONE_SMELTER = EntryStack.create(BlockRegistry.END_STONE_SMELTER);
public final static EntryStack ANVIL = EntryStack.create(Blocks.ANVIL);
@Override
public Identifier getPluginIdentifier() {
return PLUGIN_ID;
}
@Override
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
recipeHelper.registerRecipes(ALLOYING, AlloyingRecipe.class, REIAlloyingDisplay::new);
recipeHelper.registerRecipes(ALLOYING, BlastingRecipe.class, REIAlloyingDisplay::new);
recipeHelper.registerRecipes(SMITHING, AnvilSmithingRecipe.class, REIAnvilDisplay::new);
}
@Override
public void registerOthers(RecipeHelper recipeHelper) {
recipeHelper.registerWorkingStations(ALLOYING, END_STONE_SMELTER);
recipeHelper.registerWorkingStations(SMITHING, ANVIL);
recipeHelper.removeAutoCraftButton(SMITHING);
}
@Override
public void registerPluginCategories(RecipeHelper recipeHelper) {
recipeHelper.registerCategories(new REIAlloyingCategory(),
new REIAnvilCategory());
}
}
package ru.betterend.compat;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.api.plugins.REIPluginV0;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Blocks;
import net.minecraft.recipe.BlastingRecipe;
import net.minecraft.util.Identifier;
import ru.betterend.BetterEnd;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.recipe.builders.AnvilSmithingRecipe;
import ru.betterend.registry.EndBlocks;
@Environment(EnvType.CLIENT)
public class REIPlugin implements REIPluginV0 {
public final static Identifier PLUGIN_ID = BetterEnd.makeID("rei_plugin");
public final static Identifier ALLOYING = AlloyingRecipe.ID;
public final static Identifier SMITHING = AnvilSmithingRecipe.ID;
public final static EntryStack END_STONE_SMELTER = EntryStack.create(EndBlocks.END_STONE_SMELTER);
public final static EntryStack ANVIL = EntryStack.create(Blocks.ANVIL);
@Override
public Identifier getPluginIdentifier() {
return PLUGIN_ID;
}
@Override
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
recipeHelper.registerRecipes(ALLOYING, AlloyingRecipe.class, REIAlloyingDisplay::new);
recipeHelper.registerRecipes(ALLOYING, BlastingRecipe.class, REIAlloyingDisplay::new);
recipeHelper.registerRecipes(SMITHING, AnvilSmithingRecipe.class, REIAnvilDisplay::new);
}
@Override
public void registerOthers(RecipeHelper recipeHelper) {
recipeHelper.registerWorkingStations(ALLOYING, END_STONE_SMELTER);
recipeHelper.registerWorkingStations(SMITHING, ANVIL);
recipeHelper.removeAutoCraftButton(SMITHING);
}
@Override
public void registerPluginCategories(RecipeHelper recipeHelper) {
recipeHelper.registerCategories(new REIAlloyingCategory(),
new REIAnvilCategory());
}
}

View file

@ -1,29 +1,29 @@
package ru.betterend.effects;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.item.Items;
import net.minecraft.potion.Potion;
import net.minecraft.potion.Potions;
import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
import ru.betterend.mixin.common.BrewingAccessor;
import ru.betterend.registry.ItemRegistry;
public class EndPotions {
public final static Potion END_VEIL = registerPotion("end_veil", EndStatusEffects.END_VEIL, 3600);
public final static Potion LONG_END_VEIL = registerPotion("long_end_veil", EndStatusEffects.END_VEIL, 9600);
public static Potion registerPotion(String name, StatusEffect effect, int duration) {
return registerPotion(name, new Potion(name, new StatusEffectInstance[]{ new StatusEffectInstance(effect, duration) }));
}
public static Potion registerPotion(String name, Potion potion) {
return Registry.register(Registry.POTION, BetterEnd.makeID(name), potion);
}
public static void register() {
BrewingAccessor.callRegisterPotionRecipe(Potions.AWKWARD, ItemRegistry.ENDER_DUST, END_VEIL);
BrewingAccessor.callRegisterPotionRecipe(END_VEIL, Items.REDSTONE, LONG_END_VEIL);
}
}
package ru.betterend.effects;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.item.Items;
import net.minecraft.potion.Potion;
import net.minecraft.potion.Potions;
import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
import ru.betterend.mixin.common.BrewingAccessor;
import ru.betterend.registry.EndItems;
public class EndPotions {
public final static Potion END_VEIL = registerPotion("end_veil", EndStatusEffects.END_VEIL, 3600);
public final static Potion LONG_END_VEIL = registerPotion("long_end_veil", EndStatusEffects.END_VEIL, 9600);
public static Potion registerPotion(String name, StatusEffect effect, int duration) {
return registerPotion(name, new Potion(name, new StatusEffectInstance[]{ new StatusEffectInstance(effect, duration) }));
}
public static Potion registerPotion(String name, Potion potion) {
return Registry.register(Registry.POTION, BetterEnd.makeID(name), potion);
}
public static void register() {
BrewingAccessor.callRegisterPotionRecipe(Potions.AWKWARD, EndItems.ENDER_DUST, END_VEIL);
BrewingAccessor.callRegisterPotionRecipe(END_VEIL, Items.REDSTONE, LONG_END_VEIL);
}
}

View file

@ -28,8 +28,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndSounds;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -109,7 +109,7 @@ public class EntityDragonfly extends AnimalEntity implements Flutterer {
@Override
public SoundEvent getAmbientSound() {
return SoundRegistry.ENTITY_DRAGONFLY;
return EndSounds.ENTITY_DRAGONFLY;
}
@Override
@ -184,6 +184,6 @@ public class EntityDragonfly extends AnimalEntity implements Flutterer {
@Override
public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
return EntityRegistry.DRAGONFLY.create(world);
return EndEntities.DRAGONFLY.create(world);
}
}

View file

@ -39,7 +39,7 @@ import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import ru.betterend.interfaces.ISlime;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -74,7 +74,7 @@ public class EntityEndSlime extends SlimeEntity {
@Override
public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, EntityData entityData, CompoundTag entityTag) {
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag);
if (BiomeRegistry.getFromBiome(world.getBiome(getBlockPos())) == BiomeRegistry.FOGGY_MUSHROOMLAND) {
if (EndBiomes.getFromBiome(world.getBiome(getBlockPos())) == EndBiomes.FOGGY_MUSHROOMLAND) {
this.setMossy(true);
}
this.calculateDimensions();
@ -154,7 +154,7 @@ public class EntityEndSlime extends SlimeEntity {
private static boolean isPermanentBiome(ServerWorldAccess world, BlockPos pos) {
Biome biome = world.getBiome(pos);
return BiomeRegistry.getFromBiome(biome) == BiomeRegistry.CHORUS_FOREST;
return EndBiomes.getFromBiome(biome) == EndBiomes.CHORUS_FOREST;
}
private static boolean notManyEntities(ServerWorldAccess world, BlockPos pos, int radius, int maxCount) {

View file

@ -1,88 +1,88 @@
package ru.betterend.item;
import java.util.function.Supplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Lazy;
import ru.betterend.registry.ItemRegistry;
public enum EndArmorMaterial implements ArmorMaterial {
TERMINITE("terminite", 26, new int[] { 3, 6, 7, 3 }, 14, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.0F, 0.05F, () -> {
return Ingredient.ofItems(ItemRegistry.TERMINITE_INGOT);
}),
AETERNIUM("aeternium", 40, new int[] { 4, 7, 9, 4 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 3.5F, 0.2F, () -> {
return Ingredient.ofItems(ItemRegistry.AETERNIUM_INGOT);
});
private static final int[] BASE_DURABILITY = new int[] { 13, 15, 16, 11 };
private final String name;
private final int durabilityMultiplier;
private final int[] protectionAmounts;
private final int enchantability;
private final SoundEvent equipSound;
private final float toughness;
private final float knockbackResistance;
private final Lazy<Ingredient> repairIngredient;
private EndArmorMaterial(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability,
SoundEvent equipSound, float toughness, float knockbackResistance,
Supplier<Ingredient> repairIngredient) {
this.name = name;
this.durabilityMultiplier = durabilityMultiplier;
this.protectionAmounts = protectionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairIngredient = new Lazy<>(repairIngredient);
}
@Override
public int getDurability(EquipmentSlot slot) {
return BASE_DURABILITY[slot.getEntitySlotId()] * this.durabilityMultiplier;
}
@Override
public int getProtectionAmount(EquipmentSlot slot) {
return this.protectionAmounts[slot.getEntitySlotId()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getEquipSound() {
return this.equipSound;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
@Override
@Environment(EnvType.CLIENT)
public String getName() {
return this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
}
package ru.betterend.item;
import java.util.function.Supplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Lazy;
import ru.betterend.registry.EndItems;
public enum EndArmorMaterial implements ArmorMaterial {
TERMINITE("terminite", 26, new int[] { 3, 6, 7, 3 }, 14, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.0F, 0.05F, () -> {
return Ingredient.ofItems(EndItems.TERMINITE_INGOT);
}),
AETERNIUM("aeternium", 40, new int[] { 4, 7, 9, 4 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 3.5F, 0.2F, () -> {
return Ingredient.ofItems(EndItems.AETERNIUM_INGOT);
});
private static final int[] BASE_DURABILITY = new int[] { 13, 15, 16, 11 };
private final String name;
private final int durabilityMultiplier;
private final int[] protectionAmounts;
private final int enchantability;
private final SoundEvent equipSound;
private final float toughness;
private final float knockbackResistance;
private final Lazy<Ingredient> repairIngredient;
private EndArmorMaterial(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability,
SoundEvent equipSound, float toughness, float knockbackResistance,
Supplier<Ingredient> repairIngredient) {
this.name = name;
this.durabilityMultiplier = durabilityMultiplier;
this.protectionAmounts = protectionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairIngredient = new Lazy<>(repairIngredient);
}
@Override
public int getDurability(EquipmentSlot slot) {
return BASE_DURABILITY[slot.getEntitySlotId()] * this.durabilityMultiplier;
}
@Override
public int getProtectionAmount(EquipmentSlot slot) {
return this.protectionAmounts[slot.getEntitySlotId()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getEquipSound() {
return this.equipSound;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
@Override
@Environment(EnvType.CLIENT)
public String getName() {
return this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
}

View file

@ -26,7 +26,7 @@ import net.minecraft.tag.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import ru.betterend.registry.ItemTagRegistry;
import ru.betterend.registry.EndTags;
public class EndHammer extends MiningToolItem implements DynamicAttributeTool {
@ -93,7 +93,7 @@ public class EndHammer extends MiningToolItem implements DynamicAttributeTool {
@Override
public float getMiningSpeedMultiplier(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
if (tag.equals(ItemTagRegistry.HAMMERS)) {
if (tag.equals(EndTags.HAMMERS)) {
return this.getMiningSpeedMultiplier(stack, state);
}
return 1.0F;
@ -101,7 +101,7 @@ public class EndHammer extends MiningToolItem implements DynamicAttributeTool {
@Override
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
if (tag.equals(ItemTagRegistry.HAMMERS)) {
if (tag.equals(EndTags.HAMMERS)) {
return this.getMaterial().getMiningLevel();
}
return 0;

View file

@ -1,66 +1,66 @@
package ru.betterend.item;
import java.util.function.Supplier;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.Lazy;
import ru.betterend.registry.ItemRegistry;
public enum EndToolMaterial implements ToolMaterial {
TERMINITE(3, 1230, 8.5F, 3.0F, 14, () -> {
return Ingredient.ofItems(ItemRegistry.TERMINITE_INGOT);
}),
AETERNIUM(5, 2196, 10.0F, 4.5F, 18, () -> {
return Ingredient.ofItems(ItemRegistry.AETERNIUM_INGOT);
});
private final int durability;
private final float miningSpeed;
private final float attackDamage;
private final int miningLevel;
private final int enchantability;
private final Lazy<Ingredient> repairIngredient;
private EndToolMaterial(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability,
Supplier<Ingredient> repairIngredient) {
this.durability = durability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
this.miningLevel = miningLevel;
this.enchantability = enchantability;
this.repairIngredient = new Lazy<>(repairIngredient);
}
@Override
public int getDurability() {
return this.durability;
}
@Override
public float getMiningSpeedMultiplier() {
return this.miningSpeed;
}
@Override
public float getAttackDamage() {
return this.attackDamage;
}
@Override
public int getMiningLevel() {
return this.miningLevel;
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
}
package ru.betterend.item;
import java.util.function.Supplier;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.Lazy;
import ru.betterend.registry.EndItems;
public enum EndToolMaterial implements ToolMaterial {
TERMINITE(3, 1230, 8.5F, 3.0F, 14, () -> {
return Ingredient.ofItems(EndItems.TERMINITE_INGOT);
}),
AETERNIUM(5, 2196, 10.0F, 4.5F, 18, () -> {
return Ingredient.ofItems(EndItems.AETERNIUM_INGOT);
});
private final int durability;
private final float miningSpeed;
private final float attackDamage;
private final int miningLevel;
private final int enchantability;
private final Lazy<Ingredient> repairIngredient;
private EndToolMaterial(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability,
Supplier<Ingredient> repairIngredient) {
this.durability = durability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
this.miningLevel = miningLevel;
this.enchantability = enchantability;
this.repairIngredient = new Lazy<>(repairIngredient);
}
@Override
public int getDurability() {
return this.durability;
}
@Override
public float getMiningSpeedMultiplier() {
return this.miningSpeed;
}
@Override
public float getAttackDamage() {
return this.attackDamage;
}
@Override
public int getMiningLevel() {
return this.miningLevel;
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
}

View file

@ -10,14 +10,14 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.RunedFlavolite;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndItems;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.PortalFrameHelper;
public class EternalCrystal extends Item {
public EternalCrystal() {
super(ItemRegistry.makeSettings());
super(EndItems.makeSettings());
}
public ActionResult useOnBlock(ItemUsageContext context) {

View file

@ -22,7 +22,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BackgroundInfo;
import ru.betterend.world.biome.EndBiome;
@ -73,7 +73,7 @@ public class BackgroundRendererMixin {
Biome biome = entity.world.getBiome(entity.getBlockPos());
FluidState fluidState = camera.getSubmergedFluidState();
if (biome.getCategory() == Category.THEEND && fluidState.isEmpty()) {
EndBiome endBiome = BiomeRegistry.getRenderBiome(biome);
EndBiome endBiome = EndBiomes.getRenderBiome(biome);
if (fogDensity == 0) {
fogDensity = endBiome.getFogDensity();

View file

@ -17,8 +17,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
@Mixin(BoneMealItem.class)
@ -31,7 +31,7 @@ public class BoneMealItemMixin {
World world = context.getWorld();
BlockPos blockPos = context.getBlockPos();
if (!world.isClient) {
if (world.getBlockState(blockPos).isIn(BlockTagRegistry.END_GROUND)) {
if (world.getBlockState(blockPos).isIn(EndTags.END_GROUND)) {
boolean consume = false;
if (world.getBlockState(blockPos).getBlock() == Blocks.END_STONE) {
BlockState nylium = beGetNylium(world, blockPos);
@ -82,14 +82,14 @@ public class BoneMealItemMixin {
private BlockState beGetGrassState(World world, BlockPos pos) {
BlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (block == BlockRegistry.END_MOSS || block == BlockRegistry.END_MYCELIUM) {
return world.random.nextBoolean() ? BlockRegistry.CREEPING_MOSS.getDefaultState() : BlockRegistry.UMBRELLA_MOSS.getDefaultState();
if (block == EndBlocks.END_MOSS || block == EndBlocks.END_MYCELIUM) {
return world.random.nextBoolean() ? EndBlocks.CREEPING_MOSS.getDefaultState() : EndBlocks.UMBRELLA_MOSS.getDefaultState();
}
else if (block == BlockRegistry.CAVE_MOSS) {
return BlockRegistry.CAVE_GRASS.getDefaultState();
else if (block == EndBlocks.CAVE_MOSS) {
return EndBlocks.CAVE_GRASS.getDefaultState();
}
else if (block == BlockRegistry.CHORUS_NYLIUM) {
return BlockRegistry.CHORUS_GRASS.getDefaultState();
else if (block == EndBlocks.CHORUS_NYLIUM) {
return EndBlocks.CHORUS_GRASS.getDefaultState();
}
return null;
}

View file

@ -25,8 +25,8 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
@Mixin(value = ChorusFlowerBlock.class, priority = 100)
@ -44,7 +44,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
private void beCanPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
if (world.getBlockState(pos.down()).isOf(EndBlocks.CHORUS_NYLIUM)) {
info.setReturnValue(true);
info.cancel();
}
@ -52,7 +52,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
private void beOnTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo info) {
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
if (world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) {
BlockPos up = pos.up();
if (world.isAir(up) && up.getY() < 256) {
int i = state.get(ChorusFlowerBlock.AGE);

View file

@ -20,8 +20,8 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
@Mixin(value = ChorusPlantBlock.class, priority = 100)
@ -44,7 +44,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
private void beConnectionProperties(BlockView world, BlockPos pos, CallbackInfoReturnable<BlockState> info) {
BlockState plant = info.getReturnValue();
if (plant.isOf(Blocks.CHORUS_PLANT)) {
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
if (world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) {
info.setReturnValue(plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true));
info.cancel();
}
@ -58,7 +58,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
private void beCanPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
BlockState down = world.getBlockState(pos.down());
if (down.isOf(BlockRegistry.CHORUS_NYLIUM) || down.isOf(Blocks.END_STONE)) {
if (down.isOf(EndBlocks.CHORUS_NYLIUM) || down.isOf(Blocks.END_STONE)) {
info.setReturnValue(true);
info.cancel();
}
@ -68,7 +68,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
private void beStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom, CallbackInfoReturnable<BlockState> info) {
BlockState plant = info.getReturnValue();
if (plant.isOf(Blocks.CHORUS_PLANT)) {
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
if (world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) {
plant = plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true);
info.cancel();
}
@ -86,7 +86,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
BlockPos pos = ctx.getBlockPos();
World world = ctx.getWorld();
BlockState plant = info.getReturnValue();
if (ctx.canPlace() && plant.isOf(Blocks.CHORUS_PLANT) && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
if (ctx.canPlace() && plant.isOf(Blocks.CHORUS_PLANT) && world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) {
info.setReturnValue(plant.with(BlocksHelper.ROOTS, true).with(Properties.DOWN, true));
info.cancel();
}

View file

@ -16,7 +16,7 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.ChorusPlantFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -24,7 +24,7 @@ import ru.betterend.util.MHelper;
public class ChorusPlantFeatureMixin {
@Inject(method = "generate", at = @At("HEAD"), cancellable = true)
private void onGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
if (structureWorldAccess.isAir(blockPos) && structureWorldAccess.getBlockState(blockPos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
if (structureWorldAccess.isAir(blockPos) && structureWorldAccess.getBlockState(blockPos.down()).isOf(EndBlocks.CHORUS_NYLIUM)) {
ChorusFlowerBlock.generate(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
BlockState bottom = structureWorldAccess.getBlockState(blockPos);
if (bottom.isOf(Blocks.CHORUS_PLANT)) {

View file

@ -6,7 +6,7 @@ import net.minecraft.network.PacketByteBuf;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleType;
import net.minecraft.util.registry.Registry;
import ru.betterend.registry.ParticleRegistry;
import ru.betterend.registry.EndParticles;
public class GlowingSphereParticleEffect implements ParticleEffect {
private final float red;
@ -21,7 +21,7 @@ public class GlowingSphereParticleEffect implements ParticleEffect {
@Override
public ParticleType<?> getType() {
return ParticleRegistry.GLOWING_SPHERE;
return EndParticles.GLOWING_SPHERE;
}
@Override

View file

@ -1,39 +1,39 @@
package ru.betterend.recipe;
import net.minecraft.block.Blocks;
import net.minecraft.item.Items;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.ItemRegistry;
public class AlloyingRecipes {
public static void register() {
AlloyingRecipe.Builder.create("additional_iron")
.setInput(Blocks.IRON_ORE, Blocks.IRON_ORE)
.setOutput(Items.IRON_INGOT, 3)
.setExpiriense(2.1F)
.build();
AlloyingRecipe.Builder.create("additional_gold")
.setInput(Blocks.GOLD_ORE, Blocks.GOLD_ORE)
.setOutput(Items.GOLD_INGOT, 3)
.setExpiriense(3F)
.build();
AlloyingRecipe.Builder.create("additional_netherite")
.setInput(Blocks.ANCIENT_DEBRIS, Blocks.ANCIENT_DEBRIS)
.setOutput(Items.NETHERITE_SCRAP, 3)
.setExpiriense(6F)
.setSmeltTime(500)
.build();
AlloyingRecipe.Builder.create("terminite_ingot")
.setInput(Items.IRON_INGOT, ItemRegistry.ENDER_DUST)
.setOutput(ItemRegistry.TERMINITE_INGOT, 1)
.setExpiriense(2.5F)
.setSmeltTime(450)
.build();
AlloyingRecipe.Builder.create("aeternium_ingot")
.setInput(ItemRegistry.TERMINITE_INGOT, Items.NETHERITE_INGOT)
.setOutput(ItemRegistry.AETERNIUM_INGOT, 1)
.setExpiriense(4.5F)
.setSmeltTime(600)
.build();
}
}
package ru.betterend.recipe;
import net.minecraft.block.Blocks;
import net.minecraft.item.Items;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.EndItems;
public class AlloyingRecipes {
public static void register() {
AlloyingRecipe.Builder.create("additional_iron")
.setInput(Blocks.IRON_ORE, Blocks.IRON_ORE)
.setOutput(Items.IRON_INGOT, 3)
.setExpiriense(2.1F)
.build();
AlloyingRecipe.Builder.create("additional_gold")
.setInput(Blocks.GOLD_ORE, Blocks.GOLD_ORE)
.setOutput(Items.GOLD_INGOT, 3)
.setExpiriense(3F)
.build();
AlloyingRecipe.Builder.create("additional_netherite")
.setInput(Blocks.ANCIENT_DEBRIS, Blocks.ANCIENT_DEBRIS)
.setOutput(Items.NETHERITE_SCRAP, 3)
.setExpiriense(6F)
.setSmeltTime(500)
.build();
AlloyingRecipe.Builder.create("terminite_ingot")
.setInput(Items.IRON_INGOT, EndItems.ENDER_DUST)
.setOutput(EndItems.TERMINITE_INGOT, 1)
.setExpiriense(2.5F)
.setSmeltTime(450)
.build();
AlloyingRecipe.Builder.create("aeternium_ingot")
.setInput(EndItems.TERMINITE_INGOT, Items.NETHERITE_INGOT)
.setOutput(EndItems.AETERNIUM_INGOT, 1)
.setExpiriense(4.5F)
.setSmeltTime(600)
.build();
}
}

View file

@ -4,85 +4,85 @@ import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import ru.betterend.recipe.builders.RecipeBuilder;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems;
public class CraftingRecipes {
public static void register() {
RecipeBuilder.make("ender_pearl_to_block", BlockRegistry.ENDER_BLOCK)
RecipeBuilder.make("ender_pearl_to_block", EndBlocks.ENDER_BLOCK)
.setShape(new String[] { "OO", "OO" })
.addMaterial('O', Items.ENDER_PEARL)
.build();
RecipeBuilder.make("ender_block_to_pearl", Items.ENDER_PEARL)
.addMaterial('#', BlockRegistry.ENDER_BLOCK)
.addMaterial('#', EndBlocks.ENDER_BLOCK)
.setOutputCount(4)
.setList("#")
.build();
RecipeBuilder.make("end_stone_smelter", BlockRegistry.END_STONE_SMELTER)
RecipeBuilder.make("end_stone_smelter", EndBlocks.END_STONE_SMELTER)
.setShape(new String[] { "###", "V V", "###" })
.addMaterial('#', Blocks.END_STONE_BRICKS)
.addMaterial('V', Items.BUCKET)
.build();
String material = "terminite";
RecipeBuilder.make(material + "_block", BlockRegistry.TERMINITE_BLOCK)
RecipeBuilder.make(material + "_block", EndBlocks.TERMINITE_BLOCK)
.setShape(new String[] { "III", "III", "III" })
.addMaterial('I', ItemRegistry.TERMINITE_INGOT)
.addMaterial('I', EndItems.TERMINITE_INGOT)
.build();
RecipeBuilder.make(material + "_block_to_ingot", ItemRegistry.TERMINITE_INGOT)
.addMaterial('#', BlockRegistry.TERMINITE_BLOCK)
RecipeBuilder.make(material + "_block_to_ingot", EndItems.TERMINITE_INGOT)
.addMaterial('#', EndBlocks.TERMINITE_BLOCK)
.setOutputCount(9)
.setList("#")
.build();
registerHelmet(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_HELMET);
registerChestplate(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_CHESTPLATE);
registerLeggings(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_LEGGINGS);
registerBoots(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_BOOTS);
registerShovel(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_SHOVEL);
registerSword(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_SWORD);
registerPickaxe(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_PICKAXE);
registerAxe(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_AXE);
registerHoe(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_HOE);
registerHammer(material, ItemRegistry.TERMINITE_INGOT, ItemRegistry.TERMINITE_HAMMER);
registerHelmet(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_HELMET);
registerChestplate(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_CHESTPLATE);
registerLeggings(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_LEGGINGS);
registerBoots(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_BOOTS);
registerShovel(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_SHOVEL);
registerSword(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_SWORD);
registerPickaxe(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_PICKAXE);
registerAxe(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_AXE);
registerHoe(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_HOE);
registerHammer(material, EndItems.TERMINITE_INGOT, EndItems.TERMINITE_HAMMER);
material = "aeternium";
RecipeBuilder.make(material + "_block", BlockRegistry.AETERNIUM_BLOCK)
RecipeBuilder.make(material + "_block", EndBlocks.AETERNIUM_BLOCK)
.setShape(new String[] { "III", "III", "III" })
.addMaterial('I', ItemRegistry.AETERNIUM_INGOT)
.addMaterial('I', EndItems.AETERNIUM_INGOT)
.build();
RecipeBuilder.make(material + "_block_to_ingot", ItemRegistry.AETERNIUM_INGOT)
.addMaterial('#', BlockRegistry.AETERNIUM_BLOCK)
RecipeBuilder.make(material + "_block_to_ingot", EndItems.AETERNIUM_INGOT)
.addMaterial('#', EndBlocks.AETERNIUM_BLOCK)
.setOutputCount(9)
.setList("#")
.build();
registerHelmet(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_HELMET);
registerChestplate(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_CHESTPLATE);
registerLeggings(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_LEGGINGS);
registerBoots(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_BOOTS);
registerShovel(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_SHOVEL);
registerSword(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_SWORD);
registerPickaxe(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_PICKAXE);
registerAxe(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_AXE);
registerHoe(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_HOE);
registerHammer(material, ItemRegistry.AETERNIUM_INGOT, ItemRegistry.AETERNIUM_HAMMER);
registerHelmet(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_HELMET);
registerChestplate(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_CHESTPLATE);
registerLeggings(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_LEGGINGS);
registerBoots(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_BOOTS);
registerShovel(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_SHOVEL);
registerSword(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_SWORD);
registerPickaxe(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_PICKAXE);
registerAxe(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_AXE);
registerHoe(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_HOE);
registerHammer(material, EndItems.AETERNIUM_INGOT, EndItems.AETERNIUM_HAMMER);
registerHammer("iron", Items.IRON_INGOT, ItemRegistry.IRON_HAMMER);
registerHammer("golden", Items.GOLD_INGOT, ItemRegistry.GOLDEN_HAMMER);
registerHammer("diamond", Items.DIAMOND, ItemRegistry.DIAMOND_HAMMER);
registerHammer("netherite", Items.NETHERITE_INGOT, ItemRegistry.NETHERITE_HAMMER);
registerHammer("iron", Items.IRON_INGOT, EndItems.IRON_HAMMER);
registerHammer("golden", Items.GOLD_INGOT, EndItems.GOLDEN_HAMMER);
registerHammer("diamond", Items.DIAMOND, EndItems.DIAMOND_HAMMER);
registerHammer("netherite", Items.NETHERITE_INGOT, EndItems.NETHERITE_HAMMER);
RecipeBuilder.make("blue_vine_seed_dye", Items.BLUE_DYE).setList("#").addMaterial('#', BlockRegistry.BLUE_VINE_SEED).build();
RecipeBuilder.make("creeping_moss_dye", Items.CYAN_DYE).setList("#").addMaterial('#', BlockRegistry.CREEPING_MOSS).build();
RecipeBuilder.make("umbrella_moss_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', BlockRegistry.UMBRELLA_MOSS).build();
RecipeBuilder.make("umbrella_moss_tall_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', BlockRegistry.UMBRELLA_MOSS_TALL).build();
RecipeBuilder.make("blue_vine_seed_dye", Items.BLUE_DYE).setList("#").addMaterial('#', EndBlocks.BLUE_VINE_SEED).build();
RecipeBuilder.make("creeping_moss_dye", Items.CYAN_DYE).setList("#").addMaterial('#', EndBlocks.CREEPING_MOSS).build();
RecipeBuilder.make("umbrella_moss_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', EndBlocks.UMBRELLA_MOSS).build();
RecipeBuilder.make("umbrella_moss_tall_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', EndBlocks.UMBRELLA_MOSS_TALL).build();
RecipeBuilder.make("paper", Items.PAPER).setShape("###").addMaterial('#', ItemRegistry.END_LILY_LEAF_DRIED).setOutputCount(3).build();
RecipeBuilder.make("paper", Items.PAPER).setShape("###").addMaterial('#', EndItems.END_LILY_LEAF_DRIED).setOutputCount(3).build();
RecipeBuilder.make("aurora_block", BlockRegistry.AURORA_CRYSTAL).setShape("##", "##").addMaterial('#', ItemRegistry.CRYSTAL_SHARDS).build();
RecipeBuilder.make("aurora_block", EndBlocks.AURORA_CRYSTAL).setShape("##", "##").addMaterial('#', EndItems.CRYSTAL_SHARDS).build();
}
private static void registerHelmet(String name, Item material, Item result) {

View file

@ -1,10 +1,10 @@
package ru.betterend.recipe;
import ru.betterend.recipe.builders.FurnaceRecipe;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndItems;
public class SmeltigRecipes {
public static void register() {
FurnaceRecipe.make("end_lily_leaf_dried", ItemRegistry.END_LILY_LEAF, ItemRegistry.END_LILY_LEAF_DRIED).build();
FurnaceRecipe.make("end_lily_leaf_dried", EndItems.END_LILY_LEAF, EndItems.END_LILY_LEAF_DRIED).build();
}
}

View file

@ -1,16 +1,16 @@
package ru.betterend.recipe;
import net.minecraft.item.Items;
import ru.betterend.recipe.builders.AnvilSmithingRecipe;
import ru.betterend.registry.ItemRegistry;
public class SmithingRecipes {
public static void register() {
AnvilSmithingRecipe.Builder.create("ender_pearl_to_dust")
.setInput(Items.ENDER_PEARL)
.setOutput(ItemRegistry.ENDER_DUST, 1)
.setLevel(4)
.setDamage(5)
.build();
}
}
package ru.betterend.recipe;
import net.minecraft.item.Items;
import ru.betterend.recipe.builders.AnvilSmithingRecipe;
import ru.betterend.registry.EndItems;
public class SmithingRecipes {
public static void register() {
AnvilSmithingRecipe.Builder.create("ender_pearl_to_dust")
.setInput(Items.ENDER_PEARL)
.setOutput(EndItems.ENDER_DUST, 1)
.setLevel(4)
.setDamage(5)
.build();
}
}

View file

@ -22,7 +22,7 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.recipe.EndRecipeManager;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.RecipeHelper;
public class AlloyingRecipe implements Recipe<Inventory> {
@ -113,7 +113,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
@Environment(EnvType.CLIENT)
public ItemStack getRecipeKindIcon() {
return new ItemStack(BlockRegistry.END_STONE_SMELTER);
return new ItemStack(EndBlocks.END_STONE_SMELTER);
}
public static class Builder {

View file

@ -23,7 +23,7 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.recipe.EndRecipeManager;
import ru.betterend.registry.ItemTagRegistry;
import ru.betterend.registry.EndTags;
import ru.betterend.util.RecipeHelper;
public class AnvilSmithingRecipe implements Recipe<Inventory> {
@ -81,7 +81,7 @@ public class AnvilSmithingRecipe implements Recipe<Inventory> {
public boolean matches(Inventory craftingInventory) {
ItemStack hammer = craftingInventory.getStack(0);
if (hammer.isEmpty() || !ItemTagRegistry.HAMMERS.contains(hammer.getItem())) {
if (hammer.isEmpty() || !EndTags.HAMMERS.contains(hammer.getItem())) {
return false;
}
int level = ((ToolItem) hammer.getItem()).getMaterial().getMiningLevel();
@ -95,7 +95,7 @@ public class AnvilSmithingRecipe implements Recipe<Inventory> {
@Override
public DefaultedList<Ingredient> getPreviewInputs() {
DefaultedList<Ingredient> defaultedList = DefaultedList.of();
defaultedList.add(Ingredient.ofStacks(ItemTagRegistry.HAMMERS.values().stream().filter(hammer -> {
defaultedList.add(Ingredient.ofStacks(EndTags.HAMMERS.values().stream().filter(hammer -> {
return ((ToolItem) hammer).getMaterial().getMiningLevel() >= level;
}).map(ItemStack::new)));
defaultedList.add(input);

View file

@ -28,7 +28,7 @@ import ru.betterend.world.biome.EndBiome;
import ru.betterend.world.generator.BiomePicker;
import ru.betterend.world.generator.BiomeType;
public class BiomeRegistry {
public class EndBiomes {
private static final Map<EndBiome, RegistryKey<Biome>> KEYS = Maps.newHashMap();
private static final HashMap<Identifier, EndBiome> ID_MAP = Maps.newHashMap();
private static final HashMap<Biome, EndBiome> MUTABLE = Maps.newHashMap();
@ -59,15 +59,15 @@ public class BiomeRegistry {
public static void register() {}
public static void mutateRegistry(Registry<Biome> biomeRegistry) {
BiomeRegistry.biomeRegistry = biomeRegistry;
EndBiomes.biomeRegistry = biomeRegistry;
BiomeRegistry.MUTABLE.clear();
EndBiomes.MUTABLE.clear();
LAND_BIOMES.clearMutables();
for (EndBiome biome : BiomeRegistry.LAND_BIOMES.getBiomes())
BiomeRegistry.MUTABLE.put(biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(biome)), biome);
for (EndBiome biome : BiomeRegistry.VOID_BIOMES.getBiomes())
BiomeRegistry.MUTABLE.put(biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(biome)), biome);
for (EndBiome biome : EndBiomes.LAND_BIOMES.getBiomes())
EndBiomes.MUTABLE.put(biomeRegistry.getOrThrow(EndBiomes.getBiomeKey(biome)), biome);
for (EndBiome biome : EndBiomes.VOID_BIOMES.getBiomes())
EndBiomes.MUTABLE.put(biomeRegistry.getOrThrow(EndBiomes.getBiomeKey(biome)), biome);
biomeRegistry.forEach((biome) -> {
if (biome.getCategory() == Category.THEEND) {
@ -166,8 +166,8 @@ public class BiomeRegistry {
public static List<EndBiome> getModBiomes() {
List<EndBiome> result = Lists.newArrayList();
result.addAll(BiomeRegistry.LAND_BIOMES.getBiomes());
result.addAll(BiomeRegistry.VOID_BIOMES.getBiomes());
result.addAll(EndBiomes.LAND_BIOMES.getBiomes());
result.addAll(EndBiomes.VOID_BIOMES.getBiomes());
return result;
}
}

View file

@ -19,9 +19,9 @@ import ru.betterend.blocks.entities.EChestBlockEntity;
import ru.betterend.blocks.entities.ESignBlockEntity;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
public class BlockEntityRegistry {
public class EndBlockEntities {
public final static BlockEntityType<EndStoneSmelterBlockEntity> END_STONE_SMELTER = registerBlockEntity(EndStoneSmelter.ID,
BlockEntityType.Builder.create(EndStoneSmelterBlockEntity::new, BlockRegistry.END_STONE_SMELTER));
BlockEntityType.Builder.create(EndStoneSmelterBlockEntity::new, EndBlocks.END_STONE_SMELTER));
public static final BlockEntityType<EChestBlockEntity> CHEST = registerBlockEntity("chest",
BlockEntityType.Builder.create(EChestBlockEntity::new, getChests()));
public static final BlockEntityType<EBarrelBlockEntity> BARREL = registerBlockEntity("barrel",
@ -37,7 +37,7 @@ public class BlockEntityRegistry {
static Block[] getChests() {
List<Block> result = Lists.newArrayList();
ItemRegistry.getModBlocks().forEach((item) -> {
EndItems.getModBlocks().forEach((item) -> {
if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockChest) {
@ -50,7 +50,7 @@ public class BlockEntityRegistry {
static Block[] getBarrels() {
List<Block> result = Lists.newArrayList();
ItemRegistry.getModBlocks().forEach((item) -> {
EndItems.getModBlocks().forEach((item) -> {
if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockBarrel) {
@ -63,7 +63,7 @@ public class BlockEntityRegistry {
static Block[] getSigns() {
List<Block> result = Lists.newArrayList();
ItemRegistry.getModBlocks().forEach((item) -> {
EndItems.getModBlocks().forEach((item) -> {
if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockSign) {

View file

@ -6,10 +6,10 @@ import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegi
import ru.betterend.blocks.entities.render.EChestBlockEntityRenderer;
import ru.betterend.blocks.entities.render.ESignBlockEntityRenderer;
public class BlockEntityRenderRegistry {
public class EndBlockEntityRenders {
@Environment(EnvType.CLIENT)
public static void register() {
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityRegistry.CHEST, EChestBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityRegistry.SIGN, ESignBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.CHEST, EChestBlockEntityRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.SIGN, ESignBlockEntityRenderer::new);
}
}

View file

@ -46,7 +46,7 @@ import ru.betterend.blocks.complex.StoneMaterial;
import ru.betterend.blocks.complex.WoodenMaterial;
import ru.betterend.tab.CreativeTab;
public class BlockRegistry {
public class EndBlocks {
// Terrain //
public static final Block ENDSTONE_DUST = registerBlock("endstone_dust", new BlockEndstoneDust());
public static final Block END_MYCELIUM = registerBlock("end_mycelium", new BlockTerrain(MaterialColor.LIGHT_BLUE));
@ -108,7 +108,7 @@ public class BlockRegistry {
public static final Block DENSE_VINE = registerBlock("dense_vine", new BlockVine(15, true));
// Ores //
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3));
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(EndItems.ENDER_DUST, 1, 3));
// Materials //
public static final Block TERMINITE_BLOCK = registerBlock("terminite_block", new TerminiteBlock());
@ -127,7 +127,7 @@ public class BlockRegistry {
public static Block registerBlock(String name, Block block) {
Registry.register(Registry.BLOCK, BetterEnd.makeID(name), block);
ItemRegistry.registerItem(name, new BlockItem(block, new Item.Settings().group(CreativeTab.END_TAB)));
EndItems.registerItem(name, new BlockItem(block, new Item.Settings().group(CreativeTab.END_TAB)));
return block;
}

View file

@ -17,7 +17,7 @@ import ru.betterend.entity.EntityEndSlime;
import ru.betterend.util.MHelper;
import ru.betterend.util.SpawnHelper;
public class EntityRegistry {
public class EndEntities {
public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), true, MHelper.color(32, 42, 176), MHelper.color(115, 225, 249));
public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 2F, 2F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), false, MHelper.color(28, 28, 28), MHelper.color(99, 11, 99));
public static final EntityType<EntityEndFish> END_FISH = register("end_fish", SpawnGroup.WATER_AMBIENT, 0.5F, 0.5F, EntityEndFish::new, EntityEndFish.createMobAttributes(), true, MHelper.color(3, 50, 76), MHelper.color(120, 206, 255));
@ -35,7 +35,7 @@ public class EntityRegistry {
private static <T extends LivingEntity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity, Builder attributes, boolean fixedSize, int eggColor, int dotsColor) {
EntityType<T> type = Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), FabricEntityTypeBuilder.<T>create(group, entity).dimensions(fixedSize ? EntityDimensions.fixed(width, height) : EntityDimensions.changing(width, height)).build());
FabricDefaultAttributeRegistry.register(type, attributes);
ItemRegistry.registerEgg("spawn_egg_" + name, type, eggColor, dotsColor);
EndItems.registerEgg("spawn_egg_" + name, type, eggColor, dotsColor);
return type;
}
}

View file

@ -7,12 +7,12 @@ import ru.betterend.entity.render.RendererEntityDragonfly;
import ru.betterend.entity.render.RendererEntityEndFish;
import ru.betterend.entity.render.RendererEntityEndSlime;
public class EntityRenderRegistry {
public class EndEntitiesRenders {
public static void register() {
register(EntityRegistry.DRAGONFLY, RendererEntityDragonfly.class);
register(EntityRegistry.END_SLIME, RendererEntityEndSlime.class);
register(EntityRegistry.END_FISH, RendererEntityEndFish.class);
register(EndEntities.DRAGONFLY, RendererEntityDragonfly.class);
register(EndEntities.END_SLIME, RendererEntityEndSlime.class);
register(EndEntities.END_FISH, RendererEntityEndFish.class);
}
private static void register(EntityType<?> type, Class<? extends MobEntityRenderer<?, ?>> renderer) {

View file

@ -28,7 +28,7 @@ import ru.betterend.world.features.SinglePlantFeature;
import ru.betterend.world.features.UnderwaterPlantFeature;
import ru.betterend.world.features.VineFeature;
public class FeatureRegistry {
public class EndFeatures {
// Trees //
public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
public static final EndFeature PYTHADENDRON_TREE = new EndFeature("pythadendron_tree", new PythadendronTreeFeature(), 2);
@ -37,17 +37,17 @@ public class FeatureRegistry {
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new PythadendronBushFeature(), 4);
// Plants //
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(BlockRegistry.UMBRELLA_MOSS, BlockRegistry.UMBRELLA_MOSS_TALL, 5), 5);
public static final EndFeature CREEPING_MOSS = new EndFeature("creeping_moss", new SinglePlantFeature(BlockRegistry.CREEPING_MOSS, 5), 5);
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS_TALL, 5), 5);
public static final EndFeature CREEPING_MOSS = new EndFeature("creeping_moss", new SinglePlantFeature(EndBlocks.CREEPING_MOSS, 5), 5);
public static final EndFeature BLUE_VINE = new EndFeature("blue_vine", new BlueVineFeature(), 1);
public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(BlockRegistry.CHORUS_GRASS, 4), 5);
public static final EndFeature CAVE_GRASS = new EndFeature("cave_grass", new CavePlantFeature(BlockRegistry.CAVE_GRASS, 7), 7);
public static final EndFeature CRYSTAL_GRASS = new EndFeature("crystal_grass", new SinglePlantFeature(BlockRegistry.CRYSTAL_GRASS, 8, false), 5);
public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4), 5);
public static final EndFeature CAVE_GRASS = new EndFeature("cave_grass", new CavePlantFeature(EndBlocks.CAVE_GRASS, 7), 7);
public static final EndFeature CRYSTAL_GRASS = new EndFeature("crystal_grass", new SinglePlantFeature(EndBlocks.CRYSTAL_GRASS, 8, false), 5);
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(BlockRegistry.DENSE_VINE, 24), 3);
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);
public static final EndFeature BUBBLE_CORAL = new EndFeature("bubble_coral", new UnderwaterPlantFeature(BlockRegistry.BUBBLE_CORAL, 10), 10);
public static final EndFeature BUBBLE_CORAL_RARE = new EndFeature("bubble_coral_rare", new UnderwaterPlantFeature(BlockRegistry.BUBBLE_CORAL, 3), 2);
public static final EndFeature BUBBLE_CORAL = new EndFeature("bubble_coral", new UnderwaterPlantFeature(EndBlocks.BUBBLE_CORAL, 10), 10);
public static final EndFeature BUBBLE_CORAL_RARE = new EndFeature("bubble_coral_rare", new UnderwaterPlantFeature(EndBlocks.BUBBLE_CORAL, 3), 2);
public static final EndFeature END_LILY = new EndFeature("end_lily", new EndLilyFeature(10), 10);
public static final EndFeature END_LILY_RARE = new EndFeature("end_lily_rare", new EndLilyFeature(3), 1);
public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(7), 5);
@ -60,13 +60,13 @@ public class FeatureRegistry {
public static final EndFeature ROUND_CAVE_RARE = EndFeature.makeRawGenFeature("round_cave_rare", new RoundCaveFeature(), 25);
// Ores //
public static final EndFeature ENDER_ORE = EndFeature.makeOreFeature("ender_ore", BlockRegistry.ENDER_ORE, 6, 3, 0, 4, 96);
public static final EndFeature VIOLECITE_LAYER = EndFeature.makeLayerFeature("violecite_layer", BlockRegistry.VIOLECITE, 15, 4, 96, 8);
public static final EndFeature FLAVOLITE_LAYER = EndFeature.makeLayerFeature("flavolite_layer", BlockRegistry.FLAVOLITE, 12, 4, 96, 6);
public static final EndFeature ENDER_ORE = EndFeature.makeOreFeature("ender_ore", EndBlocks.ENDER_ORE, 6, 3, 0, 4, 96);
public static final EndFeature VIOLECITE_LAYER = EndFeature.makeLayerFeature("violecite_layer", EndBlocks.VIOLECITE, 15, 4, 96, 8);
public static final EndFeature FLAVOLITE_LAYER = EndFeature.makeLayerFeature("flavolite_layer", EndBlocks.FLAVOLITE, 12, 4, 96, 6);
// Other //
public static final EndPortalFeature END_PORTAL = new EndPortalFeature(new DefaultEndPortalFeature(), (RunedFlavolite) BlockRegistry.FLAVOLITE_RUNED);
public static final EndPortalFeature END_PORTAL_ETERNAL = new EndPortalFeature(new DefaultEndPortalFeature(), (RunedFlavolite) BlockRegistry.FLAVOLITE_RUNED_ETERNAL);
public static final EndPortalFeature END_PORTAL = new EndPortalFeature(new DefaultEndPortalFeature(), (RunedFlavolite) EndBlocks.FLAVOLITE_RUNED);
public static final EndPortalFeature END_PORTAL_ETERNAL = new EndPortalFeature(new DefaultEndPortalFeature(), (RunedFlavolite) EndBlocks.FLAVOLITE_RUNED_ETERNAL);
public static void registerBiomeFeatures(Identifier id, Biome biome, List<List<Supplier<ConfiguredFeature<?, ?>>>> features) {
if (id.getNamespace().equals("minecraft")) {

View file

@ -36,7 +36,7 @@ import ru.betterend.item.EternalCrystal;
import ru.betterend.tab.CreativeTab;
import ru.betterend.util.TagHelper;
public class ItemRegistry {
public class EndItems {
private static final List<Item> MOD_BLOCKS = Lists.newArrayList();
private static final List<Item> MOD_ITEMS = Lists.newArrayList();
@ -105,7 +105,7 @@ public class ItemRegistry {
} else if (item instanceof EndHoe) {
TagHelper.addTag((Tag.Identified<Item>) FabricToolTags.HOES, item);
} else if (item instanceof EndHammer) {
TagHelper.addTag((Tag.Identified<Item>) ItemTagRegistry.HAMMERS, item);
TagHelper.addTag((Tag.Identified<Item>) EndTags.HAMMERS, item);
}
return item;

View file

@ -8,7 +8,7 @@ import ru.betterend.BetterEnd;
import ru.betterend.particle.ParticleGlowingSphere;
import ru.betterend.particle.PaticlePortalSphere;
public class ParticleRegistry {
public class EndParticles {
public static final DefaultParticleType GLOWING_SPHERE = register("glowing_sphere");
public static final DefaultParticleType PORTAL_SPHERE = register("portal_sphere");

View file

@ -1,11 +1,11 @@
package ru.betterend.registry;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import ru.betterend.client.gui.EndStoneSmelterScreen;
import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
public class ScreensRegistry {
public static void register() {
ScreenRegistry.register(EndStoneSmelterScreenHandler.HANDLER_TYPE, EndStoneSmelterScreen::new);
}
}
package ru.betterend.registry;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import ru.betterend.client.gui.EndStoneSmelterScreen;
import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
public class EndScreens {
public static void register() {
ScreenRegistry.register(EndStoneSmelterScreenHandler.HANDLER_TYPE, EndStoneSmelterScreen::new);
}
}

View file

@ -4,7 +4,7 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
public class SoundRegistry {
public class EndSounds {
// Music
public static final SoundEvent MUSIC_FOGGY_MUSHROOMLAND = register("music", "foggy_mushroomland");
public static final SoundEvent MUSIC_CHORUS_FOREST = register("music", "chorus_forest");
@ -16,6 +16,7 @@ public class SoundRegistry {
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");
public static final SoundEvent AMBIENT_CHORUS_FOREST = register("ambient", "chorus_forest");
public static final SoundEvent AMBIENT_MEGALAKE = register("ambient", "megalake");
public static final SoundEvent AMBIENT_DUST_WASTELANDS = register("ambient", "dust_wastelands");
// Entity
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly");

View file

@ -21,7 +21,7 @@ import ru.betterend.world.structures.piece.MountainPiece;
import ru.betterend.world.structures.piece.PaintedMountainPiece;
import ru.betterend.world.structures.piece.VoxelPiece;
public class StructureRegistry {
public class EndStructures {
public static final StructurePieceType VOXEL_PIECE = register("voxel", VoxelPiece::new);
public static final StructurePieceType MOUNTAIN_PIECE = register("mountain_piece", MountainPiece::new);
public static final StructurePieceType CAVE_PIECE = register("cave_piece", CavePiece::new);

View file

@ -1,12 +1,18 @@
package ru.betterend.registry;
import java.util.Arrays;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.fabricmc.fabric.impl.tool.attribute.ToolManagerImpl;
import net.fabricmc.fabric.impl.tool.attribute.handlers.ModdedToolsVanillaBlocksToolHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.tag.Tag.Identified;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category;
@ -15,18 +21,22 @@ import ru.betterend.BetterEnd;
import ru.betterend.blocks.BlockTerrain;
import ru.betterend.util.TagHelper;
public class BlockTagRegistry {
public class EndTags {
// Block Tags
public static final Tag.Identified<Block> END_GROUND = makeTag("end_ground");
public static final Tag.Identified<Block> GEN_TERRAIN = makeTag("gen_terrain");
// Item Tags
public final static Tag<Item> HAMMERS = registerFabricItemTag("hammers");
private static Tag.Identified<Block> makeTag(String name) {
return (Identified<Block>) TagRegistry.block(BetterEnd.makeID(name));
}
public static void register() {
addSurfaceBlock(BlockRegistry.ENDSTONE_DUST);
addSurfaceBlock(EndBlocks.ENDSTONE_DUST);
ItemRegistry.getModBlocks().forEach((item) -> {
EndItems.getModBlocks().forEach((item) -> {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockTerrain) {
addSurfaceBlock(block);
@ -34,7 +44,18 @@ public class BlockTagRegistry {
}
});
TagHelper.addTag(GEN_TERRAIN, BlockRegistry.ENDER_ORE, BlockRegistry.FLAVOLITE.stone, BlockRegistry.VIOLECITE.stone);
TagHelper.addTag(GEN_TERRAIN, EndBlocks.ENDER_ORE, EndBlocks.FLAVOLITE.stone, EndBlocks.VIOLECITE.stone);
ToolManagerImpl.tag(HAMMERS).register(new ModdedToolsVanillaBlocksToolHandler(
Arrays.asList(
EndItems.IRON_HAMMER,
EndItems.GOLDEN_HAMMER,
EndItems.DIAMOND_HAMMER,
EndItems.NETHERITE_HAMMER,
EndItems.TERMINITE_HAMMER,
EndItems.AETERNIUM_HAMMER
)
));
}
public static void addSurfaceBlock(Block block) {
@ -54,4 +75,12 @@ public class BlockTagRegistry {
public static boolean validGenBlock(BlockState block) {
return block.isIn(END_GROUND) || block.isIn(GEN_TERRAIN);
}
public static Tag<Item> registerItemTag(String name) {
return TagRegistry.item(BetterEnd.makeID(name));
}
public static Tag<Item> registerFabricItemTag(String name) {
return TagRegistry.item(new Identifier("fabric", name));
}
}

View file

@ -1,36 +0,0 @@
package ru.betterend.registry;
import java.util.Arrays;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.fabricmc.fabric.impl.tool.attribute.ToolManagerImpl;
import net.fabricmc.fabric.impl.tool.attribute.handlers.ModdedToolsVanillaBlocksToolHandler;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import ru.betterend.BetterEnd;
public class ItemTagRegistry {
public final static Tag<Item> HAMMERS = registerFabricItemTag("hammers");
public static Tag<Item> registerItemTag(String name) {
return TagRegistry.item(BetterEnd.makeID(name));
}
public static Tag<Item> registerFabricItemTag(String name) {
return TagRegistry.item(new Identifier("fabric", name));
}
public static void register() {
ToolManagerImpl.tag(HAMMERS).register(new ModdedToolsVanillaBlocksToolHandler(
Arrays.asList(
ItemRegistry.IRON_HAMMER,
ItemRegistry.GOLDEN_HAMMER,
ItemRegistry.DIAMOND_HAMMER,
ItemRegistry.NETHERITE_HAMMER,
ItemRegistry.TERMINITE_HAMMER,
ItemRegistry.AETERNIUM_HAMMER
)
));
}
}

View file

@ -5,16 +5,16 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import ru.betterend.BetterEnd;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems;
public class CreativeTab {
public static final ItemGroup END_TAB = FabricItemGroupBuilder.create(BetterEnd.makeID("items"))
.icon(() -> new ItemStack(BlockRegistry.END_MYCELIUM)).appendItems(stacks -> {
for (Item i : ItemRegistry.getModBlocks()) {
.icon(() -> new ItemStack(EndBlocks.END_MYCELIUM)).appendItems(stacks -> {
for (Item i : EndItems.getModBlocks()) {
stacks.add(new ItemStack(i));
}
for (Item i : ItemRegistry.getModItems()) {
for (Item i : EndItems.getModItems()) {
stacks.add(new ItemStack(i));
}
}).build();

View file

@ -24,8 +24,8 @@ import net.minecraft.world.WorldAccess;
import ru.betterend.blocks.BlockBlueVine;
import ru.betterend.blocks.basis.BlockDoublePlant;
import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
public class BlocksHelper {
public static final BooleanProperty ROOTS = BooleanProperty.of("roots");
@ -229,7 +229,7 @@ public class BlocksHelper {
else if (!state.canPlaceAt(world, POS)) {
// Blue Vine
if (state.getBlock() instanceof BlockBlueVine) {
while (state.isOf(BlockRegistry.BLUE_VINE) || state.isOf(BlockRegistry.BLUE_VINE_LANTERN) || state.isOf(BlockRegistry.BLUE_VINE_FUR)) {
while (state.isOf(EndBlocks.BLUE_VINE) || state.isOf(EndBlocks.BLUE_VINE_LANTERN) || state.isOf(EndBlocks.BLUE_VINE_FUR)) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
for (Direction dir : HORIZONTAL) {
BlockPos p = POS.offset(dir);
@ -266,7 +266,7 @@ public class BlocksHelper {
}
public static boolean isEndNylium(Block block) {
return block.isIn(BlockTags.NYLIUM) && block.isIn(BlockTagRegistry.END_GROUND);
return block.isIn(BlockTags.NYLIUM) && block.isIn(EndTags.END_GROUND);
}
public static boolean isEndNylium(BlockState state) {

View file

@ -13,8 +13,8 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import ru.betterend.mixin.common.GenerationSettingsAccessor;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndStructures;
public class FeaturesHelper {
private static final Set<Biome> INJECTED = Sets.newHashSet();
@ -30,8 +30,8 @@ public class FeaturesHelper {
features.add(Lists.newArrayList(list));
});
FeatureRegistry.registerBiomeFeatures(biomeRegistry.getId(biome), biome, features);
StructureRegistry.registerBiomeStructures(biomeRegistry.getId(biome), biome, structures);
EndFeatures.registerBiomeFeatures(biomeRegistry.getId(biome), biome, features);
EndStructures.registerBiomeStructures(biomeRegistry.getId(biome), biome, structures);
accessor.setFeatures(features);
accessor.setStructures(structures);

View file

@ -8,8 +8,8 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class PortalFrameHelper {
@ -79,7 +79,7 @@ public class PortalFrameHelper {
if(!checkIsAreaEmpty(world, bottomCorner.add(0, 1, 1), topCorner.add(0, -1, -1))) return false;
}
if (valid) {
if (world.getBlockState(bottomCorner).isOf(BlockRegistry.FLAVOLITE_RUNED)) {
if (world.getBlockState(bottomCorner).isOf(EndBlocks.FLAVOLITE_RUNED)) {
generatePortalFrame(world, bottomCorner, axis, width, height, true);
} else {
generateEternalPortalFrame(world, bottomCorner, axis, width, height, true);
@ -164,18 +164,18 @@ public class PortalFrameHelper {
}
public static void generatePortalFrame(ServerWorld world, BlockPos pos, Direction.Axis axis, int width, int height, boolean active) {
FeatureRegistry.END_PORTAL.configure(axis, width, height, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
EndFeatures.END_PORTAL.configure(axis, width, height, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
}
public static void generateEternalPortalFrame(ServerWorld world, BlockPos pos, Direction.Axis axis, int width, int height, boolean active) {
FeatureRegistry.END_PORTAL_ETERNAL.configure(axis, width, height, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
EndFeatures.END_PORTAL_ETERNAL.configure(axis, width, height, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
}
public static void generatePortalFrame(ServerWorld world, BlockPos pos, Direction.Axis axis, boolean active) {
FeatureRegistry.END_PORTAL.configure(axis, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
EndFeatures.END_PORTAL.configure(axis, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
}
public static void generateEternalPortalFrame(ServerWorld world, BlockPos pos, Direction.Axis axis, boolean active) {
FeatureRegistry.END_PORTAL_ETERNAL.configure(axis, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
EndFeatures.END_PORTAL_ETERNAL.configure(axis, active).getFeatureConfigured().generate(world, world.getChunkManager().getChunkGenerator(), new Random(), pos);
}
}

View file

@ -10,8 +10,8 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import ru.betterend.BetterEnd;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.ItemRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;
public class TranslationHelper {
public static void printMissingNames() {
@ -24,7 +24,7 @@ public class TranslationHelper {
JsonObject translationEn = gson.fromJson(new InputStreamReader(streamEn), JsonObject.class);
JsonObject translationRu = gson.fromJson(new InputStreamReader(streamRu), JsonObject.class);
ItemRegistry.getModBlocks().forEach((block) -> {
EndItems.getModBlocks().forEach((block) -> {
String name = block.getName().getString();
if (!translationEn.has(name)) {
missingNamesEn.add(name);
@ -34,7 +34,7 @@ public class TranslationHelper {
}
});
ItemRegistry.getModItems().forEach((item) -> {
EndItems.getModItems().forEach((item) -> {
String name = item.getName().getString();
if (!translationEn.has(name)) {
missingNamesEn.add(name);
@ -44,7 +44,7 @@ public class TranslationHelper {
}
});
BiomeRegistry.getModBiomes().forEach((endBiome) -> {
EndBiomes.getModBiomes().forEach((endBiome) -> {
if (endBiome.getID().getNamespace().equals(BetterEnd.MOD_ID)) {
String name = "biome." + BetterEnd.MOD_ID + "." + endBiome.getID().getPath();
if (!translationEn.has(name)) {

View file

@ -5,10 +5,10 @@ import net.minecraft.particle.ParticleTypes;
import net.minecraft.world.gen.GenerationStep.Feature;
import net.minecraft.world.gen.feature.ConfiguredFeatures;
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
public class BiomeChorusForest extends EndBiome {
public BiomeChorusForest() {
@ -16,19 +16,19 @@ public class BiomeChorusForest extends EndBiome {
.setFogColor(87, 26, 87)
.setFogDensity(1.5F)
.setPlantsColor(122, 45, 122)
.setSurface(BlockRegistry.CHORUS_NYLIUM)
.setSurface(EndBlocks.CHORUS_NYLIUM)
.setParticles(ParticleTypes.PORTAL, 0.01F)
.setLoop(SoundRegistry.AMBIENT_CHORUS_FOREST)
.setMusic(SoundRegistry.MUSIC_CHORUS_FOREST)
.addFeature(FeatureRegistry.VIOLECITE_LAYER)
.addFeature(FeatureRegistry.END_LAKE_RARE)
.addFeature(FeatureRegistry.PYTHADENDRON_TREE)
.addFeature(FeatureRegistry.PYTHADENDRON_BUSH)
.setLoop(EndSounds.AMBIENT_CHORUS_FOREST)
.setMusic(EndSounds.MUSIC_CHORUS_FOREST)
.addFeature(EndFeatures.VIOLECITE_LAYER)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(EndFeatures.PYTHADENDRON_TREE)
.addFeature(EndFeatures.PYTHADENDRON_BUSH)
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
.addFeature(FeatureRegistry.CHORUS_GRASS)
.addFeature(EndFeatures.CHORUS_GRASS)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addMobSpawn(EntityRegistry.END_SLIME, 5, 1, 2)
.addMobSpawn(EndEntities.END_SLIME, 5, 1, 2)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
}
}

View file

@ -1,20 +1,20 @@
package ru.betterend.world.biome;
import net.minecraft.entity.EntityType;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures;
public class BiomeCrystalMountains extends EndBiome {
public BiomeCrystalMountains() {
super(new BiomeDefinition("crystal_mountains")
.setPlantsColor(255, 133, 211)
.setSurface(BlockRegistry.CRYSTAL_MOSS)
.setMusic(SoundRegistry.MUSIC_CRYSTAL_MOUNTAINS)
.addStructureFeature(StructureRegistry.MOUNTAIN)
.addFeature(FeatureRegistry.ROUND_CAVE)
.addFeature(FeatureRegistry.CRYSTAL_GRASS)
.setSurface(EndBlocks.CRYSTAL_MOSS)
.setMusic(EndSounds.MUSIC_CRYSTAL_MOUNTAINS)
.addStructureFeature(EndStructures.MOUNTAIN)
.addFeature(EndFeatures.ROUND_CAVE)
.addFeature(EndFeatures.CRYSTAL_GRASS)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}
}

View file

@ -3,8 +3,8 @@ package ru.betterend.world.biome;
import net.minecraft.entity.EntityType;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndSounds;
public class BiomeDustWastelands extends EndBiome {
public BiomeDustWastelands() {
@ -13,10 +13,10 @@ public class BiomeDustWastelands extends EndBiome {
.setFogDensity(2)
.setWaterColor(192, 180, 131)
.setWaterFogColor(192, 180, 131)
.setSurface(BlockRegistry.ENDSTONE_DUST)
.setSurface(EndBlocks.ENDSTONE_DUST)
.setParticles(ParticleTypes.WHITE_ASH, 0.01F)
//.setLoop(SoundRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
.setMusic(SoundRegistry.DUST_WASTELANDS)
.setLoop(EndSounds.AMBIENT_DUST_WASTELANDS)
.setMusic(EndSounds.DUST_WASTELANDS)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}

View file

@ -2,12 +2,12 @@ package ru.betterend.world.biome;
import net.minecraft.entity.EntityType;
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.ParticleRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures;
public class BiomeFoggyMushroomland extends EndBiome {
public BiomeFoggyMushroomland() {
@ -17,23 +17,23 @@ public class BiomeFoggyMushroomland extends EndBiome {
.setFogDensity(3)
.setWaterColor(119, 227, 250)
.setWaterFogColor(119, 227, 250)
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
.setLoop(SoundRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
.setMusic(SoundRegistry.MUSIC_FOGGY_MUSHROOMLAND)
.addStructureFeature(StructureRegistry.GIANT_MOSSY_GLOWSHROOM)
.addFeature(FeatureRegistry.END_LAKE)
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)
.addFeature(FeatureRegistry.BLUE_VINE)
.addFeature(FeatureRegistry.UMBRELLA_MOSS)
.addFeature(FeatureRegistry.CREEPING_MOSS)
.addFeature(FeatureRegistry.DENSE_VINE)
.addFeature(FeatureRegistry.END_LILY)
.addFeature(FeatureRegistry.BUBBLE_CORAL)
.setSurface(EndBlocks.END_MOSS, EndBlocks.END_MYCELIUM)
.setParticles(EndParticles.GLOWING_SPHERE, 0.001F)
.setLoop(EndSounds.AMBIENT_FOGGY_MUSHROOMLAND)
.setMusic(EndSounds.MUSIC_FOGGY_MUSHROOMLAND)
.addStructureFeature(EndStructures.GIANT_MOSSY_GLOWSHROOM)
.addFeature(EndFeatures.END_LAKE)
.addFeature(EndFeatures.MOSSY_GLOWSHROOM)
.addFeature(EndFeatures.BLUE_VINE)
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.CREEPING_MOSS)
.addFeature(EndFeatures.DENSE_VINE)
.addFeature(EndFeatures.END_LILY)
.addFeature(EndFeatures.BUBBLE_CORAL)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addMobSpawn(EntityRegistry.DRAGONFLY, 80, 2, 5)
.addMobSpawn(EntityRegistry.END_FISH, 20, 2, 5)
.addMobSpawn(EntityRegistry.END_SLIME, 10, 1, 2)
.addMobSpawn(EndEntities.DRAGONFLY, 80, 2, 5)
.addMobSpawn(EndEntities.END_FISH, 20, 2, 5)
.addMobSpawn(EndEntities.END_SLIME, 10, 1, 2)
.addMobSpawn(EntityType.ENDERMAN, 10, 1, 2));
}
}

View file

@ -2,11 +2,11 @@ package ru.betterend.world.biome;
import net.minecraft.entity.EntityType;
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures;
public class BiomeMegalake extends EndBiome {
public BiomeMegalake() {
@ -16,19 +16,19 @@ public class BiomeMegalake extends EndBiome {
.setWaterColor(96, 163, 255)
.setWaterFogColor(96, 163, 255)
.setFogDensity(1.75F)
.setMusic(SoundRegistry.MUSIC_MEGALAKE)
.setLoop(SoundRegistry.AMBIENT_MEGALAKE)
.setSurface(BlockRegistry.ENDSTONE_DUST, BlockRegistry.END_MOSS)
.addStructureFeature(StructureRegistry.MEGALAKE)
.setMusic(EndSounds.MUSIC_MEGALAKE)
.setLoop(EndSounds.AMBIENT_MEGALAKE)
.setSurface(EndBlocks.ENDSTONE_DUST, EndBlocks.END_MOSS)
.addStructureFeature(EndStructures.MEGALAKE)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addFeature(FeatureRegistry.END_LOTUS)
.addFeature(FeatureRegistry.END_LOTUS_LEAF)
.addFeature(FeatureRegistry.BUBBLE_CORAL_RARE)
.addFeature(FeatureRegistry.END_LILY_RARE)
.addFeature(FeatureRegistry.UMBRELLA_MOSS)
.addFeature(FeatureRegistry.CREEPING_MOSS)
.addMobSpawn(EntityRegistry.DRAGONFLY, 50, 1, 3)
.addMobSpawn(EntityRegistry.END_FISH, 50, 3, 8)
.addFeature(EndFeatures.END_LOTUS)
.addFeature(EndFeatures.END_LOTUS_LEAF)
.addFeature(EndFeatures.BUBBLE_CORAL_RARE)
.addFeature(EndFeatures.END_LILY_RARE)
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.CREEPING_MOSS)
.addMobSpawn(EndEntities.DRAGONFLY, 50, 1, 3)
.addMobSpawn(EndEntities.END_FISH, 50, 3, 8)
.addMobSpawn(EntityType.ENDERMAN, 10, 1, 2));
}
}

View file

@ -2,9 +2,9 @@ package ru.betterend.world.biome;
import net.minecraft.entity.EntityType;
import net.minecraft.particle.ParticleTypes;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndSounds;
import ru.betterend.registry.EndStructures;
public class BiomePaintedMountains extends EndBiome {
public BiomePaintedMountains() {
@ -13,10 +13,11 @@ public class BiomePaintedMountains extends EndBiome {
.setFogDensity(2)
.setWaterColor(192, 180, 131)
.setWaterFogColor(192, 180, 131)
.setMusic(SoundRegistry.DUST_WASTELANDS)
.setSurface(BlockRegistry.ENDSTONE_DUST)
.setMusic(EndSounds.DUST_WASTELANDS)
.setLoop(EndSounds.AMBIENT_DUST_WASTELANDS)
.setSurface(EndBlocks.ENDSTONE_DUST)
.setParticles(ParticleTypes.WHITE_ASH, 0.01F)
.addStructureFeature(StructureRegistry.PAINTED_MOUNTAIN)
.addStructureFeature(EndStructures.PAINTED_MOUNTAIN)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}
}

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -20,16 +20,16 @@ public class BlueVineFeature extends ScatterFeature {
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F + random.nextFloat() * 0.4F;
small = d > 0.5F;
return BlockRegistry.BLUE_VINE_SEED.canPlaceAt(AIR, world, blockPos);
return EndBlocks.BLUE_VINE_SEED.canPlaceAt(AIR, world, blockPos);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
if (small) {
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.BLUE_VINE_SEED.getDefaultState().with(BlockPlantWithAge.AGE, random.nextInt(4)));
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.BLUE_VINE_SEED.getDefaultState().with(BlockPlantWithAge.AGE, random.nextInt(4)));
}
else {
BlockPlantWithAge seed = ((BlockPlantWithAge) BlockRegistry.BLUE_VINE_SEED);
BlockPlantWithAge seed = ((BlockPlantWithAge) EndBlocks.BLUE_VINE_SEED);
seed.grow(world, random, blockPos);
}
}

View file

@ -8,7 +8,7 @@ import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -27,21 +27,21 @@ public class CaveBushFeature extends FullHeightScatterFeature {
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return world.getBlockState(blockPos.down()).isOf(BlockRegistry.CAVE_MOSS);
return world.getBlockState(blockPos.down()).isOf(EndBlocks.CAVE_MOSS);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
float radius = MHelper.randRange(0.8F, 2.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.CAVE_BUSH);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.CAVE_BUSH);
sphere = new SDFScale3D().setScale(MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random)).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, blockPos);
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.CAVE_BUSH);
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.CAVE_BUSH);
}
static {

View file

@ -8,8 +8,8 @@ import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -29,22 +29,22 @@ public class CaveBushFeatureCeil extends InvertedScatterFeature {
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return world.isAir(blockPos.down())
&& world.getBlockState(blockPos.up()).isIn(BlockTagRegistry.GEN_TERRAIN)
&& world.getBlockState(blockPos.down(BlocksHelper.downRay(world, blockPos.down(), 64) + 2)).isIn(BlockTagRegistry.GEN_TERRAIN);
&& world.getBlockState(blockPos.up()).isIn(EndTags.GEN_TERRAIN)
&& world.getBlockState(blockPos.down(BlocksHelper.downRay(world, blockPos.down(), 64) + 2)).isIn(EndTags.GEN_TERRAIN);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
float radius = MHelper.randRange(1.0F, 3.2F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.CAVE_BUSH);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.CAVE_BUSH);
sphere = new SDFScale3D().setScale(MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random)).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, blockPos.down());
BlocksHelper.setWithoutUpdate(world, blockPos.down(), BlockRegistry.CAVE_BUSH);
BlocksHelper.setWithoutUpdate(world, blockPos.down(), EndBlocks.CAVE_BUSH);
}
static {

View file

@ -10,7 +10,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.Feature;
import ru.betterend.blocks.EndPortalBlock;
import ru.betterend.blocks.RunedFlavolite;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class DefaultEndPortalFeature extends Feature<EndPortalFeatureConfig> {
@ -24,7 +24,7 @@ public class DefaultEndPortalFeature extends Feature<EndPortalFeatureConfig> {
EndPortalFeatureConfig config) {
BlockState portalFrame = config.frameBlock.getDefaultState().with(RunedFlavolite.ACTIVATED, config.activated);
BlockState portalBlock = BlockRegistry.END_PORTAL_BLOCK.getDefaultState().with(EndPortalBlock.AXIS, config.axis);
BlockState portalBlock = EndBlocks.END_PORTAL_BLOCK.getDefaultState().with(EndPortalBlock.AXIS, config.axis);
BlockPos bottomCorner = pos;
BlockPos topCorner;
int width = config.width - 1;

View file

@ -12,8 +12,8 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -108,18 +108,18 @@ public class EndLakeFeature extends DefaultFeature {
r *= r;
if (x2 + z2 <= r) {
state = world.getBlockState(POS);
if (state.isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (state.isIn(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS, AIR);
}
pos = POS.down();
if (world.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (world.getBlockState(pos).isIn(EndTags.GEN_TERRAIN)) {
state = world.getBiome(pos).getGenerationSettings().getSurfaceConfig().getTopMaterial();
if (y > waterLevel + 1)
BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state : BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, pos, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.getDefaultState());
else
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.ENDSTONE_DUST.getDefaultState());
}
}
}
@ -163,8 +163,8 @@ public class EndLakeFeature extends DefaultFeature {
}*/
}
pos = POS.down();
if (world.getBlockState(pos).getBlock().isIn(BlockTagRegistry.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS.down(), BlockRegistry.ENDSTONE_DUST.getDefaultState());
if (world.getBlockState(pos).getBlock().isIn(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, POS.down(), EndBlocks.ENDSTONE_DUST.getDefaultState());
}
pos = POS.up();
while (canReplace(state = world.getBlockState(pos)) && !state.isAir() && state.getFluidState().isEmpty()) {
@ -180,11 +180,11 @@ public class EndLakeFeature extends DefaultFeature {
//if (world.getBlockState(POS).getMaterial().isReplaceable()) {
if (world.isAir(POS.up())) {
state = world.getBiome(POS).getGenerationSettings().getSurfaceConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS, random.nextBoolean() ? state : EndBlocks.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
}
else {
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.ENDSTONE_DUST.getDefaultState());
BlocksHelper.setWithoutUpdate(world, POS.down(), END_STONE);
}
//}
@ -216,8 +216,8 @@ public class EndLakeFeature extends DefaultFeature {
private boolean canReplace(BlockState state) {
return state.getMaterial().isReplaceable()
|| state.isIn(BlockTagRegistry.GEN_TERRAIN)
|| state.isOf(BlockRegistry.ENDSTONE_DUST)
|| state.isIn(EndTags.GEN_TERRAIN)
|| state.isOf(EndBlocks.ENDSTONE_DUST)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.UNDERWATER_PLANT)
|| state.getMaterial().equals(Material.UNUSED_PLANT);

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockEndLilySeed;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class EndLilyFeature extends UnderwaterPlantScatter {
public EndLilyFeature(int radius) {
@ -14,7 +14,7 @@ public class EndLilyFeature extends UnderwaterPlantScatter {
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlockEndLilySeed seed = (BlockEndLilySeed) BlockRegistry.END_LILY_SEED;
BlockEndLilySeed seed = (BlockEndLilySeed) EndBlocks.END_LILY_SEED;
seed.grow(world, random, blockPos);
}

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockEndLotusSeed;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
public class EndLotusFeature extends UnderwaterPlantScatter {
public EndLotusFeature(int radius) {
@ -14,7 +14,7 @@ public class EndLotusFeature extends UnderwaterPlantScatter {
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlockEndLotusSeed seed = (BlockEndLotusSeed) BlockRegistry.END_LOTUS_SEED;
BlockEndLotusSeed seed = (BlockEndLotusSeed) EndBlocks.END_LOTUS_SEED;
seed.grow(world, random, blockPos);
}

View file

@ -10,7 +10,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockEndLotusLeaf;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
public class EndLotusLeafFeature extends ScatterFeature {
@ -37,7 +37,7 @@ public class EndLotusLeafFeature extends ScatterFeature {
private void generateLeaf(StructureWorldAccess world, BlockPos pos) {
Mutable p = new Mutable();
BlockState leaf = BlockRegistry.END_LOTUS_LEAF.getDefaultState();
BlockState leaf = EndBlocks.END_LOTUS_LEAF.getDefaultState();
BlocksHelper.setWithoutUpdate(world, pos, leaf.with(BlockEndLotusLeaf.SHAPE, TripleShape.BOTTOM));
for (Direction move: BlocksHelper.HORIZONTAL) {
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.with(BlockEndLotusLeaf.HORIZONTAL_FACING, move).with(BlockEndLotusLeaf.SHAPE, TripleShape.MIDDLE));

View file

@ -17,8 +17,8 @@ import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper;
@ -56,21 +56,21 @@ public class MossyGlowshroomFeature extends DefaultFeature {
if (blockPos.getY() < 5) {
return false;
}
if (!world.getBlockState(blockPos.down()).isIn(BlockTagRegistry.END_GROUND)) {
if (!world.getBlockState(blockPos.down()).isIn(EndTags.END_GROUND)) {
return false;
}
CONE1.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_CAP);
CONE2.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_CAP);
CONE_GLOW.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE);
ROOTS.setBlock(BlockRegistry.MOSSY_GLOWSHROOM.bark);
CONE1.setBlock(EndBlocks.MOSSY_GLOWSHROOM_CAP);
CONE2.setBlock(EndBlocks.MOSSY_GLOWSHROOM_CAP);
CONE_GLOW.setBlock(EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE);
ROOTS.setBlock(EndBlocks.MOSSY_GLOWSHROOM.bark);
float height = MHelper.randRange(10F, 25F, random);
int count = MHelper.floor(height / 4);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, count);
SplineHelper.offsetParts(spline, random, 1F, 0, 1F);
SDF sdf = SplineHelper.buildSDF(spline, 2.1F, 1.5F, (pos) -> {
return BlockRegistry.MOSSY_GLOWSHROOM.log.getDefaultState();
return EndBlocks.MOSSY_GLOWSHROOM.log.getDefaultState();
});
Vector3f pos = spline.get(spline.size() - 1);
float scale = MHelper.randRange(0.75F, 1.1F, random);
@ -113,34 +113,34 @@ public class MossyGlowshroomFeature extends DefaultFeature {
.setSource(FUNCTION)
.setReplaceFunction(REPLACE)
.setPostProcess((info) -> {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
if (random.nextBoolean() && info.getStateUp().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_CAP) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
if (random.nextBoolean() && info.getStateUp().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
return info.getState();
}
else if (!BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM.bark.getDefaultState());
else if (!EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM.bark.getDefaultState());
return info.getState();
}
}
else if (info.getState().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_CAP) {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) {
if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
return info.getState();
}
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState());
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState());
return info.getState();
}
else if (info.getState().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE) {
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
for (Direction dir: BlocksHelper.HORIZONTAL) {
if (info.getState(dir) == AIR) {
info.setBlockPos(info.getPos().offset(dir), BlockRegistry.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
}
}
if (info.getStateDown().getBlock() != BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), BlockRegistry.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN));
if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN));
}
}
return info.getState();
@ -190,7 +190,7 @@ public class MossyGlowshroomFeature extends DefaultFeature {
FUNCTION = new SDFSmoothUnion().setRadius(4).setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS_ROT));
REPLACE = (state) -> {
if (state.isIn(BlockTagRegistry.END_GROUND)) {
if (state.isIn(EndTags.END_GROUND)) {
return true;
}
if (state.getMaterial().equals(Material.PLANT)) {

View file

@ -11,7 +11,7 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -26,18 +26,18 @@ public class PythadendronBushFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (world.getBlockState(pos.down()).getBlock() != BlockRegistry.CHORUS_NYLIUM) return false;
if (world.getBlockState(pos.down()).getBlock() != EndBlocks.CHORUS_NYLIUM) return false;
float radius = MHelper.randRange(1.8F, 4.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.PYTHADENDRON.bark);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.PYTHADENDRON.bark);
return true;
}

View file

@ -13,8 +13,8 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper;
@ -30,7 +30,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (world.getBlockState(pos.down()).getBlock() != BlockRegistry.CHORUS_NYLIUM) return false;
if (world.getBlockState(pos.down()).getBlock() != EndBlocks.CHORUS_NYLIUM) return false;
float size = MHelper.randRange(10, 20, random);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, size, 0, 4);
@ -42,11 +42,11 @@ public class PythadendronTreeFeature extends DefaultFeature {
branch(last.getX(), last.getY(), last.getZ(), size * bsize, MHelper.randRange(0, MHelper.PI2, random), random, depth, world, pos);
SDF function = SplineHelper.buildSDF(spline, 1.7F, 1.1F, (bpos) -> {
return BlockRegistry.PYTHADENDRON.bark.getDefaultState();
return EndBlocks.PYTHADENDRON.bark.getDefaultState();
});
function.setPostProcess((info) -> {
if (BlockRegistry.PYTHADENDRON.isTreeLog(info.getStateUp()) && BlockRegistry.PYTHADENDRON.isTreeLog(info.getStateDown())) {
return BlockRegistry.PYTHADENDRON.log.getDefaultState();
if (EndBlocks.PYTHADENDRON.isTreeLog(info.getStateUp()) && EndBlocks.PYTHADENDRON.isTreeLog(info.getStateDown())) {
return EndBlocks.PYTHADENDRON.log.getDefaultState();
}
return info.getState();
});
@ -73,14 +73,14 @@ public class PythadendronTreeFeature extends DefaultFeature {
SplineHelper.offsetParts(spline, random, 0.3F, 0, 0.3F);
Vector3f pos1 = spline.get(spline.size() - 1);
boolean s1 = SplineHelper.fillSpline(spline, world, BlockRegistry.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
boolean s1 = SplineHelper.fillSpline(spline, world, EndBlocks.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
spline = SplineHelper.makeSpline(x, y, z, x2, y, z2, 5);
SplineHelper.powerOffset(spline, size * MHelper.randRange(1.0F, 2.0F, random), 4);
SplineHelper.offsetParts(spline, random, 0.3F, 0, 0.3F);
Vector3f pos2 = spline.get(spline.size() - 1);
boolean s2 = SplineHelper.fillSpline(spline, world, BlockRegistry.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
boolean s2 = SplineHelper.fillSpline(spline, world, EndBlocks.PYTHADENDRON.bark.getDefaultState(), pos, REPLACE);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
if (depth < 3) {
@ -138,7 +138,7 @@ public class PythadendronTreeFeature extends DefaultFeature {
private void leavesBall(StructureWorldAccess world, BlockPos pos, Random random, OpenSimplexNoise noise) {
float radius = MHelper.randRange(4.5F, 6.5F, random);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.PYTHADENDRON_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
sphere = new SDFScale3D().setScale(1, 0.6F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
@ -150,17 +150,17 @@ public class PythadendronTreeFeature extends DefaultFeature {
int count = (int) (radius * 2.5F);
for (int i = 0; i < count; i++) {
BlockPos p = pos.add(random.nextGaussian() * 1.5, random.nextGaussian() * 1.5, random.nextGaussian() * 1.5);
BlocksHelper.setWithoutUpdate(world, p, BlockRegistry.PYTHADENDRON.bark);
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.PYTHADENDRON.bark);
}
}
}
static {
REPLACE = (state) -> {
if (state.isIn(BlockTagRegistry.END_GROUND)) {
if (state.isIn(EndTags.END_GROUND)) {
return true;
}
if (state.getBlock() == BlockRegistry.PYTHADENDRON_LEAVES) {
if (state.getBlock() == EndBlocks.PYTHADENDRON_LEAVES) {
return true;
}
if (state.getMaterial().equals(Material.PLANT)) {

View file

@ -16,9 +16,9 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
@ -45,7 +45,7 @@ public class RoundCaveFeature extends DefaultFeature {
bpos.setX(pos.getX());
bpos.setZ(pos.getZ());
bpos.setY(top);
while (top > bottom && !world.getBlockState(bpos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
while (top > bottom && !world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
bpos.setY(--top);
}
top -= radius + 5;
@ -69,7 +69,7 @@ public class RoundCaveFeature extends DefaultFeature {
double nr = radius * 0.25;
Set<BlockPos> bushes = Sets.newHashSet();
BlockState terrain = BlockRegistry.CAVE_MOSS.getDefaultState();
BlockState terrain = EndBlocks.CAVE_MOSS.getDefaultState();
for (int x = x1; x <= x2; x++) {
int xsq = x - pos.getX();
xsq *= xsq;
@ -105,7 +105,7 @@ public class RoundCaveFeature extends DefaultFeature {
}
}
bpos.setY(y - 1);
if (world.getBlockState(bpos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
BlocksHelper.setWithoutUpdate(world, bpos, terrain);
}
}
@ -114,16 +114,16 @@ public class RoundCaveFeature extends DefaultFeature {
if (!state.getFluidState().isEmpty()) {
BlocksHelper.setWithoutUpdate(world, bpos, Blocks.END_STONE.getDefaultState());
}
else if (world.getBlockState(bpos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
else if (world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
if (world.isAir(bpos.down())) {
int h = BlocksHelper.downRay(world, bpos.down(), 64);
if (h > 6 && h < 32 && world.getBlockState(bpos.down(h + 3)).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (h > 6 && h < 32 && world.getBlockState(bpos.down(h + 3)).isIn(EndTags.GEN_TERRAIN)) {
bushes.add(bpos.down());
}
}
else if (world.isAir(bpos.up())) {
int h = BlocksHelper.upRay(world, bpos.up(), 64);
if (h > 6 && h < 32 && world.getBlockState(bpos.up(h + 3)).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (h > 6 && h < 32 && world.getBlockState(bpos.up(h + 3)).isIn(EndTags.GEN_TERRAIN)) {
bushes.add(bpos.up());
}
}
@ -138,23 +138,23 @@ public class RoundCaveFeature extends DefaultFeature {
}
});
if (random.nextBoolean() && world.getBiome(pos).getGenerationSettings().hasStructureFeature(StructureRegistry.MOUNTAIN.getStructure())) {
if (random.nextBoolean() && world.getBiome(pos).getGenerationSettings().hasStructureFeature(EndStructures.MOUNTAIN.getStructure())) {
pos = pos.add(random.nextGaussian() * 5, random.nextGaussian() * 5, random.nextGaussian() * 5);
BlockPos down = pos.down(BlocksHelper.downRay(world, pos, 64) + 2);
if (isReplaceable(world.getBlockState(down))) {
SDF prism = new SDFHexPrism().setHeight(radius * MHelper.randRange(0.6F, 0.75F, random)).setRadius(MHelper.randRange(1.7F, 3F, random)).setBlock(BlockRegistry.AURORA_CRYSTAL);
SDF prism = new SDFHexPrism().setHeight(radius * MHelper.randRange(0.6F, 0.75F, random)).setRadius(MHelper.randRange(1.7F, 3F, random)).setBlock(EndBlocks.AURORA_CRYSTAL);
float angleY = MHelper.randRange(0, MHelper.PI2, random);
float vx = (float) Math.sin(angleY);
float vz = (float) Math.sin(angleY);
prism = new SDFRotation().setRotation(new Vector3f(vx, 0, vz), random.nextFloat()).setSource(prism);
prism.setReplaceFunction((state) -> {
return state.getMaterial().isReplaceable()
|| state.isIn(BlockTagRegistry.GEN_TERRAIN)
|| state.isIn(EndTags.GEN_TERRAIN)
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.LEAVES);
});
prism.fillRecursive(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.AURORA_CRYSTAL);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.AURORA_CRYSTAL);
}
}
@ -164,7 +164,7 @@ public class RoundCaveFeature extends DefaultFeature {
}
private boolean isReplaceable(BlockState state) {
return state.isIn(BlockTagRegistry.GEN_TERRAIN)
return state.isIn(EndTags.GEN_TERRAIN)
|| state.getMaterial().isReplaceable()
|| state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().equals(Material.LEAVES);
@ -173,12 +173,12 @@ public class RoundCaveFeature extends DefaultFeature {
private void generateBush(StructureWorldAccess world, Random random, BlockPos blockPos) {
float radius = MHelper.randRange(1.0F, 3.2F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(BlockRegistry.CAVE_BUSH);
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.CAVE_BUSH);
sphere = new SDFScale3D().setScale(MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random), MHelper.randRange(0.8F, 1.2F, random)).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.fillRecursive(world, blockPos);
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.CAVE_BUSH);
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.CAVE_BUSH);
}
}

View file

@ -7,7 +7,7 @@ import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -31,7 +31,7 @@ public abstract class ScatterFeature extends DefaultFeature {
if (pos.getY() < 5) {
return false;
}
else if (!world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
else if (!world.getBlockState(pos.down()).isIn(EndTags.END_GROUND)) {
return false;
}
return true;

View file

@ -17,8 +17,8 @@ import net.minecraft.world.biome.source.TheEndBiomeSource;
import net.minecraft.world.gen.ChunkRandom;
import ru.betterend.BetterEnd;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndTags;
import ru.betterend.util.FeaturesHelper;
import ru.betterend.world.biome.EndBiome;
@ -42,8 +42,8 @@ public class BetterEndBiomeSource extends BiomeSource {
public BetterEndBiomeSource(Registry<Biome> biomeRegistry, long seed) {
super(getBiomes(biomeRegistry));
this.mapLand = new BiomeMap(seed, 256, BiomeRegistry.LAND_BIOMES);
this.mapVoid = new BiomeMap(seed, 256, BiomeRegistry.VOID_BIOMES);
this.mapLand = new BiomeMap(seed, 256, EndBiomes.LAND_BIOMES);
this.mapVoid = new BiomeMap(seed, 256, EndBiomes.VOID_BIOMES);
this.centerBiome = biomeRegistry.getOrThrow(BiomeKeys.THE_END);
this.barrens = biomeRegistry.getOrThrow(BiomeKeys.END_BARRENS);
this.biomeRegistry = biomeRegistry;
@ -53,8 +53,8 @@ public class BetterEndBiomeSource extends BiomeSource {
chunkRandom.consume(17292);
this.noise = new SimplexNoiseSampler(chunkRandom);
BiomeRegistry.mutateRegistry(biomeRegistry);
BlockTagRegistry.addTerrainTags(biomeRegistry);
EndBiomes.mutateRegistry(biomeRegistry);
EndTags.addTerrainTags(biomeRegistry);
FeaturesHelper.addFeatures(biomeRegistry);
}
@ -86,7 +86,7 @@ public class BetterEndBiomeSource extends BiomeSource {
mapVoid.clearCache();
}
return biomeRegistry.getOrThrow(BiomeRegistry.getBiomeKey(netherBiome));
return biomeRegistry.getOrThrow(EndBiomes.getBiomeKey(netherBiome));
}
@Override

View file

@ -5,7 +5,7 @@ import java.util.Random;
import com.google.common.collect.Lists;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.world.biome.EndBiome;
public class BiomePicker {
@ -37,7 +37,7 @@ public class BiomePicker {
for (EndBiome biome: biomes)
if (biome.canGenerate(chance))
return biome;
return BiomeRegistry.END;
return EndBiomes.END;
}
public List<EndBiome> getBiomes() {

View file

@ -9,7 +9,7 @@ import net.minecraft.util.math.Direction;
import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper;
@ -66,17 +66,17 @@ public class StructureGiantMossyGlowshroom extends SDFStructureFeature {
SDFBinary function = new SDFSmoothUnion().setRadius(4).setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(rotRoots));
cone1.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_CAP);
cone2.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_CAP);
priGlowCone.setBlock(BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE);
primRoots.setBlock(BlockRegistry.MOSSY_GLOWSHROOM.bark);
cone1.setBlock(EndBlocks.MOSSY_GLOWSHROOM_CAP);
cone2.setBlock(EndBlocks.MOSSY_GLOWSHROOM_CAP);
priGlowCone.setBlock(EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE);
primRoots.setBlock(EndBlocks.MOSSY_GLOWSHROOM.bark);
float height = MHelper.randRange(10F, 25F, random);
int count = MHelper.floor(height / 4);
List<Vector3f> spline = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, count);
SplineHelper.offsetParts(spline, random, 1F, 0, 1F);
SDF sdf = SplineHelper.buildSDF(spline, 2.1F, 1.5F, (pos) -> {
return BlockRegistry.MOSSY_GLOWSHROOM.log.getDefaultState();
return EndBlocks.MOSSY_GLOWSHROOM.log.getDefaultState();
});
Vector3f pos = spline.get(spline.size() - 1);
float scale = MHelper.randRange(2F, 3.5F, random);
@ -89,34 +89,34 @@ public class StructureGiantMossyGlowshroom extends SDFStructureFeature {
.setScale(scale)
.setSource(function))
.setPostProcess((info) -> {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
if (random.nextBoolean() && info.getStateUp().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_CAP) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
if (random.nextBoolean() && info.getStateUp().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
return info.getState();
}
else if (!BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM.bark.getDefaultState());
else if (!EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM.bark.getDefaultState());
return info.getState();
}
}
else if (info.getState().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_CAP) {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) {
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_CAP) {
if (EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown().getBlock())) {
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState().with(BlockMossyGlowshroomCap.TRANSITION, true));
return info.getState();
}
info.setState(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState());
info.setState(EndBlocks.MOSSY_GLOWSHROOM_CAP.getDefaultState());
return info.getState();
}
else if (info.getState().getBlock() == BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE) {
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
for (Direction dir: BlocksHelper.HORIZONTAL) {
if (info.getState(dir) == AIR) {
info.setBlockPos(info.getPos().offset(dir), BlockRegistry.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir));
}
}
if (info.getStateDown().getBlock() != BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), BlockRegistry.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN));
if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN));
}
}
return info.getState();

View file

@ -12,7 +12,7 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.MHelper;
import ru.betterend.world.structures.piece.PaintedMountainPiece;
@ -51,8 +51,8 @@ public class StructurePaintedMountain extends StructureFeatureBase {
static {
VARIANTS = new BlockState[] {
Blocks.END_STONE.getDefaultState(),
BlockRegistry.FLAVOLITE.stone.getDefaultState(),
BlockRegistry.VIOLECITE.stone.getDefaultState(),
EndBlocks.FLAVOLITE.stone.getDefaultState(),
EndBlocks.VIOLECITE.stone.getDefaultState(),
};
}
}

View file

@ -14,8 +14,8 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndStructures;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
@ -25,7 +25,7 @@ public class CavePiece extends BasePiece {
private float radius;
public CavePiece(BlockPos center, float radius, int id) {
super(StructureRegistry.CAVE_PIECE, id);
super(EndStructures.CAVE_PIECE, id);
this.center = center;
this.radius = radius;
this.noise = new OpenSimplexNoise(MHelper.getSeed(534, center.getX(), center.getZ()));
@ -33,7 +33,7 @@ public class CavePiece extends BasePiece {
}
public CavePiece(StructureManager manager, CompoundTag tag) {
super(StructureRegistry.CAVE_PIECE, tag);
super(EndStructures.CAVE_PIECE, tag);
makeBoundingBox();
}
@ -66,7 +66,7 @@ public class CavePiece extends BasePiece {
double r2 = r - 4.5;
double dist = xsq + ysq + zsq;
if (dist < r2 * r2) {
if (world.getBlockState(pos).isIn(BlockTagRegistry.END_GROUND)) {
if (world.getBlockState(pos).isIn(EndTags.END_GROUND)) {
BlocksHelper.setWithoutUpdate(world, pos, AIR);
}
}

View file

@ -22,10 +22,10 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.registry.StructureRegistry;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndStructures;
import ru.betterend.registry.EndTags;
import ru.betterend.util.MHelper;
public class LakePiece extends BasePiece {
@ -38,7 +38,7 @@ public class LakePiece extends BasePiece {
private float r2;
public LakePiece(BlockPos center, float radius, float depth, int id) {
super(StructureRegistry.LAKE_PIECE, id);
super(EndStructures.LAKE_PIECE, id);
this.center = center;
this.radius = radius;
this.depth = depth;
@ -48,7 +48,7 @@ public class LakePiece extends BasePiece {
}
public LakePiece(StructureManager manager, CompoundTag tag) {
super(StructureRegistry.LAKE_PIECE, tag);
super(EndStructures.LAKE_PIECE, tag);
makeBoundingBox();
}
@ -100,13 +100,13 @@ public class LakePiece extends BasePiece {
}
minY = MathHelper.lerp(lerp, maxY - minY, 56 - minY);
pos.setY(maxY);
while (chunk.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
while (chunk.getBlockState(pos).isIn(EndTags.GEN_TERRAIN)) {
pos.setY(maxY ++);
}
for (int y = maxY; y >= minY; y--) {
pos.setY(y - 1);
BlockState state = chunk.getBlockState(pos);
if (state.getMaterial().isReplaceable() || state.isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
pos.setY(y);
chunk.setBlockState(pos, y > 56 ? AIR : WATER, false);
}
@ -117,15 +117,15 @@ public class LakePiece extends BasePiece {
}
if (pos.getY() < 57) {
BlockState state = chunk.getBlockState(pos);
if (state.getMaterial().isReplaceable() || state.isIn(BlockTagRegistry.GEN_TERRAIN)) {
chunk.setBlockState(pos, BlockRegistry.ENDSTONE_DUST.getDefaultState(), false);
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
chunk.setBlockState(pos, EndBlocks.ENDSTONE_DUST.getDefaultState(), false);
pos.setY(pos.getY() - 1);
state = chunk.getBlockState(pos);
if (state.getMaterial().isReplaceable() || state.isIn(BlockTagRegistry.GEN_TERRAIN)) {
chunk.setBlockState(pos, BlockRegistry.ENDSTONE_DUST.getDefaultState(), false);
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
chunk.setBlockState(pos, EndBlocks.ENDSTONE_DUST.getDefaultState(), false);
pos.setY(pos.getY() - 1);
}
if (!chunk.getBlockState(pos).isIn(BlockTagRegistry.GEN_TERRAIN)) {
if (!chunk.getBlockState(pos).isIn(EndTags.GEN_TERRAIN)) {
chunk.setBlockState(pos, Blocks.END_STONE.getDefaultState(), false);
}
@ -149,7 +149,7 @@ public class LakePiece extends BasePiece {
return h;
}
if (BiomeRegistry.getFromBiome(world.getBiome(pos)) != BiomeRegistry.MEGALAKE) {
if (EndBiomes.getFromBiome(world.getBiome(pos)) != EndBiomes.MEGALAKE) {
heightmap.put(p, -4);
return -4;
}

Some files were not shown because too many files have changed in this diff Show more