Merge branch 'master' of github.com:paulevsGitch/BetterEnd into 1.17

This commit is contained in:
Frank Bauer 2021-07-13 18:07:06 +02:00
commit 8cce3303eb
604 changed files with 8704 additions and 7902 deletions

View file

@ -1,4 +1,3 @@
class ModelPart { class ModelPart {
static java.util.ArrayList<ModelPart> parts = new java.util.ArrayList<>(20); static java.util.ArrayList<ModelPart> parts = new java.util.ArrayList<>(20);
final String name; final String name;
@ -14,6 +13,7 @@ class ModelPart {
boolean hadBox = false; boolean hadBox = false;
ModelPart(Convert c, String name) { ModelPart(Convert c, String name) {
this(c, 0, 0, name); this(c, 0, 0, name);
@ -59,6 +59,7 @@ class ModelPart {
this.v = v; this.v = v;
return this; return this;
} }
ModelPart addBox(float x, float y, float z, float a, float b, float c) { ModelPart addBox(float x, float y, float z, float a, float b, float c) {
return addBox(x, y, z, a, b, c, 1); return addBox(x, y, z, a, b, c, 1);
} }
@ -74,6 +75,7 @@ class ModelPart {
hadBox = true; hadBox = true;
return this; return this;
} }
ModelPart addBox(float x, float y, float z, float a, float b, float c, float _d, boolean mirror) { ModelPart addBox(float x, float y, float z, float a, float b, float c, float _d, boolean mirror) {
this.mirror = mirror; this.mirror = mirror;
bx = x; bx = x;
@ -100,17 +102,19 @@ class ModelPart {
s += "\n"; s += "\n";
if (scale != 1) if (scale != 1)
s += ".addBox(" + bx + "f, " + by + "f, " + bz + "f, " + ba + "f, " + bb + "f, " + bc + "f, deformation_" + name + "),\n"; s += ".addBox(" + bx + "f, " + by + "f, " + bz + "f, " + ba + "f, " + bb + "f, " + bc + "f, deformation_" + name + "),\n";
else else s += ".addBox(" + bx + "f, " + by + "f, " + bz + "f, " + ba + "f, " + bb + "f, " + bc + "f),\n";
s+= ".addBox("+bx+"f, "+by+"f, "+bz+"f, "+ba+"f, "+bb+"f, "+bc+"f),\n"; }
} else { else {
s += ",\n"; s += ",\n";
} }
if (x == 0 && y == 0 && z == 0 && rx == 0 && ry == 0 && rz == 0) { if (x == 0 && y == 0 && z == 0 && rx == 0 && ry == 0 && rz == 0) {
s += "PartPose.ZERO"; s += "PartPose.ZERO";
} else if (rx==0 && ry==0 && rz==0){ }
else if (rx == 0 && ry == 0 && rz == 0) {
s += "PartPose.offset(" + x + "f, " + y + "f, " + z + "f)"; s += "PartPose.offset(" + x + "f, " + y + "f, " + z + "f)";
} else { }
else {
s += "PartPose.offsetAndRotation(" + x + "f, " + y + "f, " + z + "f, \n" + rx + "f, " + ry + "f, " + rz + "f)"; s += "PartPose.offsetAndRotation(" + x + "f, " + y + "f, " + z + "f, \n" + rx + "f, " + ry + "f, " + rz + "f)";
} }
s += ");"; s += ");";
@ -138,9 +142,6 @@ class ModelPart {
} }
} }
} }
public class Convert {
public static void main(String[] args){
new Convert().c();
ModelPart.print(); ModelPart.print();
} }

View file

@ -1,17 +1,19 @@
[![](https://jitpack.io/v/paulevsGitch/BetterEnd.svg)](https://jitpack.io/#paulevsGitch/BetterEnd) [![](https://jitpack.io/v/paulevsGitch/BetterEnd.svg)](https://jitpack.io/#paulevsGitch/BetterEnd)
# Better End # Better End
Better End Mod for Fabric, MC 1.17.1 Better End Mod for Fabric, MC 1.17.1
Importing: Importing:
* Clone repo * Clone repo
* Edit gradle.properties if necessary * Edit gradle.properties if necessary
* Run command line in folder: gradlew genSources eclipse (or Another-IDE-Name) * Run command line in folder: gradlew genSources eclipse (or Another-IDE-Name)
* Import project to IDE * Import project to IDE
Building: Building:
* Clone repo * Clone repo
* Run command line in folder: gradlew build * Run command line in folder: gradlew build
* Mod .jar will be in ./build/libs * Mod .jar will be in ./build/libs
Mappings:
* https://modmuss50.me/fabric.html?&version=1.16.4

View file

@ -1,17 +1,14 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.17.1 minecraft_version=1.17.1
yarn_mappings=6 yarn_mappings=6
loader_version=0.11.6 loader_version=0.11.6
# Mod Properties # Mod Properties
mod_version = 0.10.1-pre mod_version=0.10.4-pre
maven_group=ru.betterend maven_group=ru.betterend
archives_base_name=better-end archives_base_name=better-end
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
patchouli_version = 55-FABRIC-SNAPSHOT patchouli_version = 55-FABRIC-SNAPSHOT

6
jitpack.yml Normal file
View file

@ -0,0 +1,6 @@
# From https://github.com/jitpack/jitpack.io/issues/4506#issuecomment-864562270
before_install:
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk update
- sdk install java 16.0.1.hs-adpt
- sdk use java 16.0.1.hs-adpt

View file

@ -1,7 +1,16 @@
{ {
"variants": { "variants": {
"axis=x": { "model": "betterend:block/%name%_pillar", "x": 90, "y": 90 }, "axis=x": {
"axis=y": { "model": "betterend:block/%name%_pillar" }, "model": "betterend:block/%name%_pillar",
"axis=z": { "model": "betterend:block/%name%_pillar", "x": 90 } "x": 90,
"y": 90
},
"axis=y": {
"model": "betterend:block/%name%_pillar"
},
"axis=z": {
"model": "betterend:block/%name%_pillar",
"x": 90
}
} }
} }

View file

@ -14,11 +14,7 @@ import ru.bclib.blocks.BaseBlock;
public class AeterniumBlock extends BaseBlock { public class AeterniumBlock extends BaseBlock {
public AeterniumBlock() { public AeterniumBlock() {
super(FabricBlockSettings.of(Material.METAL, MaterialColor.COLOR_GRAY) super(FabricBlockSettings.of(Material.METAL, MaterialColor.COLOR_GRAY).hardness(65F).resistance(1200F).requiresCorrectToolForDrops().sound(SoundType.NETHERITE_BLOCK));
.hardness(65F)
.resistance(1200F)
.requiresCorrectToolForDrops()
.sound(SoundType.NETHERITE_BLOCK));
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -33,15 +33,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
private static final int MAX_DROP = 4; private static final int MAX_DROP = 4;
public AuroraCrystalBlock() { public AuroraCrystalBlock() {
super(FabricBlockSettings.of(Material.GLASS) super(FabricBlockSettings.of(Material.GLASS).breakByTool(FabricToolTags.PICKAXES).breakByTool(TagAPI.HAMMERS).hardness(1F).resistance(1F).luminance(15).noOcclusion().isSuffocating((state, world, pos) -> false).sound(SoundType.GLASS));
.breakByTool(FabricToolTags.PICKAXES)
.breakByTool(TagAPI.HAMMERS)
.hardness(1F)
.resistance(1F)
.luminance(15)
.noOcclusion()
.isSuffocating((state, world, pos) -> false)
.sound(SoundType.GLASS));
} }
@Override @Override
@ -109,11 +101,6 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
} }
static { static {
COLORS = new Vec3i[]{ COLORS = new Vec3i[]{new Vec3i(247, 77, 161), new Vec3i(120, 184, 255), new Vec3i(120, 255, 168), new Vec3i(243, 58, 255)};
new Vec3i(247, 77, 161),
new Vec3i(120, 184, 255),
new Vec3i(120, 255, 168),
new Vec3i(243, 58, 255)
};
} }
} }

View file

@ -87,10 +87,7 @@ public class BrimstoneBlock extends BaseBlock {
} }
} }
else if (sideState.getFluidState().getType() == Fluids.WATER) { else if (sideState.getFluidState().getType() == Fluids.WATER) {
BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.defaultBlockState() BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.defaultBlockState().setValue(SulphurCrystalBlock.FACING, dir).setValue(SulphurCrystalBlock.WATERLOGGED, true).setValue(SulphurCrystalBlock.AGE, 0);
.setValue(SulphurCrystalBlock.FACING, dir)
.setValue(SulphurCrystalBlock.WATERLOGGED, true)
.setValue(SulphurCrystalBlock.AGE, 0);
world.setBlockAndUpdate(side, crystal); world.setBlockAndUpdate(side, crystal);
} }
} }

View file

@ -24,11 +24,7 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock {
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16); private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16);
public BubbleCoralBlock() { public BubbleCoralBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT) super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.CORAL_BLOCK).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.CORAL_BLOCK)
.noCollission());
} }
@Override @Override

View file

@ -32,14 +32,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements IRenderType
private static final VoxelShape SHAPE_FLOOR = Block.box(4, 0, 4, 12, 12, 12); private static final VoxelShape SHAPE_FLOOR = Block.box(4, 0, 4, 12, 12, 12);
public BulbVineLanternBlock() { public BulbVineLanternBlock() {
this(FabricBlockSettings.of(Material.METAL) this(FabricBlockSettings.of(Material.METAL).hardness(1).resistance(1).breakByTool(FabricToolTags.PICKAXES).materialColor(MaterialColor.COLOR_LIGHT_GRAY).luminance(15).requiresCorrectToolForDrops().sound(SoundType.LANTERN));
.hardness(1)
.resistance(1)
.breakByTool(FabricToolTags.PICKAXES)
.materialColor(MaterialColor.COLOR_LIGHT_GRAY)
.luminance(15)
.requiresCorrectToolForDrops()
.sound(SoundType.LANTERN));
} }
public BulbVineLanternBlock(Properties settings) { public BulbVineLanternBlock(Properties settings) {
@ -62,9 +55,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements IRenderType
Map<String, String> textures = Maps.newHashMap(); Map<String, String> textures = Maps.newHashMap();
textures.put("%glow%", getGlowTexture()); textures.put("%glow%", getGlowTexture());
textures.put("%metal%", getMetalTexture(resourceLocation)); textures.put("%metal%", getMetalTexture(resourceLocation));
Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_FLOOR, textures) : Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_CEIL, textures);
Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_FLOOR, textures) :
Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_CEIL, textures);
return ModelsHelper.fromPattern(pattern); return ModelsHelper.fromPattern(pattern);
} }

View file

@ -2,13 +2,15 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class DragonTreeSaplingBlock extends FeatureSaplingBlock { public class DragonTreeSaplingBlock extends PottableFeatureSapling {
public DragonTreeSaplingBlock() { public DragonTreeSaplingBlock() {
super(); super();
} }
@ -22,4 +24,9 @@ public class DragonTreeSaplingBlock extends FeatureSaplingBlock {
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.SHADOW_GRASS); return world.getBlockState(pos.below()).is(EndBlocks.SHADOW_GRASS);
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.SHADOW_GRASS;
}
} }

View file

@ -12,16 +12,14 @@ public class EndBlockProperties extends BlockProperties {
public static final EnumProperty<PedestalState> PEDESTAL_STATE = EnumProperty.create("state", PedestalState.class); public static final EnumProperty<PedestalState> PEDESTAL_STATE = EnumProperty.create("state", PedestalState.class);
public static final EnumProperty<CactusBottom> CACTUS_BOTTOM = EnumProperty.create("bottom", CactusBottom.class); public static final EnumProperty<CactusBottom> CACTUS_BOTTOM = EnumProperty.create("bottom", CactusBottom.class);
public static final BooleanProperty HAS_ITEM = BooleanProperty.create("has_item");
public static final IntegerProperty PORTAL = IntegerProperty.create("portal", 0, EndPortals.getCount()); public static final IntegerProperty PORTAL = IntegerProperty.create("portal", 0, EndPortals.getCount());
public static final IntegerProperty PLANT_ID = IntegerProperty.create("plant_id", 0, 63);
public static final IntegerProperty SOIL_ID = IntegerProperty.create("soil_id", 0, 15);
public static final IntegerProperty POT_LIGHT = IntegerProperty.create("pot_light", 0, 3);
public static final BooleanProperty HAS_ITEM = BooleanProperty.create("has_item");
public enum PedestalState implements StringRepresentable { public enum PedestalState implements StringRepresentable {
PEDESTAL_TOP("pedestal_top"), PEDESTAL_TOP("pedestal_top"), COLUMN_TOP("column_top"), BOTTOM("bottom"), PILLAR("pillar"), COLUMN("column"), DEFAULT("default");
COLUMN_TOP("column_top"),
BOTTOM("bottom"),
PILLAR("pillar"),
COLUMN("column"),
DEFAULT("default");
private final String name; private final String name;
@ -41,12 +39,7 @@ public class EndBlockProperties extends BlockProperties {
} }
public enum HydraluxShape implements StringRepresentable { public enum HydraluxShape implements StringRepresentable {
FLOWER_BIG_BOTTOM("flower_big_bottom", true), FLOWER_BIG_BOTTOM("flower_big_bottom", true), FLOWER_BIG_TOP("flower_big_top", true), FLOWER_SMALL_BOTTOM("flower_small_bottom", true), FLOWER_SMALL_TOP("flower_small_top", true), VINE("vine", false), ROOTS("roots", false);
FLOWER_BIG_TOP("flower_big_top", true),
FLOWER_SMALL_BOTTOM("flower_small_bottom", true),
FLOWER_SMALL_TOP("flower_small_top", true),
VINE("vine", false),
ROOTS("roots", false);
private final String name; private final String name;
private final boolean glow; private final boolean glow;
@ -72,13 +65,7 @@ public class EndBlockProperties extends BlockProperties {
} }
public enum LumecornShape implements StringRepresentable { public enum LumecornShape implements StringRepresentable {
LIGHT_TOP("light_top", 15), LIGHT_TOP("light_top", 15), LIGHT_TOP_MIDDLE("light_top_middle", 15), LIGHT_MIDDLE("light_middle", 15), LIGHT_BOTTOM("light_bottom", 15), MIDDLE("middle", 0), BOTTOM_BIG("bottom_big", 0), BOTTOM_SMALL("bottom_small", 0);
LIGHT_TOP_MIDDLE("light_top_middle", 15),
LIGHT_MIDDLE("light_middle", 15),
LIGHT_BOTTOM("light_bottom", 15),
MIDDLE("middle", 0),
BOTTOM_BIG("bottom_big", 0),
BOTTOM_SMALL("bottom_small", 0);
private final String name; private final String name;
private final int light; private final int light;
@ -104,9 +91,7 @@ public class EndBlockProperties extends BlockProperties {
} }
public enum CactusBottom implements StringRepresentable { public enum CactusBottom implements StringRepresentable {
EMPTY("empty"), EMPTY("empty"), SAND("sand"), MOSS("moss");
SAND("sand"),
MOSS("moss");
private final String name; private final String name;

View file

@ -42,12 +42,7 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock {
private static final VoxelShape SHAPE_TOP = Block.box(2, 0, 2, 14, 6, 14); private static final VoxelShape SHAPE_TOP = Block.box(2, 0, 2, 14, 6, 14);
public EndLilyBlock() { public EndLilyBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT) super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.WET_GRASS).lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.WET_GRASS)
.lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0)
.noCollission());
} }
@Override @Override

View file

@ -110,8 +110,7 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
p.setX(pos.getX() + x); p.setX(pos.getX() + x);
for (int z = -1; z < 2; z++) { for (int z = -1; z < 2; z++) {
p.setZ(pos.getZ() + z); p.setZ(pos.getZ() + z);
if (world.isEmptyBlock(p) && !world.getFluidState(p.below()).isEmpty()) if (world.isEmptyBlock(p) && !world.getFluidState(p.below()).isEmpty()) count++;
count++;
} }
} }
return count == 9; return count == 9;

View file

@ -95,8 +95,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
BlockPos exitPos = findExitPos(currentWorld, destination, pos, entity); BlockPos exitPos = findExitPos(currentWorld, destination, pos, entity);
if (exitPos == null) return; if (exitPos == null) return;
if (entity instanceof ServerPlayer && ((ServerPlayer) entity).isCreative()) { if (entity instanceof ServerPlayer && ((ServerPlayer) entity).isCreative()) {
((ServerPlayer) entity).teleportTo(destination, exitPos.getX() + 0.5, exitPos.getY(), ((ServerPlayer) entity).teleportTo(destination, exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5, entity.getYRot(), entity.getXRot());
exitPos.getZ() + 0.5, entity.getYRot(), entity.getXRot());
} }
else { else {
((TeleportingEntity) entity).be_setExitPos(exitPos); ((TeleportingEntity) entity).be_setExitPos(exitPos);
@ -106,8 +105,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
} }
private boolean validate(Entity entity) { private boolean validate(Entity entity) {
return !entity.isPassenger() && !entity.isVehicle() && return !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && !entity.isOnPortalCooldown();
entity.canChangeDimensions() && !entity.isOnPortalCooldown();
} }
@Override @Override
@ -127,8 +125,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
MutableBlockPos checkPos = basePos.mutable(); MutableBlockPos checkPos = basePos.mutable();
BlockState currentState = currentWorld.getBlockState(currentPos); BlockState currentState = currentWorld.getBlockState(currentPos);
int radius = (EternalRitual.SEARCH_RADIUS >> 4) + 1; int radius = (EternalRitual.SEARCH_RADIUS >> 4) + 1;
checkPos = EternalRitual.findBlockPos(targetWorld, checkPos, radius, this, state -> state.is(this) && checkPos = EternalRitual.findBlockPos(targetWorld, checkPos, radius, this, state -> state.is(this) && state.getValue(PORTAL).equals(currentState.getValue(PORTAL)));
state.getValue(PORTAL).equals(currentState.getValue(PORTAL)));
if (checkPos != null) { if (checkPos != null) {
BlockState checkState = targetWorld.getBlockState(checkPos); BlockState checkState = targetWorld.getBlockState(checkPos);
Axis axis = checkState.getValue(AXIS); Axis axis = checkState.getValue(AXIS);

View file

@ -49,12 +49,7 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
public static final String ID = "end_stone_smelter"; public static final String ID = "end_stone_smelter";
public EndStoneSmelter() { public EndStoneSmelter() {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_GRAY) super(FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_GRAY).luminance(state -> state.getValue(LIT) ? 15 : 0).hardness(4F).resistance(100F).requiresCorrectToolForDrops().sound(SoundType.STONE));
.luminance(state -> state.getValue(LIT) ? 15 : 0)
.hardness(4F)
.resistance(100F)
.requiresCorrectToolForDrops()
.sound(SoundType.STONE));
registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false)); registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false));
} }

View file

@ -14,11 +14,7 @@ import ru.bclib.blocks.BaseBlock;
public class EnderBlock extends BaseBlock { public class EnderBlock extends BaseBlock {
public EnderBlock() { public EnderBlock() {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.WARPED_WART_BLOCK) super(FabricBlockSettings.of(Material.STONE, MaterialColor.WARPED_WART_BLOCK).hardness(5F).resistance(6F).requiresCorrectToolForDrops().sound(SoundType.STONE));
.hardness(5F)
.resistance(6F)
.requiresCorrectToolForDrops()
.sound(SoundType.STONE));
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -21,9 +21,7 @@ public class EndstoneDustBlock extends FallingBlock {
private static final int COLOR = ColorUtil.color(226, 239, 168); private static final int COLOR = ColorUtil.color(226, 239, 168);
public EndstoneDustBlock() { public EndstoneDustBlock() {
super(FabricBlockSettings.copyOf(Blocks.SAND) super(FabricBlockSettings.copyOf(Blocks.SAND).breakByTool(FabricToolTags.SHOVELS).materialColor(Blocks.END_STONE.defaultMaterialColor()));
.breakByTool(FabricToolTags.SHOVELS)
.materialColor(Blocks.END_STONE.defaultMaterialColor()));
} }
@Override @Override

View file

@ -24,10 +24,7 @@ public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 1, 16); private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 1, 16);
public FlamaeaBlock() { public FlamaeaBlock() {
super(FabricBlockSettings.of(Material.PLANT) super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.WET_GRASS));
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.WET_GRASS));
} }
@Override @Override
@ -59,4 +56,9 @@ public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
public boolean canPlaceOnWater() { public boolean canPlaceOnWater() {
return true; return true;
} }
@Override
public boolean addToPot() {
return false;
}
} }

View file

@ -0,0 +1,391 @@
package ru.betterend.blocks;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockAccessor;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.storage.loot.LootContext.Builder;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.ModelsHelper.MultiPartBuilder;
import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IPostInit;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.JsonFactory;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.basis.PottableLeavesBlock;
import ru.betterend.client.models.Patterns;
import ru.betterend.config.Configs;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.interfaces.PottableTerrain;
import ru.betterend.registry.EndBlocks;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IPostInit {
private static final IntegerProperty PLANT_ID = EndBlockProperties.PLANT_ID;
private static final IntegerProperty SOIL_ID = EndBlockProperties.SOIL_ID;
private static final IntegerProperty POT_LIGHT = EndBlockProperties.POT_LIGHT;
private static final VoxelShape SHAPE_EMPTY;
private static final VoxelShape SHAPE_FULL;
private static Block[] plants;
private static Block[] soils;
public FlowerPotBlock(Block source) {
super(FabricBlockSettings.copyOf(source).luminance(state -> state.getValue(POT_LIGHT) * 5));
this.registerDefaultState(this.defaultBlockState().setValue(PLANT_ID, 0).setValue(SOIL_ID, 0).setValue(POT_LIGHT, 0));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(PLANT_ID, SOIL_ID, POT_LIGHT);
}
@Override
public List<ItemStack> getDrops(BlockState state, Builder builder) {
List<ItemStack> drop = Lists.newArrayList(new ItemStack(this));
int id = state.getValue(SOIL_ID) - 1;
if (id >= 0 && id < soils.length && soils[id] != null) {
drop.add(new ItemStack(soils[id]));
}
id = state.getValue(PLANT_ID) - 1;
if (id >= 0 && id < plants.length && plants[id] != null) {
drop.add(new ItemStack(plants[id]));
}
return drop;
}
@Override
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
int plantID = state.getValue(PLANT_ID);
if (plantID < 1 || plantID > plants.length || plants[plantID - 1] == null) {
return state.getValue(POT_LIGHT) > 0 ? state.setValue(POT_LIGHT, 0) : state;
}
int light = plants[plantID - 1].defaultBlockState().getLightEmission() / 5;
if (state.getValue(POT_LIGHT) != light) {
state = state.setValue(POT_LIGHT, light);
}
return state;
}
@Override
public void postInit() {
if (FlowerPotBlock.plants != null) {
return;
}
Block[] plants = new Block[128];
Block[] soils = new Block[16];
Map<String, Integer> reservedPlantsIDs = Maps.newHashMap();
Map<String, Integer> reservedSoilIDs = Maps.newHashMap();
JsonObject obj = JsonFactory.getJsonObject(new File(FabricLoader.getInstance().getConfigDir().toFile(), BetterEnd.MOD_ID + "/blocks.json"));
if (obj.get("flower_pots") != null) {
JsonElement plantsObj = obj.get("flower_pots").getAsJsonObject().get("plants");
JsonElement soilsObj = obj.get("flower_pots").getAsJsonObject().get("soils");
if (plantsObj != null) {
plantsObj.getAsJsonObject().entrySet().forEach(entry -> {
String name = entry.getKey().substring(0, entry.getKey().indexOf(' '));
reservedPlantsIDs.put(name, entry.getValue().getAsInt());
});
}
if (soilsObj != null) {
soilsObj.getAsJsonObject().entrySet().forEach(entry -> {
String name = entry.getKey().substring(0, entry.getKey().indexOf(' '));
reservedSoilIDs.put(name, entry.getValue().getAsInt());
});
}
}
EndBlocks.getModBlocks().forEach(block -> {
if (block instanceof PottablePlant && ((PottablePlant) block).addToPot()) {//&& canBeAdded(block)) {
processBlock(plants, block, "flower_pots.plants", reservedPlantsIDs);
}
else if (block instanceof PottableTerrain) {
processBlock(soils, block, "flower_pots.soils", reservedSoilIDs);
}
});
Configs.BLOCK_CONFIG.saveChanges();
FlowerPotBlock.plants = new Block[maxNotNull(plants) + 1];
System.arraycopy(plants, 0, FlowerPotBlock.plants, 0, FlowerPotBlock.plants.length);
FlowerPotBlock.soils = new Block[maxNotNull(soils) + 1];
System.arraycopy(soils, 0, FlowerPotBlock.soils, 0, FlowerPotBlock.soils.length);
if (PLANT_ID.getValue(Integer.toString(FlowerPotBlock.plants.length)).isEmpty()) {
throw new RuntimeException("There are too much plant ID values!");
}
if (SOIL_ID.getValue(Integer.toString(FlowerPotBlock.soils.length)).isEmpty()) {
throw new RuntimeException("There are too much soil ID values!");
}
}
private int maxNotNull(Block[] array) {
int max = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] != null) {
max = i;
}
}
return max;
}
private void processBlock(Block[] target, Block block, String path, Map<String, Integer> idMap) {
ResourceLocation location = Registry.BLOCK.getKey(block);
if (idMap.containsKey(location.getPath())) {
target[idMap.get(location.getPath())] = block;
}
else {
for (int i = 0; i < target.length; i++) {
if (!idMap.values().contains(i)) {
target[i] = block;
idMap.put(location.getPath(), i);
Configs.BLOCK_CONFIG.getInt(path, location.getPath(), i);
break;
}
}
}
}
@Override
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (level.isClientSide) {
return InteractionResult.CONSUME;
}
ItemStack itemStack = player.getItemInHand(hand);
int soilID = state.getValue(SOIL_ID);
if (soilID == 0 || soilID > soils.length || soils[soilID - 1] == null) {
if (!(itemStack.getItem() instanceof BlockItem)) {
return InteractionResult.PASS;
}
Block block = ((BlockItem) itemStack.getItem()).getBlock();
for (int i = 0; i < soils.length; i++) {
if (block == soils[i]) {
BlocksHelper.setWithUpdate(level, pos, state.setValue(SOIL_ID, i + 1));
return InteractionResult.SUCCESS;
}
}
return InteractionResult.PASS;
}
int plantID = state.getValue(PLANT_ID);
if (itemStack.isEmpty()) {
if (plantID > 0 && plantID <= plants.length && plants[plantID - 1] != null) {
BlocksHelper.setWithUpdate(level, pos, state.setValue(PLANT_ID, 0).setValue(POT_LIGHT, 0));
player.addItem(new ItemStack(plants[plantID - 1]));
return InteractionResult.SUCCESS;
}
if (soilID > 0 && soilID <= soils.length && soils[soilID - 1] != null) {
BlocksHelper.setWithUpdate(level, pos, state.setValue(SOIL_ID, 0));
player.addItem(new ItemStack(soils[soilID - 1]));
}
return InteractionResult.PASS;
}
if (!(itemStack.getItem() instanceof BlockItem)) {
return InteractionResult.PASS;
}
BlockItem item = (BlockItem) itemStack.getItem();
for (int i = 0; i < plants.length; i++) {
if (item.getBlock() == plants[i]) {
if (!((PottablePlant) plants[i]).canPlantOn(soils[soilID - 1])) {
return InteractionResult.PASS;
}
int light = plants[i].defaultBlockState().getLightEmission() / 5;
BlocksHelper.setWithUpdate(level, pos, state.setValue(PLANT_ID, i + 1).setValue(POT_LIGHT, light));
level.playLocalSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1, 1, false);
return InteractionResult.SUCCESS;
}
}
return InteractionResult.PASS;
}
@Override
@Environment(EnvType.CLIENT)
public BlockModel getItemModel(ResourceLocation blockId) {
Optional<String> pattern = PatternsHelper.createJson(Patterns.BLOCK_FLOWER_POT, blockId);
return ModelsHelper.fromPattern(pattern);
}
@Override
@Environment(EnvType.CLIENT)
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
MultiPartBuilder model = MultiPartBuilder.create(stateDefinition);
model.part(new ModelResourceLocation(stateId.getNamespace(), stateId.getPath(), "inventory")).add();
Transformation offset = new Transformation(new Vector3f(0, 7.5F / 16F, 0), null, null, null);
for (int i = 0; i < plants.length; i++) {
if (plants[i] == null) {
continue;
}
final int compareID = i + 1;
ResourceLocation modelPath = Registry.BLOCK.getKey(plants[i]);
ResourceLocation objSource = new ResourceLocation(modelPath.getNamespace(), "models/block/" + modelPath.getPath() + "_potted.json");
if (Minecraft.getInstance().getResourceManager().hasResource(objSource)) {
objSource = new ResourceLocation(modelPath.getNamespace(), "block/" + modelPath.getPath() + "_potted");
model.part(objSource).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
continue;
}
else if (plants[i] instanceof SaplingBlock) {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%modid%", loc.getNamespace());
textures.put("%texture%", loc.getPath());
Optional<String> pattern = Patterns.createJson(BasePatterns.BLOCK_CROSS, textures);
UnbakedModel unbakedModel = ModelsHelper.fromPattern(pattern);
modelCache.put(modelPath, unbakedModel);
model.part(modelPath).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
continue;
}
else if (plants[i] instanceof PottableLeavesBlock) {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%leaves%", loc.getPath().contains("lucernia") ? loc.getPath() + "_1" : loc.getPath());
textures.put("%stem%", loc.getPath().replace("_leaves", "_log_side"));
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_POTTED_LEAVES, textures);
UnbakedModel unbakedModel = ModelsHelper.fromPattern(pattern);
modelCache.put(modelPath, unbakedModel);
model.part(modelPath).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
continue;
}
objSource = new ResourceLocation(modelPath.getNamespace(), "blockstates/" + modelPath.getPath() + ".json");
JsonObject obj = JsonFactory.getJsonObject(objSource);
if (obj != null) {
JsonElement variants = obj.get("variants");
JsonElement list = null;
String path = null;
if (variants == null) {
continue;
}
if (variants.isJsonArray()) {
list = variants.getAsJsonArray().get(0);
}
else if (variants.isJsonObject()) {
list = variants.getAsJsonObject().get(((PottablePlant) plants[i]).getPottedState());
}
if (list == null) {
BetterEnd.LOGGER.warning("Incorrect json for pot plant " + objSource + ", no matching variants");
continue;
}
if (list.isJsonArray()) {
path = list.getAsJsonArray().get(0).getAsJsonObject().get("model").getAsString();
}
else {
path = list.getAsJsonObject().get("model").getAsString();
}
if (path == null) {
BetterEnd.LOGGER.warning("Incorrect json for pot plant " + objSource + ", no matching variants");
continue;
}
model.part(new ResourceLocation(path)).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
}
else {
for (ResourceLocation location: modelCache.keySet()) {
if (location.getPath().equals(modelPath.getPath())) {
model.part(location).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
break;
}
}
}
}
for (int i = 0; i < soils.length; i++) {
if (soils[i] == null) {
continue;
}
ResourceLocation soilLoc = BetterEnd.makeID("flower_pot_soil_" + i);
if (!modelCache.containsKey(soilLoc)) {
String texture = Registry.BLOCK.getKey(soils[i]).getPath() + "_top";
if (texture.contains("rutiscus")) {
texture += "_1";
}
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_FLOWER_POT_SOIL, texture);
UnbakedModel soil = ModelsHelper.fromPattern(pattern);
modelCache.put(soilLoc, soil);
}
final int compareID = i + 1;
model.part(soilLoc).setCondition(state -> state.getValue(SOIL_ID) == compareID).add();
}
UnbakedModel result = model.build();
modelCache.put(stateId, result);
return result;
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
int id = state.getValue(PLANT_ID);
return id > 0 && id <= plants.length ? SHAPE_FULL : SHAPE_EMPTY;
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE_EMPTY;
}
@Override
public BCLRenderLayer getRenderLayer() {
return BCLRenderLayer.CUTOUT;
}
static {
SHAPE_EMPTY = Shapes.or(Block.box(4, 1, 4, 12, 8, 12), Block.box(5, 0, 5, 11, 1, 11));
SHAPE_FULL = Shapes.or(SHAPE_EMPTY, Block.box(3, 8, 3, 13, 16, 13));
}
}

View file

@ -21,12 +21,7 @@ public class GlowingPillarLuminophorBlock extends BaseBlock {
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL; public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
public GlowingPillarLuminophorBlock() { public GlowingPillarLuminophorBlock() {
super(FabricBlockSettings.of(Material.LEAVES) super(FabricBlockSettings.of(Material.LEAVES).materialColor(MaterialColor.COLOR_ORANGE).breakByTool(FabricToolTags.SHEARS).strength(0.2F).luminance(15).sound(SoundType.GRASS));
.materialColor(MaterialColor.COLOR_ORANGE)
.breakByTool(FabricToolTags.SHEARS)
.strength(0.2F)
.luminance(15)
.sound(SoundType.GRASS));
this.registerDefaultState(this.stateDefinition.any().setValue(NATURAL, false)); this.registerDefaultState(this.stateDefinition.any().setValue(NATURAL, false));
} }

View file

@ -23,13 +23,7 @@ import java.util.Random;
public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock { public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
public GlowingPillarSeedBlock() { public GlowingPillarSeedBlock() {
super(FabricBlockSettings.of(Material.PLANT) super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.GRASS).lightLevel(state -> state.getValue(AGE) * 3 + 3).randomTicks().noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.lightLevel(state -> state.getValue(AGE) * 3 + 3)
.randomTicks()
.noCollission());
} }
@Override @Override

View file

@ -34,12 +34,7 @@ public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0); private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public HelixTreeLeavesBlock() { public HelixTreeLeavesBlock() {
super(FabricBlockSettings.of(Material.LEAVES) super(FabricBlockSettings.of(Material.LEAVES).materialColor(MaterialColor.COLOR_ORANGE).breakByTool(FabricToolTags.SHEARS).sound(SoundType.WART_BLOCK).sound(SoundType.GRASS).strength(0.2F));
.materialColor(MaterialColor.COLOR_ORANGE)
.breakByTool(FabricToolTags.SHEARS)
.sound(SoundType.WART_BLOCK)
.sound(SoundType.GRASS)
.strength(0.2F));
} }
@Override @Override

View file

@ -1,12 +1,28 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class HelixTreeSaplingBlock extends FeatureSaplingBlock { public class HelixTreeSaplingBlock extends PottableFeatureSapling {
@Override @Override
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.HELIX_TREE.getFeature(); return EndFeatures.HELIX_TREE.getFeature();
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.AMBER_MOSS);
}
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.AMBER_MOSS;
}
} }

View file

@ -33,12 +33,7 @@ public class HydraluxBlock extends UnderwaterPlantBlock {
public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE; public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE;
public HydraluxBlock() { public HydraluxBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT) super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.WET_GRASS).lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.WET_GRASS)
.lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0)
.noCollission());
} }
@Override @Override

View file

@ -13,13 +13,7 @@ import ru.bclib.blocks.BaseBlock;
public class HydraluxPetalBlock extends BaseBlock { public class HydraluxPetalBlock extends BaseBlock {
public HydraluxPetalBlock() { public HydraluxPetalBlock() {
this(FabricBlockSettings.of(Material.PLANT) this(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.AXES).breakByHand(true).hardness(1).resistance(1).materialColor(MaterialColor.PODZOL).sound(SoundType.WART_BLOCK));
.breakByTool(FabricToolTags.AXES)
.breakByHand(true)
.hardness(1)
.resistance(1)
.materialColor(MaterialColor.PODZOL)
.sound(SoundType.WART_BLOCK));
} }
public HydraluxPetalBlock(Properties settings) { public HydraluxPetalBlock(Properties settings) {

View file

@ -40,7 +40,6 @@ import ru.bclib.blocks.BlockProperties;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.betterend.blocks.entities.BlockEntityHydrothermalVent; import ru.betterend.blocks.entities.BlockEntityHydrothermalVent;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndParticles;
import java.util.Random; import java.util.Random;
@ -51,11 +50,7 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
private static final VoxelShape SHAPE = Block.box(1, 1, 1, 15, 16, 15); private static final VoxelShape SHAPE = Block.box(1, 1, 1, 15, 16, 15);
public HydrothermalVentBlock() { public HydrothermalVentBlock() {
super(FabricBlockSettings.of(Material.STONE) super(FabricBlockSettings.of(Material.STONE).breakByTool(FabricToolTags.PICKAXES).sound(SoundType.STONE).noCollission().requiresCorrectToolForDrops());
.breakByTool(FabricToolTags.PICKAXES)
.sound(SoundType.STONE)
.noCollission()
.requiresCorrectToolForDrops());
this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, true).setValue(ACTIVATED, false)); this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, true).setValue(ACTIVATED, false));
} }

View file

@ -15,7 +15,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import ru.betterend.blocks.basis.PedestalBlock; import ru.betterend.blocks.basis.PedestalBlock;
import ru.betterend.blocks.entities.InfusionPedestalEntity; import ru.betterend.blocks.entities.InfusionPedestalEntity;
import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.rituals.InfusionRitual; import ru.betterend.rituals.InfusionRitual;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View file

@ -2,13 +2,15 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class LacugroveSaplingBlock extends FeatureSaplingBlock { public class LacugroveSaplingBlock extends PottableFeatureSapling {
public LacugroveSaplingBlock() { public LacugroveSaplingBlock() {
super(); super();
} }
@ -22,4 +24,9 @@ public class LacugroveSaplingBlock extends FeatureSaplingBlock {
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below()).is(EndBlocks.ENDSTONE_DUST); return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below()).is(EndBlocks.ENDSTONE_DUST);
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.END_MOSS;
}
} }

View file

@ -28,11 +28,7 @@ public class LargeAmaranitaBlock extends EndPlantBlock {
private static final VoxelShape SHAPE_TOP = Shapes.or(Block.box(1, 3, 1, 15, 16, 15), SHAPE_BOTTOM); private static final VoxelShape SHAPE_TOP = Shapes.or(Block.box(1, 3, 1, 15, 16, 15), SHAPE_BOTTOM);
public LargeAmaranitaBlock() { public LargeAmaranitaBlock() {
super(FabricBlockSettings.of(Material.PLANT) super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.GRASS).lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0));
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0));
} }
@Override @Override

View file

@ -2,13 +2,15 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class LucerniaSaplingBlock extends FeatureSaplingBlock { public class LucerniaSaplingBlock extends PottableFeatureSapling {
public LucerniaSaplingBlock() { public LucerniaSaplingBlock() {
super(); super();
} }
@ -22,4 +24,9 @@ public class LucerniaSaplingBlock extends FeatureSaplingBlock {
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.RUTISCUS); return world.getBlockState(pos.below()).is(EndBlocks.RUTISCUS);
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.RUTISCUS;
}
} }

View file

@ -38,10 +38,7 @@ public class LumecornBlock extends BaseBlockNotFull implements IRenderTyped {
private static final VoxelShape SHAPE_TOP = Block.box(6, 0, 6, 10, 8, 10); private static final VoxelShape SHAPE_TOP = Block.box(6, 0, 6, 10, 8, 10);
public LumecornBlock() { public LumecornBlock() {
super(FabricBlockSettings.of(Material.WOOD) super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).hardness(0.5F).luminance(state -> state.getValue(SHAPE).getLight()));
.breakByTool(FabricToolTags.AXES)
.hardness(0.5F)
.luminance(state -> state.getValue(SHAPE).getLight()));
} }
@Override @Override

View file

@ -2,14 +2,15 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class MossyGlowshroomSaplingBlock extends FeatureSaplingBlock { public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
public MossyGlowshroomSaplingBlock() { public MossyGlowshroomSaplingBlock() {
super(7); super(7);
} }
@ -23,4 +24,9 @@ public class MossyGlowshroomSaplingBlock extends FeatureSaplingBlock {
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below()).is(EndBlocks.END_MYCELIUM); return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below()).is(EndBlocks.END_MYCELIUM);
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.END_MOSS || block == EndBlocks.END_MYCELIUM;
}
} }

View file

@ -2,9 +2,9 @@ package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import ru.bclib.blocks.BaseRotatedPillarBlock; import ru.betterend.blocks.basis.LitPillarBlock;
public class NeonCactusBlock extends BaseRotatedPillarBlock { public class NeonCactusBlock extends LitPillarBlock {
public NeonCactusBlock() { public NeonCactusBlock() {
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15)); super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15));
} }

View file

@ -2,6 +2,8 @@ package ru.betterend.blocks;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
@ -41,6 +43,7 @@ import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.betterend.blocks.EndBlockProperties.CactusBottom; import ru.betterend.blocks.EndBlockProperties.CactusBottom;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import java.util.EnumMap; import java.util.EnumMap;
@ -48,7 +51,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, IRenderTyped { public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, IRenderTyped, PottablePlant {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE; public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
public static final EnumProperty<CactusBottom> CACTUS_BOTTOM = EndBlockProperties.CACTUS_BOTTOM; public static final EnumProperty<CactusBottom> CACTUS_BOTTOM = EndBlockProperties.CACTUS_BOTTOM;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
@ -395,4 +398,15 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
SMALL_SHAPES_OPEN.put(Direction.WEST, Block.box(4, 4, 4, 16, 12, 12)); SMALL_SHAPES_OPEN.put(Direction.WEST, Block.box(4, 4, 4, 16, 12, 12));
SMALL_SHAPES_OPEN.put(Direction.EAST, Block.box(0, 4, 4, 12, 12, 12)); SMALL_SHAPES_OPEN.put(Direction.EAST, Block.box(0, 4, 4, 12, 12, 12));
} }
@Override
public boolean canPlantOn(Block block) {
return true;
}
@Override
@Environment(EnvType.CLIENT)
public String getPottedState() {
return "bottom=moss,shape=top,facing=up";
}
} }

View file

@ -23,12 +23,7 @@ public class PondAnemoneBlock extends EndUnderwaterPlantBlock {
private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14); private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14);
public PondAnemoneBlock() { public PondAnemoneBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT) super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).luminance(13).sound(SoundType.CORAL_BLOCK).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.luminance(13)
.sound(SoundType.CORAL_BLOCK)
.noCollission());
} }
@Override @Override

View file

@ -2,13 +2,15 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class PythadendronSaplingBlock extends FeatureSaplingBlock { public class PythadendronSaplingBlock extends PottableFeatureSapling {
public PythadendronSaplingBlock() { public PythadendronSaplingBlock() {
super(); super();
} }
@ -22,4 +24,9 @@ public class PythadendronSaplingBlock extends FeatureSaplingBlock {
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM); return world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM);
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.CHORUS_NYLIUM;
}
} }

View file

@ -21,11 +21,7 @@ public class RunedFlavolite extends BaseBlock {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE; public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public RunedFlavolite(boolean unbreakable) { public RunedFlavolite(boolean unbreakable) {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished) super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).strength(unbreakable ? -1 : 1, unbreakable ? Blocks.BEDROCK.getExplosionResistance() : Blocks.OBSIDIAN.getExplosionResistance()).luminance(state -> {
.strength(
unbreakable ? -1 : 1,
unbreakable ? Blocks.BEDROCK.getExplosionResistance() : Blocks.OBSIDIAN.getExplosionResistance()
).luminance(state -> {
return state.getValue(ACTIVATED) ? 8 : 0; return state.getValue(ACTIVATED) ? 8 : 0;
})); }));
this.registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false)); this.registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false));

View file

@ -6,11 +6,11 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseCropBlock; import ru.betterend.blocks.basis.PottableCropBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
public class ShadowBerryBlock extends BaseCropBlock { public class ShadowBerryBlock extends PottableCropBlock {
private static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 8, 15); private static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 8, 15);
public ShadowBerryBlock() { public ShadowBerryBlock() {

View file

@ -60,10 +60,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
} }
private boolean checkFrame(ServerLevel world, BlockPos pos) { private boolean checkFrame(ServerLevel world, BlockPos pos) {
return world.getBlockState(pos).is(this) && return world.getBlockState(pos).is(this) && world.getBlockState(pos.south()).is(this) && world.getBlockState(pos.east()).is(this) && world.getBlockState(pos.south().east()).is(this);
world.getBlockState(pos.south()).is(this) &&
world.getBlockState(pos.east()).is(this) &&
world.getBlockState(pos.south().east()).is(this);
} }
private void replaceMushroom(ServerLevel world, BlockPos pos) { private void replaceMushroom(ServerLevel world, BlockPos pos) {

View file

@ -2,6 +2,8 @@ package ru.betterend.blocks;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -30,21 +32,18 @@ import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderTyped, BonemealableBlock { public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderTyped, BonemealableBlock, PottablePlant {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public SmallJellyshroomBlock() { public SmallJellyshroomBlock() {
super(FabricBlockSettings.of(Material.PLANT) super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.NETHER_WART).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.NETHER_WART)
.noCollission());
} }
@Override @Override
@ -101,4 +100,15 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderT
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR); BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
EndFeatures.JELLYSHROOM.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null)); EndFeatures.JELLYSHROOM.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null));
} }
@Override
public boolean canPlantOn(Block block) {
return true;
}
@Override
@Environment(EnvType.CLIENT)
public String getPottedState() {
return "facing=up";
}
} }

View file

@ -4,16 +4,10 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.blocks.BaseRotatedPillarBlock; import ru.betterend.blocks.basis.LitPillarBlock;
public class SmaragdantCrystalBlock extends BaseRotatedPillarBlock { public class SmaragdantCrystalBlock extends LitPillarBlock {
public SmaragdantCrystalBlock() { public SmaragdantCrystalBlock() {
super(FabricBlockSettings.of(Material.GLASS) super(FabricBlockSettings.of(Material.GLASS).breakByTool(FabricToolTags.PICKAXES).luminance(15).hardness(1F).resistance(1F).noOcclusion().sound(SoundType.AMETHYST));
.breakByTool(FabricToolTags.PICKAXES)
.luminance(15)
.hardness(1F)
.resistance(1F)
.noOcclusion()
.sound(SoundType.GLASS));
} }
} }

View file

@ -37,13 +37,7 @@ public class SmaragdantCrystalShardBlock extends BaseAttachedBlock implements IR
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public SmaragdantCrystalShardBlock() { public SmaragdantCrystalShardBlock() {
super(FabricBlockSettings.of(Material.STONE) super(FabricBlockSettings.of(Material.STONE).materialColor(MaterialColor.COLOR_GREEN).breakByTool(FabricToolTags.PICKAXES).luminance(15).sound(SoundType.AMETHYST_CLUSTER).requiresCorrectToolForDrops().noCollission());
.materialColor(MaterialColor.COLOR_GREEN)
.breakByTool(FabricToolTags.PICKAXES)
.luminance(15)
.sound(SoundType.GLASS)
.requiresCorrectToolForDrops()
.noCollission());
} }
@Override @Override

View file

@ -47,12 +47,7 @@ public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyp
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public SulphurCrystalBlock() { public SulphurCrystalBlock() {
super(FabricBlockSettings.of(Material.STONE) super(FabricBlockSettings.of(Material.STONE).materialColor(MaterialColor.COLOR_YELLOW).breakByTool(FabricToolTags.PICKAXES).sound(SoundType.GLASS).requiresCorrectToolForDrops().noCollission());
.materialColor(MaterialColor.COLOR_YELLOW)
.breakByTool(FabricToolTags.PICKAXES)
.sound(SoundType.GLASS)
.requiresCorrectToolForDrops()
.noCollission());
} }
@Override @Override

View file

@ -73,11 +73,6 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
} }
static { static {
COLORS = new Vec3i[]{ COLORS = new Vec3i[]{new Vec3i(250, 111, 222), new Vec3i(167, 89, 255), new Vec3i(120, 207, 239), new Vec3i(255, 87, 182)};
new Vec3i(250, 111, 222),
new Vec3i(167, 89, 255),
new Vec3i(120, 207, 239),
new Vec3i(255, 87, 182)
};
} }
} }

View file

@ -2,13 +2,15 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class TenaneaSaplingBlock extends FeatureSaplingBlock { public class TenaneaSaplingBlock extends PottableFeatureSapling {
public TenaneaSaplingBlock() { public TenaneaSaplingBlock() {
super(); super();
} }
@ -22,4 +24,9 @@ public class TenaneaSaplingBlock extends FeatureSaplingBlock {
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.PINK_MOSS); return world.getBlockState(pos.below()).is(EndBlocks.PINK_MOSS);
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.PINK_MOSS;
}
} }

View file

@ -27,9 +27,7 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
public static final BooleanProperty NATURAL = BlockProperties.NATURAL; public static final BooleanProperty NATURAL = BlockProperties.NATURAL;
public UmbrellaTreeClusterBlock() { public UmbrellaTreeClusterBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK) super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(MaterialColor.COLOR_PURPLE).luminance(15));
.materialColor(MaterialColor.COLOR_PURPLE)
.luminance(15));
registerDefaultState(stateDefinition.any().setValue(NATURAL, false)); registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
} }

View file

@ -19,9 +19,7 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL; public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
public UmbrellaTreeClusterEmptyBlock() { public UmbrellaTreeClusterEmptyBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK) super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(MaterialColor.COLOR_PURPLE).randomTicks());
.materialColor(MaterialColor.COLOR_PURPLE)
.randomTicks());
registerDefaultState(stateDefinition.any().setValue(NATURAL, false)); registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
} }

View file

@ -2,14 +2,16 @@ package ru.betterend.blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock; import ru.bclib.blocks.FeatureSaplingBlock;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class UmbrellaTreeSaplingBlock extends FeatureSaplingBlock { public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling {
public UmbrellaTreeSaplingBlock() { public UmbrellaTreeSaplingBlock() {
super(); super();
} }
@ -28,4 +30,9 @@ public class UmbrellaTreeSaplingBlock extends FeatureSaplingBlock {
public BCLRenderLayer getRenderLayer() { public BCLRenderLayer getRenderLayer() {
return BCLRenderLayer.TRANSLUCENT; return BCLRenderLayer.TRANSLUCENT;
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.JUNGLE_MOSS;
}
} }

View file

@ -130,8 +130,7 @@ public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterlogg
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) { public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
String floor = blockState.getValue(IS_FLOOR) ? "_floor" : ""; String floor = blockState.getValue(IS_FLOOR) ? "_floor" : "";
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath() + floor);
"block/" + stateId.getPath() + floor);
registerBlockModel(stateId, modelId, blockState, modelCache); registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createBlockSimple(modelId); return ModelsHelper.createBlockSimple(modelId);
} }

View file

@ -1,11 +1,12 @@
package ru.betterend.blocks.basis; package ru.betterend.blocks.basis;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import ru.bclib.api.TagAPI; import ru.bclib.api.TagAPI;
import ru.bclib.blocks.BasePlantBlock; import ru.bclib.blocks.BasePlantBlock;
import ru.betterend.interfaces.PottablePlant;
public class EndPlantBlock extends BasePlantBlock { public class EndPlantBlock extends BasePlantBlock implements PottablePlant {
public EndPlantBlock() { public EndPlantBlock() {
this(false); this(false);
} }
@ -30,4 +31,14 @@ public class EndPlantBlock extends BasePlantBlock {
protected boolean isTerrain(BlockState state) { protected boolean isTerrain(BlockState state) {
return state.is(TagAPI.END_GROUND); return state.is(TagAPI.END_GROUND);
} }
@Override
public boolean canPlantOn(Block block) {
return isTerrain(block.defaultBlockState());
}
@Override
public boolean addToPot() {
return getStateDefinition().getProperties().isEmpty();
}
} }

View file

@ -3,8 +3,9 @@ package ru.betterend.blocks.basis;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.blocks.BaseTerrainBlock; import ru.bclib.blocks.BaseTerrainBlock;
import ru.betterend.interfaces.PottableTerrain;
public class EndTerrainBlock extends BaseTerrainBlock { public class EndTerrainBlock extends BaseTerrainBlock implements PottableTerrain {
public EndTerrainBlock(MaterialColor color) { public EndTerrainBlock(MaterialColor color) {
super(Blocks.END_STONE, color); super(Blocks.END_STONE, color);
} }

View file

@ -3,9 +3,9 @@ package ru.betterend.blocks.basis;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.blocks.TripleTerrainBlock; import ru.bclib.blocks.TripleTerrainBlock;
import ru.betterend.interfaces.PottableTerrain;
public class EndTripleTerrain extends TripleTerrainBlock { public class EndTripleTerrain extends TripleTerrainBlock implements PottableTerrain {
public EndTripleTerrain(MaterialColor color) { public EndTripleTerrain(MaterialColor color) {
super(Blocks.END_STONE, color); super(Blocks.END_STONE, color);
} }

View file

@ -33,22 +33,13 @@ public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
private final int dropChance; private final int dropChance;
public FurBlock(ItemLike drop, int light, int dropChance, boolean wet) { public FurBlock(ItemLike drop, int light, int dropChance, boolean wet) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT) super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).luminance(light).sound(wet ? SoundType.WET_GRASS : SoundType.GRASS).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.luminance(light)
.sound(wet ? SoundType.WET_GRASS : SoundType.GRASS)
.noCollission());
this.drop = drop; this.drop = drop;
this.dropChance = dropChance; this.dropChance = dropChance;
} }
public FurBlock(ItemLike drop, int dropChance) { public FurBlock(ItemLike drop, int dropChance) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT) super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.GRASS).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.noCollission());
this.drop = drop; this.drop = drop;
this.dropChance = dropChance; this.dropChance = dropChance;
} }

View file

@ -0,0 +1,24 @@
package ru.betterend.blocks.basis;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import ru.bclib.blocks.BaseBlock;
public class LitBaseBlock extends BaseBlock {
private static final String PATTERN = "{\"parent\":\"betterend:block/cube_noshade\",\"textures\":{\"texture\":\"betterend:block/name\"}}";
public LitBaseBlock(Properties settings) {
super(settings);
}
@Nullable
@Override
@Environment(EnvType.CLIENT)
public BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
return BlockModel.fromString(PATTERN.replace("name", resourceLocation.getPath()));
}
}

View file

@ -0,0 +1,23 @@
package ru.betterend.blocks.basis;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.resources.ResourceLocation;
import ru.bclib.blocks.BaseRotatedPillarBlock;
import java.util.Optional;
public class LitPillarBlock extends BaseRotatedPillarBlock {
private static final String PATTERN = "{\"parent\":\"betterend:block/pillar_noshade\",\"textures\":{\"end\":\"betterend:block/name_top\",\"side\":\"betterend:block/name_side\"}}";
public LitPillarBlock(Properties settings) {
super(settings);
}
@Override
@Environment(EnvType.CLIENT)
protected Optional<String> createBlockPattern(ResourceLocation blockId) {
String name = blockId.getPath();
return Optional.of(PATTERN.replace("name", name));
}
}

View file

@ -42,11 +42,9 @@ import ru.bclib.client.models.ModelsHelper;
import ru.betterend.blocks.EndBlockProperties; import ru.betterend.blocks.EndBlockProperties;
import ru.betterend.blocks.EndBlockProperties.PedestalState; import ru.betterend.blocks.EndBlockProperties.PedestalState;
import ru.betterend.blocks.InfusionPedestal; import ru.betterend.blocks.InfusionPedestal;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import ru.betterend.blocks.entities.InfusionPedestalEntity; import ru.betterend.blocks.entities.InfusionPedestalEntity;
import ru.betterend.blocks.entities.PedestalBlockEntity; import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.client.models.Patterns; import ru.betterend.client.models.Patterns;
import ru.betterend.registry.EndBlockEntities;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.rituals.InfusionRitual; import ru.betterend.rituals.InfusionRitual;
@ -55,6 +53,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.function.ToIntFunction;
@SuppressWarnings({"deprecation"}) @SuppressWarnings({"deprecation"})
public class PedestalBlock extends BaseBlockNotFull implements EntityBlock { public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
@ -95,11 +94,19 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
protected float height = 1.0F; protected float height = 1.0F;
public PedestalBlock(Block parent) { public PedestalBlock(Block parent) {
super(FabricBlockSettings.copyOf(parent).luminance(state -> state.getValue(HAS_LIGHT) ? 12 : 0)); super(FabricBlockSettings.copyOf(parent).luminance(getLuminance(parent.defaultBlockState())));
this.registerDefaultState(stateDefinition.any().setValue(STATE, PedestalState.DEFAULT).setValue(HAS_ITEM, false).setValue(HAS_LIGHT, false)); this.registerDefaultState(stateDefinition.any().setValue(STATE, PedestalState.DEFAULT).setValue(HAS_ITEM, false).setValue(HAS_LIGHT, false));
this.parent = parent; this.parent = parent;
} }
private static ToIntFunction<BlockState> getLuminance(BlockState parent) {
final int light = parent.getLightEmission();
if (light > 0) {
return state -> light;
}
return state -> state.getValue(HAS_LIGHT) ? 12 : 0;
}
public float getHeight(BlockState state) { public float getHeight(BlockState state) {
if (state.getBlock() instanceof PedestalBlock && state.getValue(STATE) == PedestalState.PEDESTAL_TOP) { if (state.getBlock() instanceof PedestalBlock && state.getValue(STATE) == PedestalState.PEDESTAL_TOP) {
return this.height - 0.2F; return this.height - 0.2F;
@ -330,8 +337,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
public boolean isPlaceable(BlockState state) { public boolean isPlaceable(BlockState state) {
if (!state.is(this)) return false; if (!state.is(this)) return false;
PedestalState currentState = state.getValue(STATE); PedestalState currentState = state.getValue(STATE);
return currentState == PedestalState.DEFAULT || return currentState == PedestalState.DEFAULT || currentState == PedestalState.PEDESTAL_TOP;
currentState == PedestalState.PEDESTAL_TOP;
} }
@Override @Override
@ -426,8 +432,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) { public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
PedestalState state = blockState.getValue(STATE); PedestalState state = blockState.getValue(STATE);
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath() + "_" + state);
"block/" + stateId.getPath() + "_" + state);
registerBlockModel(stateId, modelId, blockState, modelCache); registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createBlockSimple(modelId); return ModelsHelper.createBlockSimple(modelId);
} }

View file

@ -0,0 +1,30 @@
package ru.betterend.blocks.basis;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import ru.bclib.blocks.BaseCropBlock;
import ru.betterend.interfaces.PottablePlant;
public class PottableCropBlock extends BaseCropBlock implements PottablePlant {
private final Block[] terrain;
public PottableCropBlock(Item drop, Block... terrain) {
super(drop, terrain);
this.terrain = terrain;
}
@Override
public boolean canPlantOn(Block block) {
for (Block ter: terrain) {
if (block == ter) {
return true;
}
}
return false;
}
@Override
public String getPottedState() {
return "age=3";
}
}

View file

@ -0,0 +1,16 @@
package ru.betterend.blocks.basis;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.interfaces.PottablePlant;
public abstract class PottableFeatureSapling extends FeatureSaplingBlock implements PottablePlant {
public PottableFeatureSapling() {
super();
}
public PottableFeatureSapling(int light) {
super(light);
}
}

View file

@ -0,0 +1,28 @@
package ru.betterend.blocks.basis;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.blocks.BaseLeavesBlock;
import ru.betterend.interfaces.PottablePlant;
public class PottableLeavesBlock extends BaseLeavesBlock implements PottablePlant {
private Block sapling;
public PottableLeavesBlock(Block sapling, MaterialColor color) {
super(sapling, color);
this.sapling = sapling;
}
public PottableLeavesBlock(Block sapling, MaterialColor color, int light) {
super(sapling, color, light);
this.sapling = sapling;
}
@Override
public boolean canPlantOn(Block block) {
if (sapling instanceof PottablePlant) {
return ((PottablePlant) sapling).canPlantOn(block);
}
return true;
}
}

View file

@ -48,9 +48,7 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) { public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
String blockName = resourceLocation.getPath(); String blockName = resourceLocation.getPath();
Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_FLOOR, blockName, blockName) : Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_CEIL, blockName, blockName);
Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_FLOOR, blockName, blockName) :
Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_CEIL, blockName, blockName);
return ModelsHelper.fromPattern(pattern); return ModelsHelper.fromPattern(pattern);
} }
} }

View file

@ -4,8 +4,6 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.blocks.BaseRotatedPillarBlock;
import ru.bclib.blocks.BaseSlabBlock; import ru.bclib.blocks.BaseSlabBlock;
import ru.bclib.blocks.BaseStairsBlock; import ru.bclib.blocks.BaseStairsBlock;
import ru.bclib.blocks.BaseWallBlock; import ru.bclib.blocks.BaseWallBlock;
@ -13,6 +11,8 @@ import ru.bclib.recipes.GridRecipe;
import ru.bclib.util.TagHelper; import ru.bclib.util.TagHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndPedestal; import ru.betterend.blocks.EndPedestal;
import ru.betterend.blocks.basis.LitBaseBlock;
import ru.betterend.blocks.basis.LitPillarBlock;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
import ru.betterend.recipe.CraftingRecipes; import ru.betterend.recipe.CraftingRecipes;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -32,14 +32,14 @@ public class CrystalSubblocksMaterial {
public CrystalSubblocksMaterial(String name, Block source) { public CrystalSubblocksMaterial(String name, Block source) {
FabricBlockSettings material = FabricBlockSettings.copyOf(source); FabricBlockSettings material = FabricBlockSettings.copyOf(source);
polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material)); polished = EndBlocks.registerBlock(name + "_polished", new LitBaseBlock(material));
tiles = EndBlocks.registerBlock(name + "_tiles", new BaseBlock(material)); tiles = EndBlocks.registerBlock(name + "_tiles", new LitBaseBlock(material));
pillar = EndBlocks.registerBlock(name + "_pillar", new BaseRotatedPillarBlock(material)); pillar = EndBlocks.registerBlock(name + "_pillar", new LitPillarBlock(material));
stairs = EndBlocks.registerBlock(name + "_stairs", new BaseStairsBlock(source)); stairs = EndBlocks.registerBlock(name + "_stairs", new BaseStairsBlock(source));
slab = EndBlocks.registerBlock(name + "_slab", new BaseSlabBlock(source)); slab = EndBlocks.registerBlock(name + "_slab", new BaseSlabBlock(source));
wall = EndBlocks.registerBlock(name + "_wall", new BaseWallBlock(source)); wall = EndBlocks.registerBlock(name + "_wall", new BaseWallBlock(source));
pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(source)); pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(source));
bricks = EndBlocks.registerBlock(name + "_bricks", new BaseBlock(material)); bricks = EndBlocks.registerBlock(name + "_bricks", new LitBaseBlock(material));
brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BaseStairsBlock(bricks)); brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BaseStairsBlock(bricks));
brick_slab = EndBlocks.registerBlock(name + "_bricks_slab", new BaseSlabBlock(bricks)); brick_slab = EndBlocks.registerBlock(name + "_bricks_slab", new BaseSlabBlock(bricks));
brick_wall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks)); brick_wall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks));

View file

@ -19,6 +19,7 @@ import ru.bclib.recipes.GridRecipe;
import ru.bclib.util.TagHelper; import ru.bclib.util.TagHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndPedestal; import ru.betterend.blocks.EndPedestal;
import ru.betterend.blocks.FlowerPotBlock;
import ru.betterend.blocks.basis.StoneLanternBlock; import ru.betterend.blocks.basis.StoneLanternBlock;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
import ru.betterend.recipe.CraftingRecipes; import ru.betterend.recipe.CraftingRecipes;
@ -35,15 +36,16 @@ public class StoneMaterial {
public final Block slab; public final Block slab;
public final Block wall; public final Block wall;
public final Block button; public final Block button;
public final Block pressure_plate; public final Block pressurePlate;
public final Block pedestal; public final Block pedestal;
public final Block lantern; public final Block lantern;
public final Block bricks; public final Block bricks;
public final Block brick_stairs; public final Block brickStairs;
public final Block brick_slab; public final Block brickSlab;
public final Block brick_wall; public final Block brickWall;
public final Block furnace; public final Block furnace;
public final Block flowerPot;
public StoneMaterial(String name, MaterialColor color) { public StoneMaterial(String name, MaterialColor color) {
FabricBlockSettings material = FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color); FabricBlockSettings material = FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color);
@ -56,15 +58,16 @@ public class StoneMaterial {
slab = EndBlocks.registerBlock(name + "_slab", new BaseSlabBlock(stone)); slab = EndBlocks.registerBlock(name + "_slab", new BaseSlabBlock(stone));
wall = EndBlocks.registerBlock(name + "_wall", new BaseWallBlock(stone)); wall = EndBlocks.registerBlock(name + "_wall", new BaseWallBlock(stone));
button = EndBlocks.registerBlock(name + "_button", new BaseStoneButtonBlock(stone)); button = EndBlocks.registerBlock(name + "_button", new BaseStoneButtonBlock(stone));
pressure_plate = EndBlocks.registerBlock(name + "_plate", new StonePressurePlateBlock(stone)); pressurePlate = EndBlocks.registerBlock(name + "_plate", new StonePressurePlateBlock(stone));
pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(stone)); pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(stone));
lantern = EndBlocks.registerBlock(name + "_lantern", new StoneLanternBlock(stone)); lantern = EndBlocks.registerBlock(name + "_lantern", new StoneLanternBlock(stone));
bricks = EndBlocks.registerBlock(name + "_bricks", new BaseBlock(material)); bricks = EndBlocks.registerBlock(name + "_bricks", new BaseBlock(material));
brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BaseStairsBlock(bricks)); brickStairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BaseStairsBlock(bricks));
brick_slab = EndBlocks.registerBlock(name + "_bricks_slab", new BaseSlabBlock(bricks)); brickSlab = EndBlocks.registerBlock(name + "_bricks_slab", new BaseSlabBlock(bricks));
brick_wall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks)); brickWall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks));
furnace = EndBlocks.registerBlock(name + "_furnace", new BaseFurnaceBlock(bricks)); furnace = EndBlocks.registerBlock(name + "_furnace", new BaseFurnaceBlock(bricks));
flowerPot = EndBlocks.registerBlock(name + "_flower_pot", new FlowerPotBlock(bricks));
// Recipes // // Recipes //
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks", bricks).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', stone).setGroup("end_bricks").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks", bricks).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', stone).setGroup("end_bricks").build();
@ -74,21 +77,22 @@ public class StoneMaterial {
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', stone).setGroup("end_stone_stairs").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', stone).setGroup("end_stone_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', stone).setGroup("end_stone_slabs").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', stone).setGroup("end_stone_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brick_stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', bricks).setGroup("end_stone_stairs").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brickStairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', bricks).setGroup("end_stone_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brick_slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', bricks).setGroup("end_stone_slabs").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brickSlab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', bricks).setGroup("end_stone_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', stone).setGroup("end_wall").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', stone).setGroup("end_wall").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brick_wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', bricks).setGroup("end_wall").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brickWall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', bricks).setGroup("end_wall").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button).checkConfig(Configs.RECIPE_CONFIG).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button).checkConfig(Configs.RECIPE_CONFIG).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressure_plate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_lantern", lantern).checkConfig(Configs.RECIPE_CONFIG).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brick_slab).setGroup("end_stone_lanterns").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_lantern", lantern).checkConfig(Configs.RECIPE_CONFIG).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brickSlab).setGroup("end_stone_lanterns").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_furnace", furnace).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "###").addMaterial('#', stone).setGroup("end_stone_furnaces").build(); GridRecipe.make(BetterEnd.MOD_ID, name + "_furnace", furnace).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "###").addMaterial('#', stone).setGroup("end_stone_furnaces").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_flower_pot", flowerPot).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("# #", " # ").addMaterial('#', bricks).setGroup("end_pots").build();
CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar); CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar);
// Item Tags // // Item Tags //
TagHelper.addTag(ItemTags.SLABS, slab, brick_slab); TagHelper.addTag(ItemTags.SLABS, slab, brickSlab);
TagHelper.addTag(ItemTags.STONE_BRICKS, bricks); TagHelper.addTag(ItemTags.STONE_BRICKS, bricks);
TagHelper.addTag(ItemTags.STONE_CRAFTING_MATERIALS, stone); TagHelper.addTag(ItemTags.STONE_CRAFTING_MATERIALS, stone);
TagHelper.addTag(ItemTags.STONE_TOOL_MATERIALS, stone); TagHelper.addTag(ItemTags.STONE_TOOL_MATERIALS, stone);
@ -96,9 +100,9 @@ public class StoneMaterial {
// Block Tags // // Block Tags //
TagHelper.addTag(BlockTags.STONE_BRICKS, bricks); TagHelper.addTag(BlockTags.STONE_BRICKS, bricks);
TagHelper.addTag(BlockTags.WALLS, wall, brick_wall); TagHelper.addTag(BlockTags.WALLS, wall, brickWall);
TagHelper.addTag(BlockTags.SLABS, slab, brick_slab); TagHelper.addTag(BlockTags.SLABS, slab, brickSlab);
TagHelper.addTags(pressure_plate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES); TagHelper.addTags(pressurePlate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES);
TagHelper.addTag(TagAPI.END_STONES, stone); TagHelper.addTag(TagAPI.END_STONES, stone);
TagHelper.addTag(TagAPI.DRAGON_IMMUNE, stone, stairs, slab, wall); TagHelper.addTag(TagAPI.DRAGON_IMMUNE, stone, stairs, slab, wall);

View file

@ -3,7 +3,6 @@ package ru.betterend.blocks.entities;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ElytraItem; import net.minecraft.world.item.ElytraItem;

View file

@ -121,8 +121,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
return true; return true;
} }
itemStack = iterator.next(); itemStack = iterator.next();
} } while (itemStack.isEmpty());
while (itemStack.isEmpty());
return false; return false;
} }
@ -159,11 +158,9 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
protected int getSmeltTime() { protected int getSmeltTime() {
if (level == null) return 200; if (level == null) return 200;
int smeltTime = level.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, this, level) int smeltTime = level.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, this, level).map(AlloyingRecipe::getSmeltTime).orElse(0);
.map(AlloyingRecipe::getSmeltTime).orElse(0);
if (smeltTime == 0) { if (smeltTime == 0) {
smeltTime = level.getRecipeManager().getRecipeFor(RecipeType.BLASTING, this, level) smeltTime = level.getRecipeManager().getRecipeFor(RecipeType.BLASTING, this, level).map(BlastingRecipe::getCookingTime).orElse(200);
.map(BlastingRecipe::getCookingTime).orElse(200);
smeltTime /= 1.5; smeltTime /= 1.5;
} }
return smeltTime; return smeltTime;
@ -290,12 +287,10 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
if (recipe == null) return false; if (recipe == null) return false;
boolean validInput; boolean validInput;
if (recipe instanceof AlloyingRecipe) { if (recipe instanceof AlloyingRecipe) {
validInput = !inventory.get(0).isEmpty() && validInput = !inventory.get(0).isEmpty() && !inventory.get(1).isEmpty();
!inventory.get(1).isEmpty();
} }
else { else {
validInput = !inventory.get(0).isEmpty() || validInput = !inventory.get(0).isEmpty() || !inventory.get(1).isEmpty();
!inventory.get(1).isEmpty();
} }
if (validInput) { if (validInput) {
ItemStack result = recipe.getResultItem(); ItemStack result = recipe.getResultItem();

View file

@ -70,10 +70,8 @@ public class BetterEndClient implements ClientModInitializer {
Registry.BLOCK.forEach(block -> { Registry.BLOCK.forEach(block -> {
if (block instanceof IRenderTyped) { if (block instanceof IRenderTyped) {
BCLRenderLayer layer = ((IRenderTyped) block).getRenderLayer(); BCLRenderLayer layer = ((IRenderTyped) block).getRenderLayer();
if (layer == BCLRenderLayer.CUTOUT) if (layer == BCLRenderLayer.CUTOUT) BlockRenderLayerMap.INSTANCE.putBlock(block, cutout);
BlockRenderLayerMap.INSTANCE.putBlock(block, cutout); else if (layer == BCLRenderLayer.TRANSLUCENT) BlockRenderLayerMap.INSTANCE.putBlock(block, translucent);
else if (layer == BCLRenderLayer.TRANSLUCENT)
BlockRenderLayerMap.INSTANCE.putBlock(block, translucent);
} }
}); });
} }

View file

@ -27,8 +27,7 @@ import ru.betterend.recipe.builders.AlloyingRecipe;
public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> { public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
public final static MenuType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple( public final static MenuType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
private final Container inventory; private final Container inventory;
private final ContainerData propertyDelegate; private final ContainerData propertyDelegate;

View file

@ -74,6 +74,9 @@ public class Patterns {
public final static ResourceLocation BLOCK_FURNACE_LIT = BetterEnd.makeID("patterns/block/furnace_glow.json"); public final static ResourceLocation BLOCK_FURNACE_LIT = BetterEnd.makeID("patterns/block/furnace_glow.json");
public final static ResourceLocation BLOCK_TOP_SIDE_BOTTOM = BetterEnd.makeID("patterns/block/top_side_bottom.json"); public final static ResourceLocation BLOCK_TOP_SIDE_BOTTOM = BetterEnd.makeID("patterns/block/top_side_bottom.json");
public final static ResourceLocation BLOCK_PATH = BetterEnd.makeID("patterns/block/path.json"); public final static ResourceLocation BLOCK_PATH = BetterEnd.makeID("patterns/block/path.json");
public final static ResourceLocation BLOCK_FLOWER_POT = BetterEnd.makeID("patterns/block/flower_pot.json");
public final static ResourceLocation BLOCK_FLOWER_POT_SOIL = BetterEnd.makeID("patterns/block/flower_pot_soil.json");
public final static ResourceLocation BLOCK_POTTED_LEAVES = BetterEnd.makeID("patterns/block/potted_leaves.json");
//Item Models //Item Models
public final static ResourceLocation ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json"); public final static ResourceLocation ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");
@ -99,9 +102,7 @@ public class Patterns {
public static String createJson(Reader data, String parent, String block) { public static String createJson(Reader data, String parent, String block) {
try (BufferedReader buffer = new BufferedReader(data)) { try (BufferedReader buffer = new BufferedReader(data)) {
return buffer.lines().collect(Collectors.joining()) return buffer.lines().collect(Collectors.joining()).replace("%parent%", parent).replace("%block%", block);
.replace("%parent%", parent)
.replace("%block%", block);
} }
catch (Exception ex) { catch (Exception ex) {
return null; return null;
@ -127,8 +128,7 @@ public class Patterns {
public static Optional<String> createJson(ResourceLocation patternId, Map<String, String> textures) { public static Optional<String> createJson(ResourceLocation patternId, Map<String, String> textures) {
ResourceManager resourceManager = Minecraft.getInstance().getResourceManager(); ResourceManager resourceManager = Minecraft.getInstance().getResourceManager();
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) { try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)) String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining());
.lines().collect(Collectors.joining());
for (Entry<String, String> texture : textures.entrySet()) { for (Entry<String, String> texture : textures.entrySet()) {
json = json.replace(texture.getKey(), texture.getValue()); json = json.replace(texture.getKey(), texture.getValue());
} }

View file

@ -49,15 +49,9 @@ public class EndCrystalRenderer {
public static LayerDefinition getTexturedModelData() { public static LayerDefinition getTexturedModelData() {
MeshDefinition modelData = new MeshDefinition(); MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
modelPartData.addOrReplaceChild("FRAME", CubeListBuilder.create() modelPartData.addOrReplaceChild("FRAME", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0f, -4.0f, -4.0f, 8.0f, 8.0f, 8.0f), PartPose.ZERO);
.texOffs(0, 0)
.addBox(-4.0f, -4.0f, -4.0f, 8.0f, 8.0f, 8.0f),
PartPose.ZERO);
modelPartData.addOrReplaceChild("CORE", CubeListBuilder.create() modelPartData.addOrReplaceChild("CORE", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0f, -4.0f, -4.0f, 8.0f, 8.0f, 8.0f), PartPose.ZERO);
.texOffs(32, 0)
.addBox(-4.0f, -4.0f, -4.0f, 8.0f, 8.0f, 8.0f),
PartPose.ZERO);
return LayerDefinition.create(modelData, 64, 32); return LayerDefinition.create(modelData, 64, 32);
} }

View file

@ -64,30 +64,15 @@ public class EternalCrystalRenderer {
public static LayerDefinition getTexturedModelData() { public static LayerDefinition getTexturedModelData() {
MeshDefinition modelData = new MeshDefinition(); MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
modelPartData.addOrReplaceChild("SHARDS_0", CubeListBuilder.create() modelPartData.addOrReplaceChild("SHARDS_0", CubeListBuilder.create().texOffs(2, 4).addBox(-5.0f, 1.0f, -3.0f, 2.0f, 8.0f, 2.0f), PartPose.ZERO);
.texOffs(2, 4)
.addBox(-5.0f, 1.0f, -3.0f, 2.0f, 8.0f, 2.0f),
PartPose.ZERO);
modelPartData.addOrReplaceChild("SHARDS_1", CubeListBuilder.create() modelPartData.addOrReplaceChild("SHARDS_1", CubeListBuilder.create().texOffs(2, 4).addBox(3.0f, -1.0f, -1.0f, 2.0f, 8.0f, 2.0f), PartPose.ZERO);
.texOffs(2, 4)
.addBox(3.0f, -1.0f, -1.0f, 2.0f, 8.0f, 2.0f),
PartPose.ZERO);
modelPartData.addOrReplaceChild("SHARDS_2", CubeListBuilder.create() modelPartData.addOrReplaceChild("SHARDS_2", CubeListBuilder.create().texOffs(2, 4).addBox(-1.0f, 0.0f, -5.0f, 2.0f, 4.0f, 2.0f), PartPose.ZERO);
.texOffs(2, 4)
.addBox(-1.0f, 0.0f, -5.0f, 2.0f, 4.0f, 2.0f),
PartPose.ZERO);
modelPartData.addOrReplaceChild("SHARDS_3", CubeListBuilder.create() modelPartData.addOrReplaceChild("SHARDS_3", CubeListBuilder.create().texOffs(2, 4).addBox(0.0f, 3.0f, 4.0f, 2.0f, 6.0f, 2.0f), PartPose.ZERO);
.texOffs(2, 4)
.addBox(0.0f, 3.0f, 4.0f, 2.0f, 6.0f, 2.0f),
PartPose.ZERO);
modelPartData.addOrReplaceChild("CORE", CubeListBuilder.create() modelPartData.addOrReplaceChild("CORE", CubeListBuilder.create().texOffs(0, 0).addBox(-2.0f, -2.0f, -2.0f, 4.0f, 12.0f, 4.0f), PartPose.ZERO);
.texOffs(0, 0)
.addBox(-2.0f, -2.0f, -2.0f, 4.0f, 12.0f, 4.0f),
PartPose.ZERO);
return LayerDefinition.create(modelData, 16, 16); return LayerDefinition.create(modelData, 16, 16);
} }

View file

@ -100,10 +100,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0).add(Attributes.FOLLOW_RANGE, 16.0).add(Attributes.MOVEMENT_SPEED, 0.5);
.add(Attributes.MAX_HEALTH, 2.0)
.add(Attributes.FOLLOW_RANGE, 16.0)
.add(Attributes.MOVEMENT_SPEED, 0.5);
} }
public int getVariant() { public int getVariant() {

View file

@ -52,11 +52,7 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.FLYING_SPEED, 1.0D).add(Attributes.MOVEMENT_SPEED, 0.1D);
.add(Attributes.MAX_HEALTH, 8.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.FLYING_SPEED, 1.0D)
.add(Attributes.MOVEMENT_SPEED, 0.1D);
} }
@Override @Override

View file

@ -128,10 +128,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0).add(Attributes.FOLLOW_RANGE, 16.0).add(Attributes.MOVEMENT_SPEED, 0.75);
.add(Attributes.MAX_HEALTH, 2.0)
.add(Attributes.FOLLOW_RANGE, 16.0)
.add(Attributes.MOVEMENT_SPEED, 0.75);
} }
public int getVariant() { public int getVariant() {

View file

@ -66,11 +66,7 @@ public class EndSlimeEntity extends Slime {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 1.0D).add(Attributes.ATTACK_DAMAGE, 1.0D).add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.MOVEMENT_SPEED, 0.15D);
.add(Attributes.MAX_HEALTH, 1.0D)
.add(Attributes.ATTACK_DAMAGE, 1.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.MOVEMENT_SPEED, 0.15D);
} }
@Override @Override
@ -268,9 +264,7 @@ public class EndSlimeEntity extends Slime {
} }
public boolean canUse() { public boolean canUse() {
return (EndSlimeEntity.this.isInWater() return (EndSlimeEntity.this.isInWater() || EndSlimeEntity.this.isInLava()) && EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
|| EndSlimeEntity.this.isInLava())
&& EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
} }
public void tick() { public void tick() {
@ -291,12 +285,7 @@ public class EndSlimeEntity extends Slime {
} }
public boolean canUse() { public boolean canUse() {
return EndSlimeEntity.this.getTarget() == null return EndSlimeEntity.this.getTarget() == null && (EndSlimeEntity.this.onGround || EndSlimeEntity.this.isInWater() || EndSlimeEntity.this.isInLava() || EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION)) && EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
&& (EndSlimeEntity.this.onGround
|| EndSlimeEntity.this.isInWater()
|| EndSlimeEntity.this.isInLava()
|| EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION))
&& EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
} }
public void tick() { public void tick() {

View file

@ -44,32 +44,15 @@ public class ShadowWalkerEntity extends Monster {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return Monster.createMonsterAttributes() return Monster.createMonsterAttributes().add(Attributes.FOLLOW_RANGE, 35.0).add(Attributes.MOVEMENT_SPEED, 0.15).add(Attributes.ATTACK_DAMAGE, 4.5).add(Attributes.ARMOR, 2.0).add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
.add(Attributes.FOLLOW_RANGE, 35.0)
.add(Attributes.MOVEMENT_SPEED, 0.15)
.add(Attributes.ATTACK_DAMAGE, 4.5)
.add(Attributes.ARMOR, 2.0)
.add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
} }
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
level.addParticle(ParticleTypes.ASH, level.addParticle(ParticleTypes.ASH, getX() + random.nextGaussian() * 0.2, getY() + random.nextGaussian() * 0.5 + 1, getZ() + random.nextGaussian() * 0.2, 0, 0, 0);
getX() + random.nextGaussian() * 0.2, level.addParticle(ParticleTypes.SMOKE, getX() + random.nextGaussian() * 0.2, getY() + random.nextGaussian() * 0.5 + 1, getZ() + random.nextGaussian() * 0.2, 0, 0, 0);
getY() + random.nextGaussian() * 0.5 + 1, level.addParticle(ParticleTypes.ENTITY_EFFECT, getX() + random.nextGaussian() * 0.2, getY() + random.nextGaussian() * 0.5 + 1, getZ() + random.nextGaussian() * 0.2, 0, 0, 0);
getZ() + random.nextGaussian() * 0.2,
0, 0, 0);
level.addParticle(ParticleTypes.SMOKE,
getX() + random.nextGaussian() * 0.2,
getY() + random.nextGaussian() * 0.5 + 1,
getZ() + random.nextGaussian() * 0.2,
0, 0, 0);
level.addParticle(ParticleTypes.ENTITY_EFFECT,
getX() + random.nextGaussian() * 0.2,
getY() + random.nextGaussian() * 0.5 + 1,
getZ() + random.nextGaussian() * 0.2,
0, 0, 0);
} }
@Override @Override

View file

@ -70,11 +70,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0D).add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.FLYING_SPEED, 0.4D).add(Attributes.MOVEMENT_SPEED, 0.1D);
.add(Attributes.MAX_HEALTH, 2.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.FLYING_SPEED, 0.4D)
.add(Attributes.MOVEMENT_SPEED, 0.1D);
} }
public void setHive(Level world, BlockPos hive) { public void setHive(Level world, BlockPos hive) {
@ -253,11 +249,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
@Override @Override
public boolean canUse() { public boolean canUse() {
return SilkMothEntity.this.hivePos != null return SilkMothEntity.this.hivePos != null && SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level && SilkMothEntity.this.navigation.isDone() && SilkMothEntity.this.random.nextInt(16) == 0 && SilkMothEntity.this.position().distanceToSqr(SilkMothEntity.this.hivePos.getX(), SilkMothEntity.this.hivePos.getY(), SilkMothEntity.this.hivePos.getZ()) < 64;
&& SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level
&& SilkMothEntity.this.navigation.isDone()
&& SilkMothEntity.this.random.nextInt(16) == 0
&& SilkMothEntity.this.position().distanceToSqr(SilkMothEntity.this.hivePos.getX(), SilkMothEntity.this.hivePos.getY(), SilkMothEntity.this.hivePos.getZ()) < 64;
} }
@Override @Override

View file

@ -26,32 +26,14 @@ public class CubozoaEntityModel extends BlockBenchModel<CubozoaEntity> {
MeshDefinition modelData = new MeshDefinition(); MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 17).addBox(-2.0F, -12.5F, -2.0F, 4.0F, 4.0F, 4.0F), PartPose.offset(0.0F, 24.0F, 0.0F));
CubeListBuilder
.create()
.texOffs(0, 17)
.addBox(-2.0F, -12.5F, -2.0F, 4.0F, 4.0F, 4.0F),
PartPose.offset(0.0F, 24.0F, 0.0F)
);
bodyPart.addOrReplaceChild("main_cube_r1", CubeListBuilder.create() bodyPart.addOrReplaceChild("main_cube_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-5.0F, -7.0F, -5.0F, 10.0F, 7.0F, 10.0F), PartPose.offsetAndRotation(0.0F, -14.0F, 0.0F, 0.0F, 0.0F, -3.1416F));
.texOffs(0, 0)
.addBox(-5.0F, -7.0F, -5.0F, 10.0F, 7.0F, 10.0F), PartPose.offsetAndRotation(0.0F, -14.0F, 0.0F, 0.0F, 0.0F, -3.1416F));
for (int i = 1; i <= TENTACLE_COUNT; i++) { for (int i = 1; i <= TENTACLE_COUNT; i++) {
PartDefinition tentaclePart = bodyPart PartDefinition tentaclePart = bodyPart.addOrReplaceChild("tentacle_center_" + i, CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, i * 1.5708F, 0.0F));
.addOrReplaceChild("tentacle_center_" + i,
CubeListBuilder.create(),
PartPose.offsetAndRotation(
0.0F, 0.0F, 0.0F,
0.0F, i * 1.5708F, 0.0F
)
);
tentaclePart.addOrReplaceChild("tentacle_" + i, CubeListBuilder.create() tentaclePart.addOrReplaceChild("tentacle_" + i, CubeListBuilder.create().texOffs(16, 17).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F), PartPose.offset(0.0F, -7.0F, 4.5F));
.texOffs(16, 17)
.addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F),
PartPose.offset(0.0F, -7.0F, 4.5F));
} }
return LayerDefinition.create(modelData, 48, 48); return LayerDefinition.create(modelData, 48, 48);

View file

@ -28,87 +28,25 @@ public class DragonflyEntityModel extends BlockBenchModel<DragonflyEntity> {
MeshDefinition modelData = new MeshDefinition(); MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -4.0F, 0.0F, 4.0F, 4.0F, 9.0F), PartPose.offset(2.0F, 21.5F, -4.0F));
CubeListBuilder
.create()
.texOffs(0, 0)
.addBox(-4.0F, -4.0F, 0.0F, 4.0F, 4.0F, 9.0F),
PartPose.offset(2.0F, 21.5F, -4.0F)
);
bodyPart.addOrReplaceChild(PartNames.HEAD, bodyPart.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create().texOffs(17, 0).addBox(-1.5F, -1.5F, -2.5F, 3.0F, 3.0F, 3.0F), PartPose.offsetAndRotation(-2.0F, -2.0F, 0.0F, 0.3491F, 0.0F, 0.0F));
CubeListBuilder
.create()
.texOffs(17, 0)
.addBox(-1.5F, -1.5F, -2.5F, 3.0F, 3.0F, 3.0F),
PartPose.offsetAndRotation(-2.0F, -2.0F, 0.0F, 0.3491F, 0.0F, 0.0F)
);
PartDefinition tailPart = bodyPart.addOrReplaceChild(PartNames.TAIL, PartDefinition tailPart = bodyPart.addOrReplaceChild(PartNames.TAIL, CubeListBuilder.create().texOffs(26, 0).addBox(-1.5F, -1.5F, 0.0F, 3.0F, 3.0F, 7.0F), PartPose.offset(-2.0F, -2.0F, 9.0F));
CubeListBuilder
.create()
.texOffs(26, 0)
.addBox(-1.5F, -1.5F, 0.0F, 3.0F, 3.0F, 7.0F),
PartPose.offset(-2.0F, -2.0F, 9.0F)
);
tailPart.addOrReplaceChild(PartNames.TAIL_FIN, tailPart.addOrReplaceChild(PartNames.TAIL_FIN, CubeListBuilder.create().texOffs(36, 0).addBox(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 10.0F), PartPose.offset(0.0F, 0.0F, 7.0F));
CubeListBuilder
.create()
.texOffs(36, 0)
.addBox(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 10.0F),
PartPose.offset(0.0F, 0.0F, 7.0F)
);
bodyPart.addOrReplaceChild(PartNames.LEFT_WING, bodyPart.addOrReplaceChild(PartNames.LEFT_WING, CubeListBuilder.create().texOffs(0, 13).addBox(-15.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F), PartPose.offset(-2.0F, -4.0F, 4.0F));
CubeListBuilder
.create()
.texOffs(0, 13)
.addBox(-15.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F),
PartPose.offset(-2.0F, -4.0F, 4.0F)
);
bodyPart.addOrReplaceChild(PartNames.RIGHT_WING, bodyPart.addOrReplaceChild(PartNames.RIGHT_WING, CubeListBuilder.create().mirror().texOffs(0, 13).addBox(0.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F), PartPose.offset(-2.0F, -4.0F, 4.0F));
CubeListBuilder
.create()
.mirror()
.texOffs(0, 13)
.addBox(0.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F),
PartPose.offset(-2.0F, -4.0F, 4.0F)
);
bodyPart.addOrReplaceChild(PartNames.LEFT_WING_BASE, bodyPart.addOrReplaceChild(PartNames.LEFT_WING_BASE, CubeListBuilder.create().texOffs(4, 17).addBox(-12.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F), PartPose.offset(-2.0F, -4.0F, 8.0F));
CubeListBuilder
.create()
.texOffs(4, 17)
.addBox(-12.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F),
PartPose.offset(-2.0F, -4.0F, 8.0F)
);
bodyPart.addOrReplaceChild(PartNames.RIGHT_WING_BASE, bodyPart.addOrReplaceChild(PartNames.RIGHT_WING_BASE, CubeListBuilder.create().mirror().texOffs(4, 17).addBox(0.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F), PartPose.offset(-2.0F, -4.0F, 8.0F));
CubeListBuilder
.create()
.mirror()
.texOffs(4, 17)
.addBox(0.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F),
PartPose.offset(-2.0F, -4.0F, 8.0F)
);
bodyPart.addOrReplaceChild(PartNames.LEFT_LEG, bodyPart.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create().texOffs(50, 1).addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F), PartPose.offsetAndRotation(-1.0F, 0.0F, 1.0F, 0.0F, 0.0F, -0.5236F));
CubeListBuilder
.create()
.texOffs(50, 1)
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F),
PartPose.offsetAndRotation(-1.0F, 0.0F, 1.0F, 0.0F, 0.0F, -0.5236F)
);
bodyPart.addOrReplaceChild(PartNames.RIGHT_LEG, bodyPart.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create().texOffs(50, 1).addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F), PartPose.offsetAndRotation(-3.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.5236F));
CubeListBuilder
.create()
.texOffs(50, 1)
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F),
PartPose.offsetAndRotation(-3.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.5236F)
);
return LayerDefinition.create(modelData, 64, 64); return LayerDefinition.create(modelData, 64, 64);
} }

View file

@ -24,54 +24,17 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
MeshDefinition modelData = new MeshDefinition(); MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -2.0F, -4.0F, 2.0F, 4.0F, 8.0F), PartPose.offset(0.0F, 20.0F, 0.0F));
CubeListBuilder
.create()
.texOffs(0, 0)
.addBox(-1.0F, -2.0F, -4.0F, 2.0F, 4.0F, 8.0F),
PartPose.offset(0.0F, 20.0F, 0.0F)
);
bodyPart.addOrReplaceChild(PartNames.TOP_FIN, bodyPart.addOrReplaceChild(PartNames.TOP_FIN, CubeListBuilder.create().texOffs(0, 6).addBox(0.0F, -8.0F, 0.0F, 0.0F, 8.0F, 6.0F), PartPose.offsetAndRotation(0.0F, -2.0F, -4.0F, -0.6981F, 0.0F, 0.0F));
CubeListBuilder
.create()
.texOffs(0, 6)
.addBox(0.0F, -8.0F, 0.0F, 0.0F, 8.0F, 6.0F),
PartPose.offsetAndRotation(0.0F, -2.0F, -4.0F, -0.6981F, 0.0F, 0.0F)
);
bodyPart.addOrReplaceChild(PartNames.BOTTOM_FIN, bodyPart.addOrReplaceChild(PartNames.BOTTOM_FIN, CubeListBuilder.create().texOffs(0, 6).addBox(0.0F, 0.0F, 0.0F, 0.0F, 8.0F, 6.0F), PartPose.offsetAndRotation(0.0F, 2.0F, -4.0F, 0.6981F, 0.0F, 0.0F));
CubeListBuilder
.create()
.texOffs(0, 6)
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 8.0F, 6.0F),
PartPose.offsetAndRotation(0.0F, 2.0F, -4.0F, 0.6981F, 0.0F, 0.0F)
);
bodyPart.addOrReplaceChild(PartNames.TAIL_FIN, bodyPart.addOrReplaceChild(PartNames.TAIL_FIN, CubeListBuilder.create().texOffs(0, 15).addBox(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 5.0F), PartPose.offsetAndRotation(0.0F, 0.0F, 2.0F, -0.7854F, 0.0F, 0.0F));
CubeListBuilder
.create()
.texOffs(0, 15)
.addBox(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 5.0F),
PartPose.offsetAndRotation(0.0F, 0.0F, 2.0F, -0.7854F, 0.0F, 0.0F)
);
bodyPart.addOrReplaceChild(PartNames.RIGHT_FIN, bodyPart.addOrReplaceChild(PartNames.RIGHT_FIN, CubeListBuilder.create().texOffs(0, 25).addBox(-3.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F), PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F, 1.5708F, 0.7854F, 0.0F));
CubeListBuilder
.create()
.texOffs(0, 25)
.addBox(-3.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F),
PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F, 1.5708F, 0.7854F, 0.0F)
);
bodyPart.addOrReplaceChild(PartNames.LEFT_FIN, bodyPart.addOrReplaceChild(PartNames.LEFT_FIN, CubeListBuilder.create().mirror().texOffs(0, 25).addBox(0.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F), PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F, 1.5708F, -0.7854F, 0.0F));
CubeListBuilder
.create()
.mirror()
.texOffs(0, 25)
.addBox(0.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F),
PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F, 1.5708F, -0.7854F, 0.0F)
);
return LayerDefinition.create(modelData, 32, 32); return LayerDefinition.create(modelData, 32, 32);
} }

View file

@ -38,46 +38,16 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
if (onlyShell) { if (onlyShell) {
modelPartData.addOrReplaceChild(PartNames.BODY, modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO);
CubeListBuilder
.create()
.texOffs(0, 0)
.addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F),
PartPose.ZERO
);
} }
else { else {
modelPartData.addOrReplaceChild(PartNames.BODY, modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 16).addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F), PartPose.ZERO);
CubeListBuilder
.create()
.texOffs(0, 16)
.addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F),
PartPose.ZERO
);
modelPartData.addOrReplaceChild(PartNames.RIGHT_EYE, modelPartData.addOrReplaceChild(PartNames.RIGHT_EYE, CubeListBuilder.create().texOffs(32, 0).addBox(-3.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F), PartPose.ZERO);
CubeListBuilder
.create()
.texOffs(32, 0)
.addBox(-3.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F),
PartPose.ZERO
);
modelPartData.addOrReplaceChild(PartNames.LEFT_EYE, modelPartData.addOrReplaceChild(PartNames.LEFT_EYE, CubeListBuilder.create().texOffs(32, 4).addBox(1.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F), PartPose.ZERO);
CubeListBuilder
.create()
.texOffs(32, 4)
.addBox(1.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F),
PartPose.ZERO
);
modelPartData.addOrReplaceChild(PartNames.MOUTH, modelPartData.addOrReplaceChild(PartNames.MOUTH, CubeListBuilder.create().texOffs(32, 8).addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F), PartPose.ZERO);
CubeListBuilder
.create()
.texOffs(32, 8)
.addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F),
PartPose.ZERO
);
PartDefinition flowerPart = modelPartData.addOrReplaceChild("flower", CubeListBuilder.create(), PartPose.ZERO); PartDefinition flowerPart = modelPartData.addOrReplaceChild("flower", CubeListBuilder.create(), PartPose.ZERO);
PartDefinition cropPart = modelPartData.addOrReplaceChild("crop", CubeListBuilder.create(), PartPose.ZERO); PartDefinition cropPart = modelPartData.addOrReplaceChild("crop", CubeListBuilder.create(), PartPose.ZERO);
@ -86,18 +56,10 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
final PartDefinition parent = i < 4 ? flowerPart : cropPart; final PartDefinition parent = i < 4 ? flowerPart : cropPart;
final float rot = MHelper.degreesToRadians(i < 4 ? (i * 45F) : ((i - 4) * 90F + 45F)); final float rot = MHelper.degreesToRadians(i < 4 ? (i * 45F) : ((i - 4) * 90F + 45F));
PartDefinition petalRotPart = parent.addOrReplaceChild("petalRot_" + i, PartDefinition petalRotPart = parent.addOrReplaceChild("petalRot_" + i, CubeListBuilder.create(), PartPose.offsetAndRotation(0, 0, 0, 0, rot, 0));
CubeListBuilder.create(),
PartPose.offsetAndRotation(0, 0, 0, 0, rot, 0));
petalRotPart.addOrReplaceChild("petal_" + i, petalRotPart.addOrReplaceChild("petal_" + i, CubeListBuilder.create().texOffs(40, 0).addBox(0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 0.0F), PartPose.offset(-4, 8, 0));
CubeListBuilder
.create()
.texOffs(40, 0)
.addBox(0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 0.0F),
PartPose.offset(-4, 8, 0)
);
} }
} }

View file

@ -34,124 +34,35 @@ public class SilkMothEntityModel extends BlockBenchModel<SilkMothEntity> {
MeshDefinition modelData = new MeshDefinition(); MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot(); PartDefinition modelPartData = modelData.getRoot();
PartDefinition legsL = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, PartDefinition legsL = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create().texOffs(0, 0), PartPose.offsetAndRotation(1.5f, 19.9f, -0.45f, 0.0f, 0.0f, 0.6981f));
CubeListBuilder
.create()
.texOffs(0, 0),
PartPose.offsetAndRotation(1.5f, 19.9f, -0.45f, 0.0f, 0.0f, 0.6981f)
);
legsL.addOrReplaceChild("cube_r1", legsL.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 13).addBox(0.0216f, 0.0f, -0.5976f, 3.0f, 0.0f, 1.0f), PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f, 0.0f, 0.2182f, 0.3927f));
CubeListBuilder
.create()
.texOffs(0, 13)
.addBox(0.0216f, 0.0f, -0.5976f, 3.0f, 0.0f, 1.0f),
PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f, 0.0f, 0.2182f, 0.3927f)
);
legsL.addOrReplaceChild("cube_r2", legsL.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(0, 15).addBox(0.0f, 0.0f, -0.6f, 3.0f, 0.0f, 1.0f), PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f, 0.0f, 0.0f, 0.3927f));
CubeListBuilder
.create()
.texOffs(0, 15)
.addBox(0.0f, 0.0f, -0.6f, 3.0f, 0.0f, 1.0f),
PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f, 0.0f, 0.0f, 0.3927f)
);
legsL.addOrReplaceChild("cube_r3", legsL.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(0, 14).addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f), PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f, 0.0f, -0.2182f, 0.3927f));
CubeListBuilder
.create()
.texOffs(0, 14)
.addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f),
PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f, 0.0f, -0.2182f, 0.3927f)
);
PartDefinition legsR = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, PartDefinition legsR = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create().texOffs(0, 0), PartPose.offsetAndRotation(-1.5f, 19.9f, -0.55f, 0.0f, 3.1416f, -0.6545f));
CubeListBuilder
.create()
.texOffs(0, 0),
PartPose.offsetAndRotation(-1.5f, 19.9f, -0.55f, 0.0f, 3.1416f, -0.6545f)
);
legsR.addOrReplaceChild("cube_r4", legsR.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(0, 10).addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f), PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f, 0.0f, 0.2182f, 0.3927f));
CubeListBuilder
.create()
.texOffs(0, 10)
.addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f),
PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f, 0.0f, 0.2182f, 0.3927f)
);
legsR.addOrReplaceChild("cube_r5", legsR.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(0, 11).addBox(0.0f, 0.0f, -0.4f, 3.0f, 0.0f, 1.0f), PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f, 0.0f, 0.0f, 0.3927f));
CubeListBuilder
.create()
.texOffs(0, 11)
.addBox(0.0f, 0.0f, -0.4f, 3.0f, 0.0f, 1.0f),
PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f, 0.0f, 0.0f, 0.3927f)
);
legsR.addOrReplaceChild("cube_r6", legsR.addOrReplaceChild("cube_r6", CubeListBuilder.create().texOffs(0, 12).addBox(0.0216f, 0.0f, -0.4024f, 3.0f, 0.0f, 1.0f), PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f, 0.0f, -0.2182f, 0.3927f));
CubeListBuilder
.create()
.texOffs(0, 12)
.addBox(0.0216f, 0.0f, -0.4024f, 3.0f, 0.0f, 1.0f),
PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f, 0.0f, -0.2182f, 0.3927f)
);
PartDefinition head_pivot = modelPartData.addOrReplaceChild(PartNames.HEAD, PartDefinition head_pivot = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create().texOffs(15, 10).addBox(-1.5f, -1.5f, -2.0f, 3.0f, 3.0f, 3.0f), PartPose.offset(0.0f, 18.0f, -3.0f));
CubeListBuilder
.create()
.texOffs(15, 10)
.addBox(-1.5f, -1.5f, -2.0f, 3.0f, 3.0f, 3.0f),
PartPose.offset(0.0f, 18.0f, -3.0f)
);
head_pivot.addOrReplaceChild("tendril_r_r1", head_pivot.addOrReplaceChild("tendril_r_r1", CubeListBuilder.create().mirror().texOffs(23, 0).addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f), PartPose.offsetAndRotation(1.0f, -1.15f, -1.0f, 0.0f, 0.0f, 0.3927f));
CubeListBuilder
.create()
.mirror()
.texOffs(23, 0)
.addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f),
PartPose.offsetAndRotation(1.0f, -1.15f, -1.0f, 0.0f, 0.0f, 0.3927f)
);
head_pivot.addOrReplaceChild("tendril_r_r2", head_pivot.addOrReplaceChild("tendril_r_r2", CubeListBuilder.create().texOffs(23, 0).addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f), PartPose.offsetAndRotation(-1.0f, -1.15f, -1.0f, 0.0f, 0.0f, -0.3927f));
CubeListBuilder
.create()
.texOffs(23, 0)
.addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f),
PartPose.offsetAndRotation(-1.0f, -1.15f, -1.0f, 0.0f, 0.0f, -0.3927f)
);
PartDefinition bb_main = modelPartData.addOrReplaceChild(PartNames.BODY, PartDefinition bb_main = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(19, 19).addBox(-2.5f, -8.5f, -3.0f, 5.0f, 5.0f, 3.0f), PartPose.offset(0.0f, 24.0f, 0.0f));
CubeListBuilder
.create()
.texOffs(19, 19)
.addBox(-2.5f, -8.5f, -3.0f, 5.0f, 5.0f, 3.0f),
PartPose.offset(0.0f, 24.0f, 0.0f)
);
bb_main.addOrReplaceChild(PartNames.RIGHT_WING, bb_main.addOrReplaceChild(PartNames.RIGHT_WING, CubeListBuilder.create().mirror().texOffs(0, 5).addBox(-7.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f), PartPose.offsetAndRotation(-1.5f, -6.5f, 0.5f, 0.0f, 0.0f, 0.3927f));
CubeListBuilder.create()
.mirror()
.texOffs(0, 5)
.addBox(-7.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f),
PartPose.offsetAndRotation(-1.5f, -6.5f, 0.5f, 0.0f, 0.0f, 0.3927f)
);
bb_main.addOrReplaceChild(PartNames.LEFT_WING, bb_main.addOrReplaceChild(PartNames.LEFT_WING, CubeListBuilder.create().texOffs(0, 5).addBox(-2.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f), PartPose.offsetAndRotation(1.5f, -6.5f, 0.5f, 0.0f, 0.0f, -0.3927f));
CubeListBuilder
.create()
.texOffs(0, 5)
.addBox(-2.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f),
PartPose.offsetAndRotation(1.5f, -6.5f, 0.5f, 0.0f, 0.0f, -0.3927f)
);
bb_main.addOrReplaceChild("abdomen_r1", bb_main.addOrReplaceChild("abdomen_r1", CubeListBuilder.create().texOffs(0, 10).addBox(-3.0f, -4.0f, -1.0f, 4.0f, 4.0f, 7.0f), PartPose.offsetAndRotation(1.0f, -3.9f, 0.0f, -0.3927f, 0.0f, 0.0f));
CubeListBuilder
.create()
.texOffs(0, 10)
.addBox(-3.0f, -4.0f, -1.0f, 4.0f, 4.0f, 7.0f),
PartPose.offsetAndRotation(1.0f, -3.9f, 0.0f, -0.3927f, 0.0f, 0.0f)
);
return LayerDefinition.create(modelData, 64, 64); return LayerDefinition.create(modelData, 64, 64);
} }

View file

@ -27,12 +27,9 @@ public class RendererEntityEndFish extends MobRenderer<EndFishEntity, EndFishEnt
} }
@Override @Override
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndFishEntity entity, public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndFishEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
float headPitch) {
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getVariant()]); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getVariant()]);
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
1.0F, 1.0F, 1.0F, 1.0F);
} }
}); });
} }

View file

@ -31,12 +31,9 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
} }
@Override @Override
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndSlimeEntity entity, public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndSlimeEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
float headPitch) {
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getSlimeType()]); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getSlimeType()]);
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
1.0F, 1.0F, 1.0F, 1.0F);
if (entity.isLake()) { if (entity.isLake()) {
this.getParentModel().renderFlower(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY); this.getParentModel().renderFlower(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY);
} }
@ -50,8 +47,7 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
} }
@Override @Override
public void render(EndSlimeEntity slimeEntity, float f, float g, PoseStack matrixStack, public void render(EndSlimeEntity slimeEntity, float f, float g, PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i) {
MultiBufferSource vertexConsumerProvider, int i) {
this.shadowRadius = 0.25F * (float) slimeEntity.getSize(); this.shadowRadius = 0.25F * (float) slimeEntity.getSize();
super.render(slimeEntity, f, g, matrixStack, vertexConsumerProvider, i); super.render(slimeEntity, f, g, matrixStack, vertexConsumerProvider, i);
} }
@ -66,8 +62,7 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
matrixStack.scale(j * h, 1.0F / j * h, j * h); matrixStack.scale(j * h, 1.0F / j * h, j * h);
} }
private final class OverlayFeatureRenderer<T extends EndSlimeEntity> private final class OverlayFeatureRenderer<T extends EndSlimeEntity> extends RenderLayer<T, EndSlimeEntityModel<T>> {
extends RenderLayer<T, EndSlimeEntityModel<T>> {
private final EndSlimeEntityModel<T> modelOrdinal; private final EndSlimeEntityModel<T> modelOrdinal;
private final EndSlimeEntityModel<T> modelLake; private final EndSlimeEntityModel<T> modelLake;
@ -77,30 +72,23 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
modelLake = new EndSlimeEntityModel<>(ctx.getModelSet(), true); modelLake = new EndSlimeEntityModel<>(ctx.getModelSet(), true);
} }
public void render(PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i, T livingEntity, public void render(PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
float f, float g, float h, float j, float k, float l) {
if (!livingEntity.isInvisible()) { if (!livingEntity.isInvisible()) {
if (livingEntity.isLake()) { if (livingEntity.isLake()) {
VertexConsumer vertexConsumer = vertexConsumerProvider VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity)));
.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity))); this.getParentModel().renderFlower(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
this.getParentModel().renderFlower(matrixStack, vertexConsumer, i,
LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
} }
else if (livingEntity.isAmber() || livingEntity.isChorus()) { else if (livingEntity.isAmber() || livingEntity.isChorus()) {
VertexConsumer vertexConsumer = vertexConsumerProvider VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity)));
.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity))); this.getParentModel().renderCrop(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
this.getParentModel().renderCrop(matrixStack, vertexConsumer, i,
LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
} }
EndSlimeEntityModel<T> model = livingEntity.getSlimeType() == 1 ? modelLake : modelOrdinal; EndSlimeEntityModel<T> model = livingEntity.getSlimeType() == 1 ? modelLake : modelOrdinal;
this.getParentModel().copyPropertiesTo(model); this.getParentModel().copyPropertiesTo(model);
model.prepareMobModel(livingEntity, f, g, h); model.prepareMobModel(livingEntity, f, g, h);
model.setupAnim(livingEntity, f, g, j, k, l); model.setupAnim(livingEntity, f, g, j, k, l);
VertexConsumer vertexConsumer = vertexConsumerProvider VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityTranslucent(this.getTextureLocation(livingEntity)));
.getBuffer(RenderType.entityTranslucent(this.getTextureLocation(livingEntity))); model.renderToBuffer(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F);
model.renderToBuffer(matrixStack, vertexConsumer, i,
LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F);
} }
} }
} }

View file

@ -8,8 +8,7 @@ import net.minecraft.resources.ResourceLocation;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.entity.ShadowWalkerEntity; import ru.betterend.entity.ShadowWalkerEntity;
public class RendererEntityShadowWalker public class RendererEntityShadowWalker extends HumanoidMobRenderer<ShadowWalkerEntity, PlayerModel<ShadowWalkerEntity>> {
extends HumanoidMobRenderer<ShadowWalkerEntity, PlayerModel<ShadowWalkerEntity>> {
private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/shadow_walker.png"); private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/shadow_walker.png");
public RendererEntityShadowWalker(EntityRendererProvider.Context ctx) { public RendererEntityShadowWalker(EntityRendererProvider.Context ctx) {

View file

@ -32,13 +32,7 @@ public class Integrations {
} }
}); });
GridRecipe.make(BetterEnd.MOD_ID, "guide_book", GuideBookItem.GUIDE_BOOK) GridRecipe.make(BetterEnd.MOD_ID, "guide_book", GuideBookItem.GUIDE_BOOK).checkConfig(Configs.RECIPE_CONFIG).setShape("D", "B", "C").addMaterial('D', EndItems.ENDER_DUST).addMaterial('B', Items.BOOK).addMaterial('C', EndItems.CRYSTAL_SHARDS).build();
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("D", "B", "C")
.addMaterial('D', EndItems.ENDER_DUST)
.addMaterial('B', Items.BOOK)
.addMaterial('C', EndItems.CRYSTAL_SHARDS)
.build();
} }
hasHydrogen = FabricLoader.getInstance().isModLoaded("hydrogen"); hasHydrogen = FabricLoader.getInstance().isModLoaded("hydrogen");
} }

View file

@ -18,38 +18,9 @@ public class NourishIntegration extends ModIntegration {
Tag.Named<Item> protein = getItemTag("protein"); Tag.Named<Item> protein = getItemTag("protein");
Tag.Named<Item> sweets = getItemTag("sweets"); Tag.Named<Item> sweets = getItemTag("sweets");
TagHelper.addTag( TagHelper.addTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
fats, TagHelper.addTag(fruit, EndItems.SHADOW_BERRY_RAW, EndItems.SHADOW_BERRY_COOKED, EndItems.BLOSSOM_BERRY, EndItems.SHADOW_BERRY_JELLY, EndItems.SWEET_BERRY_JELLY, EndItems.BLOSSOM_BERRY_JELLY, EndItems.AMBER_ROOT_RAW, EndItems.CHORUS_MUSHROOM_RAW, EndItems.CHORUS_MUSHROOM_COOKED, EndItems.BOLUX_MUSHROOM_COOKED);
EndItems.END_FISH_RAW, TagHelper.addTag(protein, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED, EndItems.CHORUS_MUSHROOM_COOKED, EndItems.BOLUX_MUSHROOM_COOKED, EndItems.CAVE_PUMPKIN_PIE);
EndItems.END_FISH_COOKED TagHelper.addTag(sweets, EndItems.SHADOW_BERRY_JELLY, EndItems.SWEET_BERRY_JELLY, EndItems.BLOSSOM_BERRY_JELLY, EndItems.CAVE_PUMPKIN_PIE);
);
TagHelper.addTag(
fruit,
EndItems.SHADOW_BERRY_RAW,
EndItems.SHADOW_BERRY_COOKED,
EndItems.BLOSSOM_BERRY,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,
EndItems.BLOSSOM_BERRY_JELLY,
EndItems.AMBER_ROOT_RAW,
EndItems.CHORUS_MUSHROOM_RAW,
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED
);
TagHelper.addTag(
protein,
EndItems.END_FISH_RAW,
EndItems.END_FISH_COOKED,
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED,
EndItems.CAVE_PUMPKIN_PIE
);
TagHelper.addTag(
sweets,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,
EndItems.BLOSSOM_BERRY_JELLY,
EndItems.CAVE_PUMPKIN_PIE
);
} }
} }

View file

@ -26,19 +26,7 @@ public class NightshadeRedwoods extends EndBiome {
Biome biome = Integrations.BYG.getBiome("nightshade_forest"); Biome biome = Integrations.BYG.getBiome("nightshade_forest");
BiomeSpecialEffects effects = biome.getSpecialEffects(); BiomeSpecialEffects effects = biome.getSpecialEffects();
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods")) BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods")).setFogColor(140, 108, 47).setFogDensity(1.5F).setWaterAndFogColor(55, 70, 186).setFoliageColor(122, 17, 155).setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(biome.getGenerationSettings().getSurfaceBuilder().get()).setGrassColor(48, 13, 89).setPlantsColor(200, 125, 9).addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE).addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD).addFeature(BYGFeatures.NIGHTSHADE_MOSS);
.setFogColor(140, 108, 47)
.setFogDensity(1.5F)
.setWaterAndFogColor(55, 70, 186)
.setFoliageColor(122, 17, 155)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get())
.setGrassColor(48, 13, 89)
.setPlantsColor(200, 125, 9)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE)
.addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD)
.addFeature(BYGFeatures.NIGHTSHADE_MOSS);
if (BCLib.isClient()) { if (BCLib.isClient()) {
SoundEvent loop = effects.getAmbientLoopSoundEvent().get(); SoundEvent loop = effects.getAmbientLoopSoundEvent().get();

View file

@ -44,15 +44,7 @@ public class OldBulbisGardens extends EndBiome {
Block ivis = Integrations.BYG.getBlock("ivis_phylium"); Block ivis = Integrations.BYG.getBlock("ivis_phylium");
Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock(); Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock();
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens")) BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens")).setFogColor(215, 132, 207).setFogDensity(1.8F).setWaterAndFogColor(40, 0, 56).setFoliageColor(122, 17, 155).setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(ivis, origin).addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.OLD_BULBIS_TREE);
.setFogColor(215, 132, 207)
.setFogDensity(1.8F)
.setWaterAndFogColor(40, 0, 56)
.setFoliageColor(122, 17, 155)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
.setSurface(ivis, origin)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(BYGFeatures.OLD_BULBIS_TREE);
if (BCLib.isClient()) { if (BCLib.isClient()) {
SoundEvent loop = effects.getAmbientLoopSoundEvent().get(); SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
@ -90,11 +82,7 @@ public class OldBulbisGardens extends EndBiome {
} }
} }
def.addFeature(EndFeatures.PURPLE_POLYPORE) def.addFeature(EndFeatures.PURPLE_POLYPORE).addFeature(BYGFeatures.IVIS_MOSS_WOOD).addFeature(BYGFeatures.IVIS_MOSS).addFeature(BYGFeatures.IVIS_VINE).addFeature(BYGFeatures.IVIS_SPROUT);
.addFeature(BYGFeatures.IVIS_MOSS_WOOD)
.addFeature(BYGFeatures.IVIS_MOSS)
.addFeature(BYGFeatures.IVIS_VINE)
.addFeature(BYGFeatures.IVIS_SPROUT);
return def; return def;
} }

View file

@ -24,8 +24,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
return false;
BlockState log = Integrations.BYG.getDefaultState("ether_log"); BlockState log = Integrations.BYG.getDefaultState("ether_log");
BlockState wood = Integrations.BYG.getDefaultState("ether_wood"); BlockState wood = Integrations.BYG.getDefaultState("ether_wood");
@ -33,8 +32,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
return log; return log;
}; };
Function<BlockState, Boolean> replace = (state) -> { Function<BlockState, Boolean> replace = (state) -> {
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
|| state.getMaterial().isReplaceable();
}; };
int height = MHelper.randRange(40, 60, random); int height = MHelper.randRange(40, 60, random);
@ -64,8 +62,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
} }
sdf.setReplaceFunction((state) -> { sdf.setReplaceFunction((state) -> {
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
|| state.getMaterial().isReplaceable();
}).addPostProcess((info) -> { }).addPostProcess((info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) { if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
return wood; return wood;

View file

@ -38,8 +38,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
return false;
BlockState log = Integrations.BYG.getDefaultState("nightshade_log"); BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood"); BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood");
@ -50,8 +49,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
return log; return log;
}; };
Function<BlockState, Boolean> replace = (state) -> { Function<BlockState, Boolean> replace = (state) -> {
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
|| state.getMaterial().isReplaceable();
}; };
Function<PosInfo, BlockState> post = (info) -> { Function<PosInfo, BlockState> post = (info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) { if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
@ -92,8 +90,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer); SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer);
SDF roots = new SDFSphere().setRadius(2F).setBlock(log); SDF roots = new SDFSphere().setRadius(2F).setBlock(log);
roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random)) roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random)).setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
.setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
sdf = new SDFSmoothUnion().setRadius(2F).setSourceA(sdf).setSourceB(roots); sdf = new SDFSmoothUnion().setRadius(2F).setSourceA(sdf).setSourceB(roots);
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos); sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F); Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F);
@ -178,14 +175,12 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
canopy = new SDFDisplacement().setFunction((vec) -> { canopy = new SDFDisplacement().setFunction((vec) -> {
return MHelper.randRange(-3F, 3F, random); return MHelper.randRange(-3F, 3F, random);
}).setSource(canopy); }).setSource(canopy);
canopy.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world, canopy.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world, pos.offset(0, height * 0.75, 0), ignore);
pos.offset(0, height * 0.75, 0), ignore);
return true; return true;
} }
static { static {
BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0), new Vector3f(0.25F, 0.1F, 0), new Vector3f(0.40F, 0.2F, 0), BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0), new Vector3f(0.25F, 0.1F, 0), new Vector3f(0.40F, 0.2F, 0), new Vector3f(0.50F, 0.4F, 0), new Vector3f(0.55F, 0.6F, 0));
new Vector3f(0.50F, 0.4F, 0), new Vector3f(0.55F, 0.6F, 0));
} }
} }

View file

@ -39,20 +39,16 @@ public class OldBulbisTreeFeature extends DefaultFeature {
final Random random = featureConfig.random(); final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin(); final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level(); final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
return false; if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN)) return false;
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN))
return false;
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem"); BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
BlockState wood = Integrations.BYG.getDefaultState("bulbis_wood"); BlockState wood = Integrations.BYG.getDefaultState("bulbis_wood");
BlockState cap = Integrations.BYG BlockState cap = Integrations.BYG.getDefaultState(random.nextBoolean() ? "bulbis_shell" : "purple_bulbis_shell");
.getDefaultState(random.nextBoolean() ? "bulbis_shell" : "purple_bulbis_shell");
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight"); BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
Function<BlockState, Boolean> replacement = (state) -> { Function<BlockState, Boolean> replacement = (state) -> {
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND) if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)) {
|| state.getMaterial().equals(Material.PLANT)) {
return true; return true;
} }
return state.getMaterial().isReplaceable(); return state.getMaterial().isReplaceable();
@ -91,8 +87,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
} }
sdf.setReplaceFunction(replacement).addPostProcess((info) -> { sdf.setReplaceFunction(replacement).addPostProcess((info) -> {
if (info.getState().equals(stem) if (info.getState().equals(stem) && (!info.getStateUp().equals(stem) || !info.getStateDown().equals(stem))) {
&& (!info.getStateUp().equals(stem) || !info.getStateDown().equals(stem))) {
return wood; return wood;
} }
return info.getState(); return info.getState();
@ -101,8 +96,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
return true; return true;
} }
private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow, private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow, BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong()); OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(cap); SDF sphere = new SDFSphere().setRadius(radius).setBlock(cap);
@ -149,8 +143,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
sphere.fillArea(world, pos, new AABB(pos.above((int) offsetY)).inflate(radius * 1.3F)); sphere.fillArea(world, pos, new AABB(pos.above((int) offsetY)).inflate(radius * 1.3F));
} }
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood, private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood, Function<BlockState, Boolean> replacement) {
Function<BlockState, Boolean> replacement) {
int count = (int) (radius * 1.5F); int count = (int) (radius * 1.5F);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
float angle = (float) i / (float) count * MHelper.PI2; float angle = (float) i / (float) count * MHelper.PI2;
@ -167,18 +160,13 @@ public class OldBulbisTreeFeature extends DefaultFeature {
} }
static { static {
SPLINE = Lists.newArrayList(new Vector3f(0.00F, 0.00F, 0.00F), new Vector3f(0.10F, 0.35F, 0.00F), SPLINE = Lists.newArrayList(new Vector3f(0.00F, 0.00F, 0.00F), new Vector3f(0.10F, 0.35F, 0.00F), new Vector3f(0.20F, 0.50F, 0.00F), new Vector3f(0.30F, 0.55F, 0.00F), new Vector3f(0.42F, 0.70F, 0.00F), new Vector3f(0.50F, 1.00F, 0.00F));
new Vector3f(0.20F, 0.50F, 0.00F), new Vector3f(0.30F, 0.55F, 0.00F), new Vector3f(0.42F, 0.70F, 0.00F),
new Vector3f(0.50F, 1.00F, 0.00F));
ROOT = Lists.newArrayList(new Vector3f(0F, 1F, 0), new Vector3f(0.1F, 0.70F, 0), new Vector3f(0.3F, 0.30F, 0), ROOT = Lists.newArrayList(new Vector3f(0F, 1F, 0), new Vector3f(0.1F, 0.70F, 0), new Vector3f(0.3F, 0.30F, 0), new Vector3f(0.7F, 0.05F, 0), new Vector3f(0.8F, -0.20F, 0));
new Vector3f(0.7F, 0.05F, 0), new Vector3f(0.8F, -0.20F, 0));
SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0)); SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0));
LEAF = Lists.newArrayList(new Vector3f(0.00F, 0.0F, 0), new Vector3f(0.10F, 0.4F, 0), LEAF = Lists.newArrayList(new Vector3f(0.00F, 0.0F, 0), new Vector3f(0.10F, 0.4F, 0), new Vector3f(0.40F, 0.8F, 0), new Vector3f(0.75F, 0.9F, 0), new Vector3f(1.00F, 0.8F, 0));
new Vector3f(0.40F, 0.8F, 0), new Vector3f(0.75F, 0.9F, 0), new Vector3f(1.00F, 0.8F, 0));
SIDE = Lists.newArrayList(new Vector3f(0, -0.3F, -0.5F), new Vector3f(0, -0.1F, -0.3F), SIDE = Lists.newArrayList(new Vector3f(0, -0.3F, -0.5F), new Vector3f(0, -0.1F, -0.3F), new Vector3f(0, 0.0F, 0.0F), new Vector3f(0, -0.1F, 0.3F), new Vector3f(0, -0.3F, 0.5F));
new Vector3f(0, 0.0F, 0.0F), new Vector3f(0, -0.1F, 0.3F), new Vector3f(0, -0.3F, 0.5F));
} }
} }

View file

@ -51,8 +51,7 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
widgets.add(Widgets.createRecipeBase(bounds)); widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); 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.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), widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
new TranslatableComponent("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)); widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
List<EntryIngredient> inputEntries = display.getInputEntries(); List<EntryIngredient> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput()); widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
@ -67,8 +66,7 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
} }
@Override @Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display, public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display, IntList redSlots) {
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27); Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose(); matrices.pushPose();
matrices.translate(0, 0, 400); matrices.translate(0, 0, 400);

View file

@ -34,10 +34,7 @@ public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDi
} }
protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) { protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) {
super( super(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())));
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
this.recipe = recipe; this.recipe = recipe;
this.xp = xp; this.xp = xp;
this.smeltTime = smeltTime; this.smeltTime = smeltTime;
@ -91,9 +88,6 @@ public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDi
// } // }
static { static {
fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream() fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream().map(Item::getDefaultInstance).map(EntryStacks::of).map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableComponent("category.rei.smelting.fuel").withStyle(ChatFormatting.YELLOW)))).collect(Collectors.toList());
.map(Item::getDefaultInstance).map(EntryStacks::of)
.map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableComponent("category.rei.smelting.fuel")
.withStyle(ChatFormatting.YELLOW)))).collect(Collectors.toList());
} }
} }

View file

@ -52,8 +52,7 @@ public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelD
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime()); String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
List<Widget> widgets = Lists.newArrayList(); List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime)) widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime)).color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
.color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)).animationDurationTicks(recipeDisplay.getFuelTime())); widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)).animationDurationTicks(recipeDisplay.getFuelTime()));
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)).entries(recipeDisplay.getInputEntries().get(0)).markInput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)).entries(recipeDisplay.getInputEntries().get(0)).markInput());
return widgets; return widgets;
@ -74,8 +73,7 @@ public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelD
@Nullable @Nullable
@Override @Override
public Tooltip getTooltip(Point point) { public Tooltip getTooltip(Point point) {
if (slot.containsMouse(point)) if (slot.containsMouse(point)) return slot.getCurrentTooltip(point);
return slot.getCurrentTooltip(point);
return null; return null;
} }

View file

@ -72,8 +72,7 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount())); //materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4))); widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15), widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15), new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput()); widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput()); widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput());
@ -83,8 +82,7 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
} }
@Override @Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display, public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display, IntList redSlots) {
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27); Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose(); matrices.pushPose();
matrices.translate(0, 0, 400); matrices.translate(0, 0, 400);

View file

@ -17,10 +17,7 @@ public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDispl
private final AnvilRecipe recipe; private final AnvilRecipe recipe;
public REIAnvilDisplay(AnvilRecipe recipe) { public REIAnvilDisplay(AnvilRecipe recipe) {
super( super(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())));
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
this.recipe = recipe; this.recipe = recipe;
} }

View file

@ -71,15 +71,7 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput());
widgets.add( widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6), new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
Widgets.createLabel(
new Point(bounds.getMaxX() - 5, bounds.y + 6),
new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime())
)
.noShadow()
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)
);
return widgets; return widgets;
} }

View file

@ -18,10 +18,7 @@ public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDi
private final int time; private final int time;
public REIInfusionDisplay(InfusionRecipe recipe) { public REIInfusionDisplay(InfusionRecipe recipe) {
super( super(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())));
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
this.recipe = recipe; this.recipe = recipe;
this.time = recipe.getInfusionTime(); this.time = recipe.getInfusionTime();
} }

View file

@ -50,14 +50,11 @@ public class REIPlugin implements REIClientPlugin {
END_STONE_SMELTER = EntryStacks.of(EndBlocks.END_STONE_SMELTER); END_STONE_SMELTER = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
INFUSION_RITUAL = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL); INFUSION_RITUAL = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
List<EntryStack> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream() List<EntryStack> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(EndAnvilBlock.class::isInstance).collect(Collectors.toList())));
.filter(EndAnvilBlock.class::isInstance).collect(Collectors.toList())));
anvils.add(0, EntryStacks.of(Blocks.ANVIL)); anvils.add(0, EntryStacks.of(Blocks.ANVIL));
ANVILS = anvils.toArray(new EntryStack[0]); ANVILS = anvils.toArray(new EntryStack[0]);
FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream() FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList()))).toArray(new EntryStack[0]);
.filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList())))
.toArray(new EntryStack[0]);
} }
@Override @Override
@ -79,12 +76,7 @@ public class REIPlugin implements REIClientPlugin {
public void registerCategories(CategoryRegistry registry) { public void registerCategories(CategoryRegistry registry) {
init(); init();
registry.add( registry.add(new REIAlloyingFuelCategory(), new REIAlloyingCategory(END_STONE_SMELTER), new REIInfusionCategory(INFUSION_RITUAL), new REIAnvilCategory(ANVILS));
new REIAlloyingFuelCategory(),
new REIAlloyingCategory(END_STONE_SMELTER),
new REIInfusionCategory(INFUSION_RITUAL),
new REIAnvilCategory(ANVILS)
);
registry.addWorkstations(ALLOYING_FUEL, END_STONE_SMELTER); registry.addWorkstations(ALLOYING_FUEL, END_STONE_SMELTER);
registry.addWorkstations(ALLOYING, END_STONE_SMELTER); registry.addWorkstations(ALLOYING, END_STONE_SMELTER);

View file

@ -1,4 +1,3 @@
package ru.betterend.interfaces; package ru.betterend.interfaces;
public interface BetterEndRecipe { public interface BetterEndRecipe {}
}

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