Compare commits
No commits in common. "0.10.3-pre" and "1.16.5" have entirely different histories.
0.10.3-pre
...
1.16.5
489 changed files with 6236 additions and 10368 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -29,5 +29,3 @@ bin/
|
||||||
run/
|
run/
|
||||||
output/
|
output/
|
||||||
*.log
|
*.log
|
||||||
Convert.class
|
|
||||||
ModelPart.class
|
|
||||||
|
|
180
Convert.java
180
Convert.java
|
@ -1,180 +0,0 @@
|
||||||
|
|
||||||
class ModelPart {
|
|
||||||
static java.util.ArrayList<ModelPart> parts = new java.util.ArrayList<>(20);
|
|
||||||
final String name;
|
|
||||||
ModelPart parent = null;
|
|
||||||
boolean mirror = false;
|
|
||||||
|
|
||||||
float x=0, y=0, z=0, rx=0, ry=0, rz=0;
|
|
||||||
int u=0, v=0;
|
|
||||||
float bx=0,by=0,bz=0,ba=0,bb=0,bc=0;
|
|
||||||
float scale = 1;
|
|
||||||
static int wd = 64;
|
|
||||||
static int hg = 32;
|
|
||||||
|
|
||||||
|
|
||||||
boolean hadBox = false;
|
|
||||||
ModelPart(Convert c, String name){
|
|
||||||
this(c, 0, 0, name);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart(Convert c, int u, int v, String name){
|
|
||||||
this.name = name;
|
|
||||||
this.u = u;
|
|
||||||
this.v = v;
|
|
||||||
parts.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart(int wd, int hg, int u, int v, String name){
|
|
||||||
this.name = name;
|
|
||||||
this.u = u;
|
|
||||||
this.v = v;
|
|
||||||
ModelPart.wd = wd;
|
|
||||||
ModelPart.hg = hg;
|
|
||||||
parts.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart setPos(float x, float y, float z){
|
|
||||||
this.x=x;
|
|
||||||
this.y=y;
|
|
||||||
this.z=z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart setRotationAngle(float x, float y, float z){
|
|
||||||
this.rx=x;
|
|
||||||
this.ry=y;
|
|
||||||
this.rz=z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart addChild(ModelPart p){
|
|
||||||
p.parent = this;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart texOffs(int u, int v){
|
|
||||||
this.u=u;
|
|
||||||
this.v=v;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
ModelPart addBox(float x, float y, float z, float a, float b, float c){
|
|
||||||
return addBox(x, y, z, a, b, c, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelPart addBox(float x, float y, float z, float a, float b, float c, float _d){
|
|
||||||
bx=x;
|
|
||||||
by=y;
|
|
||||||
bz=z;
|
|
||||||
ba=a;
|
|
||||||
bb=b;
|
|
||||||
bc=c;
|
|
||||||
scale = _d;
|
|
||||||
hadBox = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
ModelPart addBox(float x, float y, float z, float a, float b, float c, float _d, boolean mirror){
|
|
||||||
this.mirror = mirror;
|
|
||||||
bx=x;
|
|
||||||
by=y;
|
|
||||||
bz=z;
|
|
||||||
ba=a;
|
|
||||||
bb=b;
|
|
||||||
bc=c;
|
|
||||||
hadBox = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString(){
|
|
||||||
String s = "";
|
|
||||||
String pName = parent==null?"modelPartData":parent.name;
|
|
||||||
if (scale!=1){
|
|
||||||
s += "CubeDeformation deformation_"+name+" = new CubeDeformation("+scale+"f);\n";
|
|
||||||
}
|
|
||||||
s += "PartDefinition " + name + " = ";
|
|
||||||
s += pName+".addOrReplaceChild(\""+name+"\", CubeListBuilder.create()\n";
|
|
||||||
if (this.mirror) s+= ".mirror()\n";
|
|
||||||
s+= ".texOffs("+u+", "+v+")";
|
|
||||||
if (this.hadBox) {
|
|
||||||
s+= "\n";
|
|
||||||
if (scale!=1)
|
|
||||||
s+= ".addBox("+bx+"f, "+by+"f, "+bz+"f, "+ba+"f, "+bb+"f, "+bc+"f, deformation_"+name+"),\n";
|
|
||||||
else
|
|
||||||
s+= ".addBox("+bx+"f, "+by+"f, "+bz+"f, "+ba+"f, "+bb+"f, "+bc+"f),\n";
|
|
||||||
} else {
|
|
||||||
s+= ",\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x==0 && y==0 && z==0 && rx==0 && ry==0 && rz==0){
|
|
||||||
s+= "PartPose.ZERO";
|
|
||||||
} else if (rx==0 && ry==0 && rz==0){
|
|
||||||
s+= "PartPose.offset("+x+"f, "+y+"f, "+z+"f)";
|
|
||||||
} else {
|
|
||||||
s+= "PartPose.offsetAndRotation("+x+"f, "+y+"f, "+z+"f, \n"+rx+"f, "+ry+"f, "+rz+"f)";
|
|
||||||
}
|
|
||||||
s +=");";
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void print(){
|
|
||||||
System.out.println("public static LayerDefinition getTexturedModelData() {");
|
|
||||||
System.out.println(" MeshDefinition modelData = new MeshDefinition();");
|
|
||||||
System.out.println(" PartDefinition modelPartData = modelData.getRoot();");
|
|
||||||
for(ModelPart p : parts){
|
|
||||||
System.out.println(p);
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
System.out.println("return LayerDefinition.create(modelData, "+wd+", "+hg+");");
|
|
||||||
System.out.println("}");
|
|
||||||
|
|
||||||
System.out.println();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
for(ModelPart p : parts){
|
|
||||||
String pName = p.parent==null?"modelPart":p.parent.name;
|
|
||||||
System.out.println(p.name +" = "+pName+".getChild(\""+p.name+"\");");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public class Convert {
|
|
||||||
public static void main(String[] args){
|
|
||||||
new Convert().c();
|
|
||||||
|
|
||||||
ModelPart.print();
|
|
||||||
}
|
|
||||||
void setRotationAngle(ModelPart p, float x, float y, float z){
|
|
||||||
p.setRotationAngle(x, y, z);
|
|
||||||
}
|
|
||||||
public void c (){
|
|
||||||
float scale = 1;
|
|
||||||
ModelPart partC = new ModelPart(64, 64, 0, 19, "partC");
|
|
||||||
partC.addBox(1.0F, 0.0F, 1.0F, 14.0F, 9.0F, 14.0F, 0.0F);
|
|
||||||
ModelPart partA = new ModelPart(64, 64, 0, 0,"partA");
|
|
||||||
partA.addBox(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F, 0.0F);
|
|
||||||
partA.y = 9.0F;
|
|
||||||
partA.z = 1.0F;
|
|
||||||
ModelPart partB = new ModelPart(64, 64, 0, 0, "partB");
|
|
||||||
partB.addBox(7.0F, -1.0F, 15.0F, 2.0F, 4.0F, 1.0F, 0.0F);
|
|
||||||
partB.y = 8.0F;
|
|
||||||
ModelPart partRightC = new ModelPart(64, 64, 0, 19, "partRightC");
|
|
||||||
partRightC.addBox(1.0F, 0.0F, 1.0F, 15.0F, 9.0F, 14.0F, 0.0F);
|
|
||||||
ModelPart partRightA = new ModelPart(64, 64, 0, 0, "partRightA");
|
|
||||||
partRightA.addBox(1.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F, 0.0F);
|
|
||||||
partRightA.y = 9.0F;
|
|
||||||
partRightA.z = 1.0F;
|
|
||||||
ModelPart partRightB = new ModelPart(64, 64, 0, 0, "partRightB");
|
|
||||||
partRightB.addBox(15.0F, -1.0F, 15.0F, 1.0F, 4.0F, 1.0F, 0.0F);
|
|
||||||
partRightB.y = 8.0F;
|
|
||||||
ModelPart partLeftC = new ModelPart(64, 64, 0, 19, "partLeftC");
|
|
||||||
partLeftC.addBox(0.0F, 0.0F, 1.0F, 15.0F, 9.0F, 14.0F, 0.0F);
|
|
||||||
ModelPart partLeftA = new ModelPart(64, 64, 0, 0, "partLeftA");
|
|
||||||
partLeftA.addBox(0.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F, 0.0F);
|
|
||||||
partLeftA.y = 9.0F;
|
|
||||||
partLeftA.z = 1.0F;
|
|
||||||
ModelPart partLeftB = new ModelPart(64, 64, 0, 0, "partLeftB");
|
|
||||||
partLeftB.addBox(0.0F, -1.0F, 15.0F, 1.0F, 4.0F, 1.0F, 0.0F);
|
|
||||||
partLeftB.y = 8.0F;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
[](https://jitpack.io/#paulevsGitch/BetterEnd)
|
[](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.16.4
|
||||||
|
|
||||||
Importing:
|
Importing:
|
||||||
* Clone repo
|
* Clone repo
|
||||||
|
@ -13,3 +13,5 @@ Building:
|
||||||
* 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
|
||||||
|
|
38
build.gradle
38
build.gradle
|
@ -7,12 +7,12 @@ buildscript {
|
||||||
plugins {
|
plugins {
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'fabric-loom' version '0.8-SNAPSHOT'
|
id 'fabric-loom' version '0.7-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_16
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_16
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
|
@ -20,6 +20,7 @@ group = project.maven_group
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://maven.dblsaiko.net/" }
|
maven { url "https://maven.dblsaiko.net/" }
|
||||||
|
maven { url "https://server.bbkr.space:8081/artifactory/libs-release/" }
|
||||||
maven { url "https://maven.fabricmc.net/" }
|
maven { url "https://maven.fabricmc.net/" }
|
||||||
maven { url 'https://maven.blamejared.com' }
|
maven { url 'https://maven.blamejared.com' }
|
||||||
maven { url "https://maven.shedaniel.me/" }
|
maven { url "https://maven.shedaniel.me/" }
|
||||||
|
@ -32,40 +33,37 @@ dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
useApi "vazkii.patchouli:Patchouli:1.17-${project.patchouli_version}"
|
useApi "vazkii.patchouli:Patchouli:1.16.4-${project.patchouli_version}"
|
||||||
useApi "com.github.paulevsGitch:BCLib:${project.bclib_version}"
|
useApi "com.github.paulevsGitch:BCLib:${project.bclib_version}"
|
||||||
|
|
||||||
useOptional "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
|
useOptional "me.shedaniel:RoughlyEnoughItems:${project.rei_version}"
|
||||||
useOptional "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}"
|
useOptional "me.shedaniel:RoughlyEnoughItems-api:${project.rei_version}"
|
||||||
//useOptional "grondag:canvas-mc116:${project.canvas_version}"
|
//useOptional "grondag:canvas-mc116:${project.canvas_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
def useOptional(String dep) {
|
def useOptional(String dep) {
|
||||||
dependencies.modRuntime (dep) {
|
dependencies.modRuntime (dep) {
|
||||||
exclude group: 'net.fabricmc.fabric-api'
|
exclude group: "net.fabricmc.fabric-api"
|
||||||
exclude group: 'net.fabricmc'
|
exclude group: "net.fabricmc"
|
||||||
if (!dep.contains("me.shedaniel")) {
|
if (!dep.contains("me.shedaniel")) {
|
||||||
exclude group: 'me.shedaniel.cloth'
|
exclude group: "me.shedaniel"
|
||||||
exclude group: 'me.shedaniel'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies.modCompileOnly (dep) {
|
dependencies.modCompileOnly (dep) {
|
||||||
exclude group: 'net.fabricmc.fabric-api'
|
exclude group: "net.fabricmc.fabric-api"
|
||||||
exclude group: 'net.fabricmc'
|
exclude group: "net.fabricmc"
|
||||||
if (!dep.contains("me.shedaniel")) {
|
if (!dep.contains("me.shedaniel")) {
|
||||||
exclude group: 'me.shedaniel.cloth'
|
exclude group: "me.shedaniel"
|
||||||
exclude group: 'me.shedaniel'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def useApi(String dep) {
|
def useApi(String dep) {
|
||||||
dependencies.modApi (dep) {
|
dependencies.modApi (dep) {
|
||||||
exclude group: 'net.fabricmc.fabric-api'
|
exclude group: "net.fabricmc.fabric-api"
|
||||||
exclude group: 'net.fabricmc'
|
exclude group: "net.fabricmc"
|
||||||
if (!dep.contains("me.shedaniel")) {
|
if (!dep.contains("me.shedaniel")) {
|
||||||
exclude group: 'me.shedaniel.cloth'
|
exclude group: "me.shedaniel"
|
||||||
exclude group: 'me.shedaniel'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,10 +76,6 @@ processResources {
|
||||||
include "fabric.mod.json"
|
include "fabric.mod.json"
|
||||||
expand "version": project.version
|
expand "version": project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude "fabric.mod.json"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
|
|
|
@ -3,19 +3,19 @@ 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.16.5
|
||||||
yarn_mappings= 6
|
yarn_mappings=6
|
||||||
loader_version= 0.11.6
|
loader_version=0.11.3
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.10.2-pre
|
mod_version = 0.9.8-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 = 50-FABRIC
|
||||||
fabric_version = 0.36.1+1.17
|
fabric_version = 0.32.9+1.16
|
||||||
bclib_version = 0.2.0
|
|
||||||
rei_version = 6.0.262-alpha
|
|
||||||
canvas_version = 1.0.+
|
canvas_version = 1.0.+
|
||||||
|
bclib_version = 0.1.38
|
||||||
|
rei_version = 5.8.10
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
# 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
|
|
|
@ -5,28 +5,24 @@ public interface BetterEndPlugin {
|
||||||
* Alloying recipes registration.
|
* Alloying recipes registration.
|
||||||
* See AlloyingRecipe.Builder for details.
|
* See AlloyingRecipe.Builder for details.
|
||||||
*/
|
*/
|
||||||
default void registerAlloyingRecipes() {
|
default void registerAlloyingRecipes() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smithing recipes registration.
|
* Smithing recipes registration.
|
||||||
* See AnvilSmithingRecipe.Builder for details.
|
* See AnvilSmithingRecipe.Builder for details.
|
||||||
*/
|
*/
|
||||||
default void registerSmithingRecipes() {
|
default void registerSmithingRecipes() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional biomes registration.
|
* Additional biomes registration.
|
||||||
* See BiomeRegistry.registerBiome for details.
|
* See BiomeRegistry.registerBiome for details.
|
||||||
*/
|
*/
|
||||||
default void registerEndBiomes() {
|
default void registerEndBiomes() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register other mod stuff, for example, EndHammers.
|
* Register other mod stuff, for example, EndHammers.
|
||||||
*/
|
*/
|
||||||
default void registerOthers() {
|
default void registerOthers() {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void register(BetterEndPlugin plugin) {
|
public static void register(BetterEndPlugin plugin) {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -17,10 +21,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndParticles;
|
import ru.betterend.registry.EndParticles;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class AncientEmeraldIceBlock extends BaseBlock {
|
public class AncientEmeraldIceBlock extends BaseBlock {
|
||||||
public AncientEmeraldIceBlock() {
|
public AncientEmeraldIceBlock() {
|
||||||
super(FabricBlockSettings.copyOf(Blocks.BLUE_ICE).randomTicks());
|
super(FabricBlockSettings.copyOf(Blocks.BLUE_ICE).randomTicks());
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
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.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
|
@ -17,15 +20,13 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import ru.bclib.api.TagAPI;
|
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IColorProvider;
|
import ru.bclib.interfaces.IColorProvider;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.bclib.util.ColorUtil;
|
import ru.bclib.util.ColorUtil;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
import ru.betterend.registry.EndTags;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyped, IColorProvider {
|
public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyped, IColorProvider {
|
||||||
public static final Vec3i[] COLORS;
|
public static final Vec3i[] COLORS;
|
||||||
|
@ -35,7 +36,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
|
||||||
public AuroraCrystalBlock() {
|
public AuroraCrystalBlock() {
|
||||||
super(FabricBlockSettings.of(Material.GLASS)
|
super(FabricBlockSettings.of(Material.GLASS)
|
||||||
.breakByTool(FabricToolTags.PICKAXES)
|
.breakByTool(FabricToolTags.PICKAXES)
|
||||||
.breakByTool(TagAPI.HAMMERS)
|
.breakByTool(EndTags.HAMMERS)
|
||||||
.hardness(1F)
|
.hardness(1F)
|
||||||
.resistance(1F)
|
.resistance(1F)
|
||||||
.luminance(15)
|
.luminance(15)
|
||||||
|
@ -49,8 +50,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
|
||||||
return (state, world, pos, tintIndex) -> {
|
return (state, world, pos, tintIndex) -> {
|
||||||
if (pos == null) {
|
if (pos == null) {
|
||||||
pos = BlockPos.ZERO;
|
pos = BlockPos.ZERO;
|
||||||
}
|
};
|
||||||
;
|
|
||||||
|
|
||||||
long i = (long) pos.getX() + (long) pos.getY() + (long) pos.getZ();
|
long i = (long) pos.getX() + (long) pos.getY() + (long) pos.getZ();
|
||||||
double delta = i * 0.1;
|
double delta = i * 0.1;
|
||||||
|
@ -99,8 +99,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
|
||||||
return Lists.newArrayList(new ItemStack(EndItems.CRYSTAL_SHARDS, max));
|
return Lists.newArrayList(new ItemStack(EndItems.CRYSTAL_SHARDS, max));
|
||||||
}
|
}
|
||||||
count = MHelper.randRange(min, max, MHelper.RANDOM);
|
count = MHelper.randRange(min, max, MHelper.RANDOM);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
count = MHelper.randRange(MIN_DROP, MAX_DROP, MHelper.RANDOM);
|
count = MHelper.randRange(MIN_DROP, MAX_DROP, MHelper.RANDOM);
|
||||||
}
|
}
|
||||||
return Lists.newArrayList(new ItemStack(EndItems.CRYSTAL_SHARDS, count));
|
return Lists.newArrayList(new ItemStack(EndItems.CRYSTAL_SHARDS, count));
|
||||||
|
@ -109,7 +108,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
COLORS = new Vec3i[]{
|
COLORS = new Vec3i[] {
|
||||||
new Vec3i(247, 77, 161),
|
new Vec3i(247, 77, 161),
|
||||||
new Vec3i(120, 184, 255),
|
new Vec3i(120, 184, 255),
|
||||||
new Vec3i(120, 255, 168),
|
new Vec3i(120, 255, 168),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -12,8 +14,6 @@ import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||||
import ru.betterend.blocks.basis.FurBlock;
|
import ru.betterend.blocks.basis.FurBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
|
public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
|
||||||
@Override
|
@Override
|
||||||
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
||||||
|
@ -32,7 +32,7 @@ public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
|
||||||
|
|
||||||
private void placeLantern(WorldGenLevel world, BlockPos pos) {
|
private void placeLantern(WorldGenLevel world, BlockPos pos) {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BLUE_VINE_LANTERN.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true));
|
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BLUE_VINE_LANTERN.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true));
|
||||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
for (Direction dir: BlocksHelper.HORIZONTAL) {
|
||||||
BlockPos p = pos.relative(dir);
|
BlockPos p = pos.relative(dir);
|
||||||
if (world.isEmptyBlock(p)) {
|
if (world.isEmptyBlock(p)) {
|
||||||
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.BLUE_VINE_FUR.defaultBlockState().setValue(FurBlock.FACING, dir));
|
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.BLUE_VINE_FUR.defaultBlockState().setValue(FurBlock.FACING, dir));
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
@ -14,9 +18,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BoluxMushroomBlock extends EndPlantBlock {
|
public class BoluxMushroomBlock extends EndPlantBlock {
|
||||||
private static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 9, 15);
|
private static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 9, 15);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -16,14 +20,11 @@ import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.blocks.BaseBlock;
|
import ru.bclib.blocks.BaseBlock;
|
||||||
import ru.bclib.blocks.BlockProperties;
|
import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BrimstoneBlock extends BaseBlock {
|
public class BrimstoneBlock extends BaseBlock {
|
||||||
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
|
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ public class BrimstoneBlock extends BaseBlock {
|
||||||
@Override
|
@Override
|
||||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||||
boolean deactivate = true;
|
boolean deactivate = true;
|
||||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||||
if (world.getFluidState(pos.relative(dir)).getType().equals(Fluids.WATER)) {
|
if (world.getFluidState(pos.relative(dir)).getType().equals(Fluids.WATER)) {
|
||||||
deactivate = false;
|
deactivate = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -17,8 +19,6 @@ import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import ru.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
import ru.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BubbleCoralBlock extends EndUnderwaterPlantBlock {
|
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);
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
@ -13,8 +16,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BulbVineBlock extends BaseVineBlock {
|
public class BulbVineBlock extends BaseVineBlock {
|
||||||
public BulbVineBlock() {
|
public BulbVineBlock() {
|
||||||
super(15, true);
|
super(15, true);
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
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.client.renderer.block.model.BlockModel;
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
|
@ -16,7 +20,6 @@ import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
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 org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.client.models.BlockModelProvider;
|
import ru.bclib.client.models.BlockModelProvider;
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
|
@ -24,9 +27,6 @@ import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.betterend.blocks.basis.EndLanternBlock;
|
import ru.betterend.blocks.basis.EndLanternBlock;
|
||||||
import ru.betterend.client.models.Patterns;
|
import ru.betterend.client.models.Patterns;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class BulbVineLanternBlock extends EndLanternBlock implements IRenderTyped, BlockModelProvider {
|
public class BulbVineLanternBlock extends EndLanternBlock implements IRenderTyped, BlockModelProvider {
|
||||||
private static final VoxelShape SHAPE_CEIL = Block.box(4, 4, 4, 12, 16, 12);
|
private static final VoxelShape SHAPE_CEIL = Block.box(4, 4, 4, 12, 16, 12);
|
||||||
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);
|
||||||
|
@ -57,7 +57,6 @@ public class BulbVineLanternBlock extends EndLanternBlock implements IRenderType
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||||
Map<String, String> textures = Maps.newHashMap();
|
Map<String, String> textures = Maps.newHashMap();
|
||||||
textures.put("%glow%", getGlowTexture());
|
textures.put("%glow%", getGlowTexture());
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
|
@ -12,8 +14,6 @@ import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BulbVineSeedBlock extends EndPlantWithAgeBlock {
|
public class BulbVineSeedBlock extends EndPlantWithAgeBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
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.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -19,9 +22,6 @@ import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
|
public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
|
||||||
public static final BooleanProperty SMALL = BlockProperties.SMALL;
|
public static final BooleanProperty SMALL = BlockProperties.SMALL;
|
||||||
private static final VoxelShape SHAPE_SMALL;
|
private static final VoxelShape SHAPE_SMALL;
|
||||||
|
@ -58,7 +58,7 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
|
||||||
VoxelShape top = Block.box(5, 15, 5, 11, 16, 11);
|
VoxelShape top = Block.box(5, 15, 5, 11, 16, 11);
|
||||||
SHAPE_BIG = Shapes.or(lantern, cap, top);
|
SHAPE_BIG = Shapes.or(lantern, cap, top);
|
||||||
|
|
||||||
lantern = Block.box(5, 7, 5, 11, 13, 11);
|
lantern = Block.box(1, 7, 1, 15, 13, 15);
|
||||||
cap = Block.box(4, 12, 4, 12, 15, 12);
|
cap = Block.box(4, 12, 4, 12, 15, 12);
|
||||||
top = Block.box(6, 15, 6, 10, 16, 10);
|
top = Block.box(6, 15, 6, 10, 16, 10);
|
||||||
SHAPE_SMALL = Shapes.or(lantern, cap, top);
|
SHAPE_SMALL = Shapes.or(lantern, cap, top);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
@ -16,8 +18,6 @@ import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
|
public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
|
||||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
|
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
|
||||||
|
|
||||||
|
@ -45,8 +45,7 @@ public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
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.client.renderer.block.model.BlockModel;
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
import net.minecraft.client.resources.model.BlockModelRotation;
|
import net.minecraft.client.resources.model.BlockModelRotation;
|
||||||
|
@ -16,7 +21,6 @@ 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.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.blocks.BaseAttachedBlock;
|
import ru.bclib.blocks.BaseAttachedBlock;
|
||||||
import ru.bclib.client.models.BlockModelProvider;
|
import ru.bclib.client.models.BlockModelProvider;
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
|
@ -24,10 +28,6 @@ import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.betterend.client.models.Patterns;
|
import ru.betterend.client.models.Patterns;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped, BlockModelProvider {
|
public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped, BlockModelProvider {
|
||||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||||
|
|
||||||
|
@ -46,13 +46,11 @@ public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public BlockModel getItemModel(ResourceLocation blockId) {
|
public BlockModel getItemModel(ResourceLocation blockId) {
|
||||||
return ModelsHelper.createItemModel(blockId);
|
return ModelsHelper.createItemModel(blockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||||
Optional<String> pattern;
|
Optional<String> pattern;
|
||||||
switch (blockState.getValue(FACING)) {
|
switch (blockState.getValue(FACING)) {
|
||||||
|
@ -69,7 +67,6 @@ public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@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 state = "_wall";
|
String state = "_wall";
|
||||||
BlockModelRotation rotation = BlockModelRotation.X0_Y0;
|
BlockModelRotation rotation = BlockModelRotation.X0_Y0;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||||
|
@ -12,9 +15,6 @@ import ru.bclib.blocks.BaseBlock;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DenseEmeraldIceBlock extends BaseBlock implements IRenderTyped {
|
public class DenseEmeraldIceBlock extends BaseBlock implements IRenderTyped {
|
||||||
public DenseEmeraldIceBlock() {
|
public DenseEmeraldIceBlock() {
|
||||||
super(FabricBlockSettings.copyOf(Blocks.PACKED_ICE));
|
super(FabricBlockSettings.copyOf(Blocks.PACKED_ICE));
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import java.util.Collections;
|
||||||
import net.fabricmc.api.Environment;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -20,15 +24,10 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.client.models.BlockModelProvider;
|
import ru.bclib.client.models.BlockModelProvider;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderTyped, BlockModelProvider {
|
public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderTyped, BlockModelProvider {
|
||||||
public EmeraldIceBlock() {
|
public EmeraldIceBlock() {
|
||||||
super(FabricBlockSettings.copyOf(Blocks.ICE));
|
super(FabricBlockSettings.copyOf(Blocks.ICE));
|
||||||
|
@ -86,7 +85,6 @@ public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderType
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public BlockModel getItemModel(ResourceLocation resourceLocation) {
|
public BlockModel getItemModel(ResourceLocation resourceLocation) {
|
||||||
return getBlockModel(resourceLocation, defaultBlockState());
|
return getBlockModel(resourceLocation, defaultBlockState());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -32,10 +37,6 @@ import ru.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EndLilyBlock extends EndUnderwaterPlantBlock {
|
public class EndLilyBlock extends EndUnderwaterPlantBlock {
|
||||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||||
private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 16, 12);
|
private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 16, 12);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
@ -10,8 +12,6 @@ import ru.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
|
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||||
@Override
|
@Override
|
||||||
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
|
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -18,8 +21,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class EndLotusFlowerBlock extends EndPlantBlock {
|
public class EndLotusFlowerBlock extends EndPlantBlock {
|
||||||
private static final VoxelShape SHAPE_OUTLINE = Block.box(2, 0, 2, 14, 14, 14);
|
private static final VoxelShape SHAPE_OUTLINE = Block.box(2, 0, 2, 14, 14, 14);
|
||||||
private static final VoxelShape SHAPE_COLLISION = Block.box(0, 0, 0, 16, 2, 16);
|
private static final VoxelShape SHAPE_COLLISION = Block.box(0, 0, 0, 16, 2, 16);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -12,8 +14,6 @@ import ru.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
|
public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||||
@Override
|
@Override
|
||||||
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
|
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
|
||||||
|
@ -92,10 +92,10 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||||
MutableBlockPos p = new MutableBlockPos();
|
MutableBlockPos p = new MutableBlockPos();
|
||||||
BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState();
|
BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState();
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, leaf.setValue(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM));
|
BlocksHelper.setWithoutUpdate(world, pos, leaf.setValue(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM));
|
||||||
for (Direction move : BlocksHelper.HORIZONTAL) {
|
for (Direction move: BlocksHelper.HORIZONTAL) {
|
||||||
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, move).setValue(EndLotusLeafBlock.SHAPE, TripleShape.MIDDLE));
|
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, move).setValue(EndLotusLeafBlock.SHAPE, TripleShape.MIDDLE));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i ++) {
|
||||||
Direction d1 = BlocksHelper.HORIZONTAL[i];
|
Direction d1 = BlocksHelper.HORIZONTAL[i];
|
||||||
Direction d2 = BlocksHelper.HORIZONTAL[(i + 1) & 3];
|
Direction d2 = BlocksHelper.HORIZONTAL[(i + 1) & 3];
|
||||||
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(d1).move(d2), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, d1).setValue(EndLotusLeafBlock.SHAPE, TripleShape.TOP));
|
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(d1).move(d2), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, d1).setValue(EndLotusLeafBlock.SHAPE, TripleShape.TOP));
|
||||||
|
@ -106,12 +106,12 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||||
MutableBlockPos p = new MutableBlockPos();
|
MutableBlockPos p = new MutableBlockPos();
|
||||||
p.setY(pos.getY());
|
p.setY(pos.getY());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = -1; x < 2; x++) {
|
for (int x = -1; x < 2; x ++) {
|
||||||
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;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
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.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -29,8 +32,6 @@ 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 java.util.Map;
|
|
||||||
|
|
||||||
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, IRenderTyped {
|
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, IRenderTyped {
|
||||||
public static final EnumProperty<Direction> FACING = BlockStateProperties.FACING;
|
public static final EnumProperty<Direction> FACING = BlockStateProperties.FACING;
|
||||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.blocks.basis.PedestalBlock;
|
import ru.betterend.blocks.basis.PedestalBlock;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class EndPedestal extends PedestalBlock {
|
public class EndPedestal extends PedestalBlock {
|
||||||
|
|
||||||
public EndPedestal(Block parent) {
|
public EndPedestal(Block parent) {
|
||||||
|
@ -21,9 +21,8 @@ public class EndPedestal extends PedestalBlock {
|
||||||
String name = blockId.getPath();
|
String name = blockId.getPath();
|
||||||
return new HashMap<String, String>() {
|
return new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
{
|
{
|
||||||
put("%mod%", BetterEnd.MOD_ID);
|
put("%mod%", BetterEnd.MOD_ID );
|
||||||
put("%top%", name + "_polished");
|
put("%top%", name + "_polished");
|
||||||
put("%base%", name + "_polished");
|
put("%base%", name + "_polished");
|
||||||
put("%pillar%", name + "_pillar_side");
|
put("%pillar%", name + "_pillar_side");
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -36,10 +40,6 @@ import ru.betterend.registry.EndParticles;
|
||||||
import ru.betterend.registry.EndPortals;
|
import ru.betterend.registry.EndPortals;
|
||||||
import ru.betterend.rituals.EternalRitual;
|
import ru.betterend.rituals.EternalRitual;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, IColorProvider {
|
public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, IColorProvider {
|
||||||
public static final IntegerProperty PORTAL = EndBlockProperties.PORTAL;
|
public static final IntegerProperty PORTAL = EndBlockProperties.PORTAL;
|
||||||
|
|
||||||
|
@ -66,8 +66,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
||||||
int k = random.nextInt(2) * 2 - 1;
|
int k = random.nextInt(2) * 2 - 1;
|
||||||
if (!world.getBlockState(pos.west()).is(this) && !world.getBlockState(pos.east()).is(this)) {
|
if (!world.getBlockState(pos.west()).is(this) && !world.getBlockState(pos.east()).is(this)) {
|
||||||
x = pos.getX() + 0.5D + 0.25D * k;
|
x = pos.getX() + 0.5D + 0.25D * k;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
z = pos.getZ() + 0.5D + 0.25D * k;
|
z = pos.getZ() + 0.5D + 0.25D * k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +74,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
|
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
|
||||||
|
@ -96,9 +94,8 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
||||||
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.yRot, entity.xRot);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
((TeleportingEntity) entity).be_setExitPos(exitPos);
|
((TeleportingEntity) entity).be_setExitPos(exitPos);
|
||||||
Optional<Entity> teleported = Optional.ofNullable(entity.changeDimension(destination));
|
Optional<Entity> teleported = Optional.ofNullable(entity.changeDimension(destination));
|
||||||
teleported.ifPresent(Entity::setPortalCooldown);
|
teleported.ifPresent(Entity::setPortalCooldown);
|
||||||
|
@ -117,7 +114,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
||||||
|
|
||||||
private BlockPos findExitPos(ServerLevel currentWorld, ServerLevel targetWorld, BlockPos currentPos, Entity entity) {
|
private BlockPos findExitPos(ServerLevel currentWorld, ServerLevel targetWorld, BlockPos currentPos, Entity entity) {
|
||||||
if (targetWorld == null) return null;
|
if (targetWorld == null) return null;
|
||||||
Registry<DimensionType> registry = targetWorld.registryAccess().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
|
Registry<DimensionType> registry = targetWorld.registryAccess().dimensionTypes();
|
||||||
ResourceLocation targetWorldId = targetWorld.dimension().location();
|
ResourceLocation targetWorldId = targetWorld.dimension().location();
|
||||||
ResourceLocation currentWorldId = currentWorld.dimension().location();
|
ResourceLocation currentWorldId = currentWorld.dimension().location();
|
||||||
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();
|
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();
|
||||||
|
@ -162,14 +159,11 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
||||||
BlockState down = world.getBlockState(pos.below());
|
BlockState down = world.getBlockState(pos.below());
|
||||||
if (down.is(this)) {
|
if (down.is(this)) {
|
||||||
return findCenter(world, pos.move(Direction.DOWN), axis, step);
|
return findCenter(world, pos.move(Direction.DOWN), axis, step);
|
||||||
}
|
} else if (right.is(this) && left.is(this)) {
|
||||||
else if (right.is(this) && left.is(this)) {
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
} else if (right.is(this)) {
|
||||||
else if (right.is(this)) {
|
|
||||||
return findCenter(world, pos.move(rightDir), axis, ++step);
|
return findCenter(world, pos.move(rightDir), axis, ++step);
|
||||||
}
|
} else if (left.is(this)) {
|
||||||
else if (left.is(this)) {
|
|
||||||
return findCenter(world, pos.move(leftDir), axis, ++step);
|
return findCenter(world, pos.move(leftDir), axis, ++step);
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -15,6 +19,7 @@ import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||||
|
@ -23,8 +28,6 @@ import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.Rotation;
|
import net.minecraft.world.level.block.Rotation;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
|
@ -35,13 +38,8 @@ import net.minecraft.world.level.material.MaterialColor;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.blocks.BaseBlockWithEntity;
|
import ru.bclib.blocks.BaseBlockWithEntity;
|
||||||
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
|
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
|
||||||
import ru.betterend.registry.EndBlockEntities;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class EndStoneSmelter extends BaseBlockWithEntity {
|
public class EndStoneSmelter extends BaseBlockWithEntity {
|
||||||
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
||||||
|
@ -50,19 +48,19 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
|
||||||
|
|
||||||
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)
|
.hardness(4F)
|
||||||
.resistance(100F)
|
.resistance(100F)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.sound(SoundType.STONE));
|
.sound(SoundType.STONE));
|
||||||
registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false));
|
this.registerDefaultState(this.stateDefinition.any()
|
||||||
|
.setValue(FACING, Direction.NORTH)
|
||||||
|
.setValue(LIT, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||||
if (world.isClientSide) {
|
if (world.isClientSide) {
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.openScreen(world, pos, player);
|
this.openScreen(world, pos, player);
|
||||||
return InteractionResult.CONSUME;
|
return InteractionResult.CONSUME;
|
||||||
}
|
}
|
||||||
|
@ -77,12 +75,12 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||||
return defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite());
|
return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||||
return new EndStoneSmelterBlockEntity(blockPos, blockState);
|
return new EndStoneSmelterBlockEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,11 +149,4 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
|
||||||
world.addParticle(ParticleTypes.SMOKE, x + offX, y + offY, z + offZ, 0.0D, 0.0D, 0.0D);
|
world.addParticle(ParticleTypes.SMOKE, x + offX, y + offY, z + offZ, 0.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
|
|
||||||
return level.isClientSide() ? null : createTickerHelper(blockEntityType, EndBlockEntities.END_STONE_SMELTER, EndStoneSmelterBlockEntity::tick);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -13,9 +16,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import ru.bclib.util.ColorUtil;
|
import ru.bclib.util.ColorUtil;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class EndstoneDustBlock extends FallingBlock {
|
public class EndstoneDustBlock extends FallingBlock {
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
private static final int COLOR = ColorUtil.color(226, 239, 168);
|
private static final int COLOR = ColorUtil.color(226, 239, 168);
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
|
@ -25,8 +28,6 @@ import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndPortals;
|
import ru.betterend.registry.EndPortals;
|
||||||
import ru.betterend.rituals.EternalRitual;
|
import ru.betterend.rituals.EternalRitual;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class EternalPedestal extends PedestalBlock {
|
public class EternalPedestal extends PedestalBlock {
|
||||||
public static final BooleanProperty ACTIVATED = EndBlockProperties.ACTIVE;
|
public static final BooleanProperty ACTIVATED = EndBlockProperties.ACTIVE;
|
||||||
|
|
||||||
|
@ -49,24 +50,21 @@ public class EternalPedestal extends PedestalBlock {
|
||||||
int portalId;
|
int portalId;
|
||||||
if (targetWorld != null) {
|
if (targetWorld != null) {
|
||||||
portalId = EndPortals.getPortalIdByWorld(targetWorld);
|
portalId = EndPortals.getPortalIdByWorld(targetWorld);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
portalId = EndPortals.getPortalIdByWorld(EndPortals.OVERWORLD_ID);
|
portalId = EndPortals.getPortalIdByWorld(EndPortals.OVERWORLD_ID);
|
||||||
}
|
}
|
||||||
ritual.disablePortal(portalId);
|
ritual.disablePortal(portalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, false).setValue(HAS_LIGHT, false));
|
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, false).setValue(HAS_LIGHT, false));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ItemStack itemStack = pedestal.getItem(0);
|
ItemStack itemStack = pedestal.getItem(0);
|
||||||
ResourceLocation id = Registry.ITEM.getKey(itemStack.getItem());
|
ResourceLocation id = Registry.ITEM.getKey(itemStack.getItem());
|
||||||
if (EndPortals.isAvailableItem(id)) {
|
if (EndPortals.isAvailableItem(id)) {
|
||||||
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, true).setValue(HAS_LIGHT, true));
|
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, true).setValue(HAS_LIGHT, true));
|
||||||
if (pedestal.hasRitual()) {
|
if (pedestal.hasRitual()) {
|
||||||
pedestal.getRitual().checkStructure();
|
pedestal.getRitual().checkStructure();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
EternalRitual ritual = new EternalRitual(world, pos);
|
EternalRitual ritual = new EternalRitual(world, pos);
|
||||||
ritual.checkStructure();
|
ritual.checkStructure();
|
||||||
}
|
}
|
||||||
|
@ -128,8 +126,8 @@ public class EternalPedestal extends PedestalBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||||
return new EternalPedestalEntity(blockPos, blockState);
|
return new EternalPedestalEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -16,8 +19,6 @@ 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 java.util.EnumMap;
|
|
||||||
|
|
||||||
public class FilaluxWingsBlock extends BaseAttachedBlock implements IRenderTyped {
|
public class FilaluxWingsBlock extends BaseAttachedBlock implements IRenderTyped {
|
||||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -15,10 +18,8 @@ import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
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.interfaces.ISpetialItem;
|
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
|
import ru.betterend.interfaces.ISpetialItem;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
|
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);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -18,8 +20,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
|
public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
|
||||||
|
|
||||||
public GlowingPillarSeedBlock() {
|
public GlowingPillarSeedBlock() {
|
||||||
|
@ -44,15 +44,14 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
|
||||||
BlockState roots = EndBlocks.GLOWING_PILLAR_ROOTS.defaultBlockState();
|
BlockState roots = EndBlocks.GLOWING_PILLAR_ROOTS.defaultBlockState();
|
||||||
if (height < 2) {
|
if (height < 2) {
|
||||||
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
|
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
|
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
|
||||||
mut.move(Direction.UP);
|
mut.move(Direction.UP);
|
||||||
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
|
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
|
||||||
}
|
}
|
||||||
mut.move(Direction.UP);
|
mut.move(Direction.UP);
|
||||||
BlocksHelper.setWithUpdate(world, mut, EndBlocks.GLOWING_PILLAR_LUMINOPHOR.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true));
|
BlocksHelper.setWithUpdate(world, mut, EndBlocks.GLOWING_PILLAR_LUMINOPHOR.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true));
|
||||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||||
pos = mut.relative(dir);
|
pos = mut.relative(dir);
|
||||||
if (world.isEmptyBlock(pos)) {
|
if (world.isEmptyBlock(pos)) {
|
||||||
BlocksHelper.setWithUpdate(world, pos, EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().setValue(BlockStateProperties.FACING, dir));
|
BlocksHelper.setWithUpdate(world, pos, EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().setValue(BlockStateProperties.FACING, dir));
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
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.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
|
@ -26,9 +30,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
|
public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
|
||||||
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
||||||
|
@ -78,7 +79,7 @@ public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
if (tool.is(FabricToolTags.SHEARS) || tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
if (tool.getItem().is(FabricToolTags.SHEARS) || tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||||
return Collections.singletonList(new ItemStack(this));
|
return Collections.singletonList(new ItemStack(this));
|
||||||
}
|
}
|
||||||
int fortune = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, tool);
|
int fortune = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, tool);
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -24,10 +29,6 @@ import ru.betterend.blocks.EndBlockProperties.HydraluxShape;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class HydraluxBlock extends UnderwaterPlantBlock {
|
public class HydraluxBlock extends UnderwaterPlantBlock {
|
||||||
|
|
||||||
public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE;
|
public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
import ru.bclib.blocks.BaseBlock;
|
import ru.bclib.blocks.BaseBlock;
|
||||||
|
@ -27,6 +26,5 @@ public class HydraluxPetalBlock extends BaseBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fallOn(Level level, BlockState blockState, BlockPos blockPos, Entity entity, float f) {
|
public void fallOn(Level world, BlockPos pos, Entity entity, float distance) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import java.util.Optional;
|
||||||
import net.fabricmc.api.Environment;
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
import net.minecraft.client.color.item.ItemColor;
|
import net.minecraft.client.color.item.ItemColor;
|
||||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
import ru.bclib.interfaces.IColorProvider;
|
import ru.bclib.interfaces.IColorProvider;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.client.models.Patterns;
|
import ru.betterend.client.models.Patterns;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class HydraluxPetalColoredBlock extends HydraluxPetalBlock implements IColorProvider {
|
public class HydraluxPetalColoredBlock extends HydraluxPetalBlock implements IColorProvider {
|
||||||
public HydraluxPetalColoredBlock(FabricBlockSettings settings) {
|
public HydraluxPetalColoredBlock(FabricBlockSettings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
@ -32,7 +31,6 @@ public class HydraluxPetalColoredBlock extends HydraluxPetalBlock implements ICo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||||
String path = "betterend:block/block_petal_colored";
|
String path = "betterend:block/block_petal_colored";
|
||||||
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_PETAL_COLORED, path, path);
|
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_PETAL_COLORED, path, path);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
|
@ -11,8 +13,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.EndBlockProperties.HydraluxShape;
|
import ru.betterend.blocks.EndBlockProperties.HydraluxShape;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock {
|
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -22,8 +26,6 @@ import net.minecraft.world.level.block.LiquidBlockContainer;
|
||||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
|
@ -34,7 +36,6 @@ import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
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 org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.blocks.BaseBlockNotFull;
|
import ru.bclib.blocks.BaseBlockNotFull;
|
||||||
import ru.bclib.blocks.BlockProperties;
|
import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
|
@ -42,8 +43,6 @@ import ru.betterend.blocks.entities.BlockEntityHydrothermalVent;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndParticles;
|
import ru.betterend.registry.EndParticles;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlock, LiquidBlockContainer, SimpleWaterloggedBlock {
|
public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlock, LiquidBlockContainer, SimpleWaterloggedBlock {
|
||||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||||
|
@ -109,8 +108,8 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||||
return new BlockEntityHydrothermalVent(pos, state);
|
return new BlockEntityHydrothermalVent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,24 +124,23 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
|
||||||
@Override
|
@Override
|
||||||
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
||||||
if (world instanceof ServerLevel && state.getValue(WATERLOGGED) && world.getBlockState(pos.above()).is(Blocks.WATER)) {
|
if (world instanceof ServerLevel && state.getValue(WATERLOGGED) && world.getBlockState(pos.above()).is(Blocks.WATER)) {
|
||||||
tick(state, (ServerLevel) world, pos, world.random);
|
tick(state,(ServerLevel) world, pos, world.random);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
|
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
|
||||||
super.animateTick(state, world, pos, random);
|
|
||||||
if (!state.getValue(ACTIVATED) && random.nextBoolean()) {
|
if (!state.getValue(ACTIVATED) && random.nextBoolean()) {
|
||||||
|
super.animateTick(state, world, pos, random);
|
||||||
double x = pos.getX() + random.nextDouble();
|
double x = pos.getX() + random.nextDouble();
|
||||||
double y = pos.getY() + 0.9 + random.nextDouble() * 0.3;
|
double y = pos.getY() + 0.9 + random.nextDouble() * 0.3;
|
||||||
double z = pos.getZ() + random.nextDouble();
|
double z = pos.getZ() + random.nextDouble();
|
||||||
world.addParticle(ParticleTypes.LARGE_SMOKE, x, y, z, 0, 0, 0);
|
if (state.getValue(WATERLOGGED)) {
|
||||||
|
world.addParticle(EndParticles.GEYSER_PARTICLE, x, y, z, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
world.addParticle(ParticleTypes.SMOKE, x, y, z, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
|
|
||||||
return BlockEntityHydrothermalVent::tick;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,12 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
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.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
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")
|
||||||
|
@ -39,8 +35,7 @@ public class InfusionPedestal extends PedestalBlock {
|
||||||
ritual.configure();
|
ritual.configure();
|
||||||
}
|
}
|
||||||
pedestal.getRitual().checkRecipe();
|
pedestal.getRitual().checkRecipe();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
InfusionRitual ritual = new InfusionRitual(pedestal, world, pos);
|
InfusionRitual ritual = new InfusionRitual(pedestal, world, pos);
|
||||||
pedestal.linkRitual(ritual);
|
pedestal.linkRitual(ritual);
|
||||||
ritual.checkRecipe();
|
ritual.checkRecipe();
|
||||||
|
@ -49,8 +44,8 @@ public class InfusionPedestal extends PedestalBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||||
return new InfusionPedestalEntity(blockPos, blockState);
|
return new InfusionPedestalEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,7 +57,7 @@ public class InfusionPedestal extends PedestalBlock {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||||
if (state.is(this)) {
|
if (state.is(this)) {
|
||||||
switch (state.getValue(STATE)) {
|
switch(state.getValue(STATE)) {
|
||||||
case PEDESTAL_TOP: {
|
case PEDESTAL_TOP: {
|
||||||
return SHAPE_PEDESTAL_TOP;
|
return SHAPE_PEDESTAL_TOP;
|
||||||
}
|
}
|
||||||
|
@ -77,12 +72,6 @@ public class InfusionPedestal extends PedestalBlock {
|
||||||
return super.getShape(state, world, pos, context);
|
return super.getShape(state, world, pos, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
|
|
||||||
return InfusionPedestalEntity::tickEnity;
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
VoxelShape basinUp = Block.box(2, 3, 2, 14, 4, 14);
|
VoxelShape basinUp = Block.box(2, 3, 2, 14, 4, 14);
|
||||||
VoxelShape basinDown = Block.box(0, 0, 0, 16, 3, 16);
|
VoxelShape basinDown = Block.box(0, 0, 0, 16, 3, 16);
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
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.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
import net.minecraft.client.color.item.ItemColor;
|
import net.minecraft.client.color.item.ItemColor;
|
||||||
|
@ -19,7 +23,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.client.models.BlockModelProvider;
|
import ru.bclib.client.models.BlockModelProvider;
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
|
@ -30,9 +33,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.client.models.Patterns;
|
import ru.betterend.client.models.Patterns;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class JellyshroomCapBlock extends SlimeBlock implements IRenderTyped, BlockModelProvider, IColorProvider {
|
public class JellyshroomCapBlock extends SlimeBlock implements IRenderTyped, BlockModelProvider, IColorProvider {
|
||||||
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
||||||
|
@ -71,13 +71,11 @@ public class JellyshroomCapBlock extends SlimeBlock implements IRenderTyped, Blo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public BlockModel getItemModel(ResourceLocation resourceLocation) {
|
public BlockModel getItemModel(ResourceLocation resourceLocation) {
|
||||||
return getBlockModel(resourceLocation, defaultBlockState());
|
return getBlockModel(resourceLocation, defaultBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||||
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_COLORED, "jellyshroom_cap");
|
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_COLORED, "jellyshroom_cap");
|
||||||
return ModelsHelper.fromPattern(pattern);
|
return ModelsHelper.fromPattern(pattern);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -18,9 +21,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class LanceleafBlock extends EndPlantBlock {
|
public class LanceleafBlock extends EndPlantBlock {
|
||||||
|
|
||||||
public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE;
|
public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -13,8 +15,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
|
public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
|
||||||
@Override
|
@Override
|
||||||
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -20,8 +22,6 @@ import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class LargeAmaranitaBlock extends EndPlantBlock {
|
public class LargeAmaranitaBlock extends EndPlantBlock {
|
||||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||||
private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 14, 12);
|
private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 14, 12);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -28,9 +31,6 @@ import ru.betterend.blocks.EndBlockProperties.LumecornShape;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class LumecornBlock extends BaseBlockNotFull implements IRenderTyped {
|
public class LumecornBlock extends BaseBlockNotFull implements IRenderTyped {
|
||||||
public static final EnumProperty<LumecornShape> SHAPE = EnumProperty.create("shape", LumecornShape.class);
|
public static final EnumProperty<LumecornShape> SHAPE = EnumProperty.create("shape", LumecornShape.class);
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
|
||||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class LumecornSeedBlock extends EndPlantWithAgeBlock {
|
public class LumecornSeedBlock extends EndPlantWithAgeBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
|
||||||
EndFeatures.LUMECORN.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null));
|
EndFeatures.LUMECORN.getFeature().place(world, null, random, pos, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Queue;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
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.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -14,14 +17,13 @@ import net.minecraft.world.level.block.LiquidBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
|
import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import ru.bclib.blocks.BaseBlockNotFull;
|
import ru.bclib.blocks.BaseBlockNotFull;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Queue;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped {
|
public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped {
|
||||||
public MengerSpongeBlock() {
|
public MengerSpongeBlock() {
|
||||||
|
@ -59,21 +61,19 @@ public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped
|
||||||
FluidState fluidState = world.getFluidState(blockPos2);
|
FluidState fluidState = world.getFluidState(blockPos2);
|
||||||
Material material = blockState.getMaterial();
|
Material material = blockState.getMaterial();
|
||||||
if (fluidState.is(FluidTags.WATER)) {
|
if (fluidState.is(FluidTags.WATER)) {
|
||||||
if (blockState.getBlock() instanceof BucketPickup && !((BucketPickup) blockState.getBlock()).pickupBlock(world, blockPos2, blockState).isEmpty()) {
|
if (blockState.getBlock() instanceof BucketPickup && ((BucketPickup) blockState.getBlock()).takeLiquid(world, blockPos2, blockState) != Fluids.EMPTY) {
|
||||||
++i;
|
++i;
|
||||||
if (j < 6) {
|
if (j < 6) {
|
||||||
queue.add(new Tuple<>(blockPos2, j + 1));
|
queue.add(new Tuple<>(blockPos2, j + 1));
|
||||||
}
|
}
|
||||||
}
|
} else if (blockState.getBlock() instanceof LiquidBlock) {
|
||||||
else if (blockState.getBlock() instanceof LiquidBlock) {
|
|
||||||
world.setBlock(blockPos2, Blocks.AIR.defaultBlockState(), 3);
|
world.setBlock(blockPos2, Blocks.AIR.defaultBlockState(), 3);
|
||||||
++i;
|
++i;
|
||||||
if (j < 6) {
|
if (j < 6) {
|
||||||
queue.add(new Tuple<>(blockPos2, j + 1));
|
queue.add(new Tuple<>(blockPos2, j + 1));
|
||||||
}
|
}
|
||||||
}
|
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||||
else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
BlockEntity blockEntity = blockState.getBlock().isEntityBlock() ? world.getBlockEntity(blockPos2) : null;
|
||||||
BlockEntity blockEntity = blockState.hasBlockEntity() ? world.getBlockEntity(blockPos2) : null;
|
|
||||||
dropResources(blockState, world, blockPos2, blockEntity);
|
dropResources(blockState, world, blockPos2, blockEntity);
|
||||||
world.setBlock(blockPos2, Blocks.AIR.defaultBlockState(), 3);
|
world.setBlock(blockPos2, Blocks.AIR.defaultBlockState(), 3);
|
||||||
++i;
|
++i;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -23,8 +25,6 @@ import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyped {
|
public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyped {
|
||||||
public MengerSpongeWetBlock() {
|
public MengerSpongeWetBlock() {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -17,10 +21,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import ru.bclib.blocks.BaseRotatedPillarBlock;
|
import ru.bclib.blocks.BaseRotatedPillarBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class MossyDragonBoneBlock extends BaseRotatedPillarBlock {
|
public class MossyDragonBoneBlock extends BaseRotatedPillarBlock {
|
||||||
public MossyDragonBoneBlock() {
|
public MossyDragonBoneBlock() {
|
||||||
|
@ -49,11 +49,9 @@ public class MossyDragonBoneBlock extends BaseRotatedPillarBlock {
|
||||||
BlockState blockState = worldView.getBlockState(blockPos);
|
BlockState blockState = worldView.getBlockState(blockPos);
|
||||||
if (blockState.is(Blocks.SNOW) && blockState.getValue(SnowLayerBlock.LAYERS) == 1) {
|
if (blockState.is(Blocks.SNOW) && blockState.getValue(SnowLayerBlock.LAYERS) == 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (blockState.getFluidState().getAmount() == 8) {
|
||||||
else if (blockState.getFluidState().getAmount() == 8) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int i = LayerLightEngine.getLightBlockInto(worldView, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(worldView, blockPos));
|
int i = LayerLightEngine.getLightBlockInto(worldView, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(worldView, blockPos));
|
||||||
return i < 5;
|
return i < 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
@ -16,10 +20,6 @@ import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import ru.bclib.blocks.BaseBlock;
|
import ru.bclib.blocks.BaseBlock;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class MossyObsidian extends BaseBlock {
|
public class MossyObsidian extends BaseBlock {
|
||||||
public MossyObsidian() {
|
public MossyObsidian() {
|
||||||
super(FabricBlockSettings.copyOf(Blocks.OBSIDIAN).hardness(3).randomTicks());
|
super(FabricBlockSettings.copyOf(Blocks.OBSIDIAN).hardness(3).randomTicks());
|
||||||
|
@ -44,13 +44,11 @@ public class MossyObsidian extends BaseBlock {
|
||||||
public boolean canSurvive(BlockState state, LevelReader worldView, BlockPos pos) {
|
public boolean canSurvive(BlockState state, LevelReader worldView, BlockPos pos) {
|
||||||
BlockPos blockPos = pos.above();
|
BlockPos blockPos = pos.above();
|
||||||
BlockState blockState = worldView.getBlockState(blockPos);
|
BlockState blockState = worldView.getBlockState(blockPos);
|
||||||
if (blockState.is(Blocks.SNOW) && (Integer) blockState.getValue(SnowLayerBlock.LAYERS) == 1) {
|
if (blockState.is(Blocks.SNOW) && (Integer)blockState.getValue(SnowLayerBlock.LAYERS) == 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (blockState.getFluidState().getAmount() == 8) {
|
||||||
else if (blockState.getFluidState().getAmount() == 8) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int i = LayerLightEngine.getLightBlockInto(worldView, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(worldView, blockPos));
|
int i = LayerLightEngine.getLightBlockInto(worldView, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(worldView, blockPos));
|
||||||
return i < 5;
|
return i < 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -15,8 +17,6 @@ import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class MurkweedBlock extends EndPlantBlock {
|
public class MurkweedBlock extends EndPlantBlock {
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
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;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
|
@ -20,8 +23,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class NeedlegrassBlock extends EndPlantBlock {
|
public class NeedlegrassBlock extends EndPlantBlock {
|
||||||
@Override
|
@Override
|
||||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||||
|
@ -33,7 +34,7 @@ public class NeedlegrassBlock extends EndPlantBlock {
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||||
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||||
return Lists.newArrayList(new ItemStack(this));
|
return Lists.newArrayList(new ItemStack(this));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -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.betterend.blocks.basis.LitPillarBlock;
|
import ru.bclib.blocks.BaseRotatedPillarBlock;
|
||||||
|
|
||||||
public class NeonCactusBlock extends LitPillarBlock {
|
public class NeonCactusBlock extends BaseRotatedPillarBlock {
|
||||||
public NeonCactusBlock() {
|
public NeonCactusBlock() {
|
||||||
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15));
|
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.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;
|
||||||
|
@ -43,10 +48,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.blocks.EndBlockProperties.CactusBottom;
|
import ru.betterend.blocks.EndBlockProperties.CactusBottom;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, IRenderTyped {
|
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, IRenderTyped {
|
||||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||||
|
@ -272,7 +273,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
|
||||||
while (iterState.is(this) && startDir.getAxis().isVertical()) {
|
while (iterState.is(this) && startDir.getAxis().isVertical()) {
|
||||||
startDir = iterState.getValue(FACING);
|
startDir = iterState.getValue(FACING);
|
||||||
if (lastDir == null) {
|
if (lastDir == null) {
|
||||||
for (Direction side : BlocksHelper.HORIZONTAL) {
|
for (Direction side: BlocksHelper.HORIZONTAL) {
|
||||||
BlockState sideState = world.getBlockState(iterPos.relative(side));
|
BlockState sideState = world.getBlockState(iterPos.relative(side));
|
||||||
if (sideState.is(this)) {
|
if (sideState.is(this)) {
|
||||||
Direction sideDir = sideState.getValue(FACING);
|
Direction sideDir = sideState.getValue(FACING);
|
||||||
|
@ -318,7 +319,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dir = state.getValue(FACING).getOpposite();
|
dir = state.getValue(FACING).getOpposite();
|
||||||
length++;
|
length ++;
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +338,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
|
||||||
if (dir.getStepY() != 0) {
|
if (dir.getStepY() != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
count++;
|
count ++;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import ru.betterend.blocks.basis.PedestalBlock;
|
import ru.betterend.blocks.basis.PedestalBlock;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class PedestalVanilla extends PedestalBlock {
|
public class PedestalVanilla extends PedestalBlock {
|
||||||
|
|
||||||
public PedestalVanilla(Block parent) {
|
public PedestalVanilla(Block parent) {
|
||||||
|
@ -20,9 +20,8 @@ public class PedestalVanilla extends PedestalBlock {
|
||||||
String name = blockId.getPath().replace("_block", "");
|
String name = blockId.getPath().replace("_block", "");
|
||||||
return new HashMap<String, String>() {
|
return new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
{
|
{
|
||||||
put("%mod%", blockId.getNamespace());
|
put("%mod%", blockId.getNamespace() );
|
||||||
put("%top%", "polished_" + name);
|
put("%top%", "polished_" + name);
|
||||||
put("%base%", "polished_" + name);
|
put("%base%", "polished_" + name);
|
||||||
put("%pillar%", name + "_pillar");
|
put("%pillar%", name + "_pillar");
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -17,8 +19,6 @@ import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import ru.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
import ru.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class PondAnemoneBlock extends EndUnderwaterPlantBlock {
|
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);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
import net.minecraft.client.color.item.ItemColor;
|
import net.minecraft.client.color.item.ItemColor;
|
||||||
|
@ -30,7 +35,6 @@ import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
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 org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.blocks.BaseBlock;
|
import ru.bclib.blocks.BaseBlock;
|
||||||
import ru.bclib.blocks.BlockProperties;
|
import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||||
|
@ -43,8 +47,6 @@ import ru.betterend.particle.InfusionParticleType;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RespawnObeliskBlock extends BaseBlock implements IColorProvider, IRenderTyped {
|
public class RespawnObeliskBlock extends BaseBlock implements IColorProvider, IRenderTyped {
|
||||||
private static final VoxelShape VOXEL_SHAPE_BOTTOM = Block.box(1, 0, 1, 15, 16, 15);
|
private static final VoxelShape VOXEL_SHAPE_BOTTOM = Block.box(1, 0, 1, 15, 16, 15);
|
||||||
private static final VoxelShape VOXEL_SHAPE_MIDDLE_TOP = Block.box(2, 0, 2, 14, 16, 14);
|
private static final VoxelShape VOXEL_SHAPE_MIDDLE_TOP = Block.box(2, 0, 2, 14, 16, 14);
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
|
@ -15,8 +18,6 @@ import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RunedFlavolite extends BaseBlock {
|
public class RunedFlavolite extends BaseBlock {
|
||||||
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
|
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -9,8 +11,6 @@ import net.minecraft.world.level.material.MaterialColor;
|
||||||
import ru.betterend.blocks.basis.EndTerrainBlock;
|
import ru.betterend.blocks.basis.EndTerrainBlock;
|
||||||
import ru.betterend.registry.EndParticles;
|
import ru.betterend.registry.EndParticles;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class ShadowGrassBlock extends EndTerrainBlock {
|
public class ShadowGrassBlock extends EndTerrainBlock {
|
||||||
public ShadowGrassBlock() {
|
public ShadowGrassBlock() {
|
||||||
super(MaterialColor.COLOR_BLACK);
|
super(MaterialColor.COLOR_BLACK);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -34,8 +36,6 @@ import ru.betterend.entity.SilkMothEntity;
|
||||||
import ru.betterend.registry.EndEntities;
|
import ru.betterend.registry.EndEntities;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SilkMothHiveBlock extends BaseBlock {
|
public class SilkMothHiveBlock extends BaseBlock {
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||||
public static final IntegerProperty FULLNESS = EndBlockProperties.FULLNESS;
|
public static final IntegerProperty FULLNESS = EndBlockProperties.FULLNESS;
|
||||||
|
@ -73,9 +73,7 @@ public class SilkMothHiveBlock extends BaseBlock {
|
||||||
if (!world.getBlockState(spawn).isAir()) {
|
if (!world.getBlockState(spawn).isAir()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> {
|
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> { return true; }).size();
|
||||||
return true;
|
|
||||||
}).size();
|
|
||||||
if (count > 6) {
|
if (count > 6) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +89,7 @@ public class SilkMothHiveBlock extends BaseBlock {
|
||||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||||
if (hand == InteractionHand.MAIN_HAND) {
|
if (hand == InteractionHand.MAIN_HAND) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (stack.is(FabricToolTags.SHEARS) && state.getValue(FULLNESS) == 3) {
|
if (stack.getItem().is(FabricToolTags.SHEARS) && state.getValue(FULLNESS) == 3) {
|
||||||
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
|
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
|
||||||
Direction dir = state.getValue(FACING);
|
Direction dir = state.getValue(FACING);
|
||||||
double px = pos.getX() + dir.getStepX() + 0.5;
|
double px = pos.getX() + dir.getStepX() + 0.5;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -44,10 +48,6 @@ import ru.betterend.entity.SilkMothEntity;
|
||||||
import ru.betterend.registry.EndEntities;
|
import ru.betterend.registry.EndEntities;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
|
public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
|
||||||
public static final BooleanProperty ACTIVE = EndBlockProperties.ACTIVE;
|
public static final BooleanProperty ACTIVE = EndBlockProperties.ACTIVE;
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||||
|
@ -134,9 +134,7 @@ public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
|
||||||
if (!world.getBlockState(spawn).isAir()) {
|
if (!world.getBlockState(spawn).isAir()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> {
|
int count = world.getEntities(EndEntities.SILK_MOTH, new AABB(pos).inflate(16), (entity) -> { return true; }).size();
|
||||||
return true;
|
|
||||||
}).size();
|
|
||||||
if (count > 6) {
|
if (count > 6) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +150,7 @@ public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
|
||||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||||
if (hand == InteractionHand.MAIN_HAND) {
|
if (hand == InteractionHand.MAIN_HAND) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (stack.is(FabricToolTags.SHEARS) && state.getValue(ACTIVE) && state.getValue(FULLNESS) == 3) {
|
if (stack.getItem().is(FabricToolTags.SHEARS) && state.getValue(ACTIVE) && state.getValue(FULLNESS) == 3) {
|
||||||
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
|
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
|
||||||
Direction dir = state.getValue(FACING);
|
Direction dir = state.getValue(FACING);
|
||||||
double px = pos.getX() + dir.getStepX() + 0.5;
|
double px = pos.getX() + dir.getStepX() + 0.5;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
@ -7,7 +9,6 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
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;
|
||||||
|
@ -16,8 +17,6 @@ import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SmallAmaranitaBlock extends EndPlantBlock {
|
public class SmallAmaranitaBlock extends EndPlantBlock {
|
||||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 10, 12);
|
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 10, 12);
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
|
||||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
||||||
BlockPos bigPos = growBig(world, pos);
|
BlockPos bigPos = growBig(world, pos);
|
||||||
if (bigPos != null) {
|
if (bigPos != null) {
|
||||||
if (EndFeatures.GIGANTIC_AMARANITA.getFeature().place(new FeaturePlaceContext<>(world, null, random, bigPos, null))) {
|
if (EndFeatures.GIGANTIC_AMARANITA.getFeature().place(world, null, random, bigPos, null)) {
|
||||||
replaceMushroom(world, bigPos);
|
replaceMushroom(world, bigPos);
|
||||||
replaceMushroom(world, bigPos.south());
|
replaceMushroom(world, bigPos.south());
|
||||||
replaceMushroom(world, bigPos.east());
|
replaceMushroom(world, bigPos.east());
|
||||||
|
@ -38,7 +37,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EndFeatures.LARGE_AMARANITA.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null));
|
EndFeatures.LARGE_AMARANITA.getFeature().place(world, null, random, pos, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.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;
|
||||||
|
@ -18,7 +23,6 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.BonemealableBlock;
|
import net.minecraft.world.level.block.BonemealableBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
|
@ -32,10 +36,6 @@ import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndFeatures;
|
import ru.betterend.registry.EndFeatures;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderTyped, BonemealableBlock {
|
public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderTyped, BonemealableBlock {
|
||||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderT
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||||
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||||
return Lists.newArrayList(new ItemStack(this));
|
return Lists.newArrayList(new ItemStack(this));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -99,6 +99,6 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderT
|
||||||
@Override
|
@Override
|
||||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
||||||
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(world, null, random, pos, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ 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.betterend.blocks.basis.LitPillarBlock;
|
import ru.bclib.blocks.BaseRotatedPillarBlock;
|
||||||
|
|
||||||
public class SmaragdantCrystalBlock extends LitPillarBlock {
|
public class SmaragdantCrystalBlock extends BaseRotatedPillarBlock {
|
||||||
public SmaragdantCrystalBlock() {
|
public SmaragdantCrystalBlock() {
|
||||||
super(FabricBlockSettings.of(Material.GLASS)
|
super(FabricBlockSettings.of(Material.GLASS)
|
||||||
.breakByTool(FabricToolTags.PICKAXES)
|
.breakByTool(FabricToolTags.PICKAXES)
|
||||||
|
@ -14,6 +14,6 @@ public class SmaragdantCrystalBlock extends LitPillarBlock {
|
||||||
.hardness(1F)
|
.hardness(1F)
|
||||||
.resistance(1F)
|
.resistance(1F)
|
||||||
.noOcclusion()
|
.noOcclusion()
|
||||||
.sound(SoundType.AMETHYST));
|
.sound(SoundType.GLASS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -29,8 +32,6 @@ 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 java.util.EnumMap;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class SmaragdantCrystalShardBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
|
public class SmaragdantCrystalShardBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
|
||||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||||
|
@ -41,7 +42,7 @@ public class SmaragdantCrystalShardBlock extends BaseAttachedBlock implements IR
|
||||||
.materialColor(MaterialColor.COLOR_GREEN)
|
.materialColor(MaterialColor.COLOR_GREEN)
|
||||||
.breakByTool(FabricToolTags.PICKAXES)
|
.breakByTool(FabricToolTags.PICKAXES)
|
||||||
.luminance(15)
|
.luminance(15)
|
||||||
.sound(SoundType.AMETHYST_CLUSTER)
|
.sound(SoundType.GLASS)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.noCollission());
|
.noCollission());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
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.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;
|
||||||
|
@ -36,10 +41,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
|
public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
|
||||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
|
@ -16,8 +18,6 @@ import ru.bclib.util.ColorUtil;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.registry.EndParticles;
|
import ru.betterend.registry.EndParticles;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider {
|
public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider {
|
||||||
public static final Vec3i[] COLORS;
|
public static final Vec3i[] COLORS;
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
|
||||||
return (state, world, pos, tintIndex) -> {
|
return (state, world, pos, tintIndex) -> {
|
||||||
if (pos == null) {
|
if (pos == null) {
|
||||||
pos = BlockPos.ZERO;
|
pos = BlockPos.ZERO;
|
||||||
}
|
};
|
||||||
;
|
|
||||||
long i = (MHelper.getRandom(pos.getX(), pos.getZ()) & 63) + pos.getY();
|
long i = (MHelper.getRandom(pos.getX(), pos.getZ()) & 63) + pos.getY();
|
||||||
double delta = i * 0.1;
|
double delta = i * 0.1;
|
||||||
int index = MHelper.floor(delta);
|
int index = MHelper.floor(delta);
|
||||||
|
@ -73,7 +72,7 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
COLORS = new Vec3i[]{
|
COLORS = new Vec3i[] {
|
||||||
new Vec3i(250, 111, 222),
|
new Vec3i(250, 111, 222),
|
||||||
new Vec3i(167, 89, 255),
|
new Vec3i(167, 89, 255),
|
||||||
new Vec3i(120, 207, 239),
|
new Vec3i(120, 207, 239),
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class TerrainPlantBlock extends EndPlantBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isTerrain(BlockState state) {
|
protected boolean isTerrain(BlockState state) {
|
||||||
for (Block block : ground) {
|
for (Block block: ground) {
|
||||||
if (state.is(block)) {
|
if (state.is(block)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -12,8 +14,6 @@ import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class TwistedUmbrellaMossBlock extends EndPlantBlock {
|
public class TwistedUmbrellaMossBlock extends EndPlantBlock {
|
||||||
public TwistedUmbrellaMossBlock() {
|
public TwistedUmbrellaMossBlock() {
|
||||||
super(11);
|
super(11);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
@ -8,8 +10,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import ru.bclib.blocks.BaseDoublePlantBlock;
|
import ru.bclib.blocks.BaseDoublePlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock {
|
public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock {
|
||||||
public TwistedUmbrellaMossTallBlock() {
|
public TwistedUmbrellaMossTallBlock() {
|
||||||
super(12);
|
super(12);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -12,8 +14,6 @@ import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class UmbrellaMossBlock extends EndPlantBlock {
|
public class UmbrellaMossBlock extends EndPlantBlock {
|
||||||
public UmbrellaMossBlock() {
|
public UmbrellaMossBlock() {
|
||||||
super(11);
|
super(11);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
@ -8,8 +10,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import ru.bclib.blocks.BaseDoublePlantBlock;
|
import ru.bclib.blocks.BaseDoublePlantBlock;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class UmbrellaMossTallBlock extends BaseDoublePlantBlock {
|
public class UmbrellaMossTallBlock extends BaseDoublePlantBlock {
|
||||||
public UmbrellaMossTallBlock() {
|
public UmbrellaMossTallBlock() {
|
||||||
super(12);
|
super(12);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
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.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
@ -13,8 +15,6 @@ import ru.bclib.blocks.BaseBlock;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
|
public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
|
||||||
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
|
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -25,9 +29,6 @@ import ru.bclib.util.MHelper;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderTyped, BlockModelProvider {
|
public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderTyped, BlockModelProvider {
|
||||||
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
||||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
||||||
|
@ -80,7 +81,6 @@ public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderType
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public BlockModel getItemModel(ResourceLocation resourceLocation) {
|
public BlockModel getItemModel(ResourceLocation resourceLocation) {
|
||||||
return getBlockModel(resourceLocation, defaultBlockState());
|
return getBlockModel(resourceLocation, defaultBlockState());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
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;
|
||||||
|
@ -7,12 +9,9 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.item.Items;
|
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
|
@ -33,18 +32,15 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import ru.bclib.util.BlocksHelper;
|
import ru.bclib.util.BlocksHelper;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class VentBubbleColumnBlock extends Block implements BucketPickup, LiquidBlockContainer {
|
public class VentBubbleColumnBlock extends Block implements BucketPickup, LiquidBlockContainer {
|
||||||
public VentBubbleColumnBlock() {
|
public VentBubbleColumnBlock() {
|
||||||
super(FabricBlockSettings.of(Material.BUBBLE_COLUMN).noOcclusion().noCollission().noDrops());
|
super(FabricBlockSettings.of(Material.BUBBLE_COLUMN).noOcclusion().noCollission().noDrops());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack pickupBlock(LevelAccessor world, BlockPos pos, BlockState state) {
|
public Fluid takeLiquid(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||||
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11);
|
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11);
|
||||||
return new ItemStack(Items.WATER_BUCKET);
|
return Fluids.WATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,10 +120,4 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
|
||||||
public FluidState getFluidState(BlockState state) {
|
public FluidState getFluidState(BlockState state) {
|
||||||
return Fluids.WATER.getSource(false);
|
return Fluids.WATER.getSource(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<SoundEvent> getPickupSound() {
|
|
||||||
return Fluids.WATER.getPickupSound();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
|
@ -14,9 +17,6 @@ import ru.bclib.blocks.BaseAnvilBlock;
|
||||||
import ru.betterend.blocks.complex.MetalMaterial;
|
import ru.betterend.blocks.complex.MetalMaterial;
|
||||||
import ru.betterend.item.EndAnvilItem;
|
import ru.betterend.item.EndAnvilItem;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class EndAnvilBlock extends BaseAnvilBlock {
|
public class EndAnvilBlock extends BaseAnvilBlock {
|
||||||
|
|
||||||
protected final int level;
|
protected final int level;
|
||||||
|
@ -109,8 +109,7 @@ public class EndAnvilBlock extends BaseAnvilBlock {
|
||||||
if (destructionProperty.getPossibleValues().contains(destruction)) {
|
if (destructionProperty.getPossibleValues().contains(destruction)) {
|
||||||
try {
|
try {
|
||||||
return fallingState.setValue(destructionProperty, destruction);
|
return fallingState.setValue(destructionProperty, destruction);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import java.util.Map;
|
||||||
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.client.resources.model.UnbakedModel;
|
import net.minecraft.client.resources.model.UnbakedModel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -26,8 +26,6 @@ import ru.bclib.blocks.BaseBlockNotFull;
|
||||||
import ru.bclib.blocks.BlockProperties;
|
import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer {
|
public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer {
|
||||||
public static final BooleanProperty IS_FLOOR = BlockProperties.IS_FLOOR;
|
public static final BooleanProperty IS_FLOOR = BlockProperties.IS_FLOOR;
|
||||||
|
@ -127,7 +125,6 @@ public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterlogg
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@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(),
|
||||||
|
|
|
@ -6,8 +6,7 @@ import ru.bclib.blocks.BasePlantWithAgeBlock;
|
||||||
|
|
||||||
public abstract class EndPlantWithAgeBlock extends BasePlantWithAgeBlock {
|
public abstract class EndPlantWithAgeBlock extends BasePlantWithAgeBlock {
|
||||||
|
|
||||||
public EndPlantWithAgeBlock() {
|
public EndPlantWithAgeBlock() {}
|
||||||
}
|
|
||||||
|
|
||||||
public EndPlantWithAgeBlock(Properties settings) {
|
public EndPlantWithAgeBlock(Properties settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
|
|
@ -6,8 +6,7 @@ import ru.bclib.blocks.UnderwaterPlantBlock;
|
||||||
|
|
||||||
public class EndUnderwaterPlantBlock extends UnderwaterPlantBlock {
|
public class EndUnderwaterPlantBlock extends UnderwaterPlantBlock {
|
||||||
|
|
||||||
public EndUnderwaterPlantBlock() {
|
public EndUnderwaterPlantBlock() {}
|
||||||
}
|
|
||||||
|
|
||||||
public EndUnderwaterPlantBlock(int light) {
|
public EndUnderwaterPlantBlock(int light) {
|
||||||
super(light);
|
super(light);
|
||||||
|
|
|
@ -6,8 +6,7 @@ import ru.bclib.blocks.BaseUnderwaterWallPlantBlock;
|
||||||
|
|
||||||
public class EndUnderwaterWallPlantBlock extends BaseUnderwaterWallPlantBlock {
|
public class EndUnderwaterWallPlantBlock extends BaseUnderwaterWallPlantBlock {
|
||||||
|
|
||||||
public EndUnderwaterWallPlantBlock() {
|
public EndUnderwaterWallPlantBlock() {}
|
||||||
}
|
|
||||||
|
|
||||||
public EndUnderwaterWallPlantBlock(int light) {
|
public EndUnderwaterWallPlantBlock(int light) {
|
||||||
super(light);
|
super(light);
|
||||||
|
|
|
@ -5,8 +5,7 @@ import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.blocks.BaseWallPlantBlock;
|
import ru.bclib.blocks.BaseWallPlantBlock;
|
||||||
|
|
||||||
public class EndWallPlantBlock extends BaseWallPlantBlock {
|
public class EndWallPlantBlock extends BaseWallPlantBlock {
|
||||||
public EndWallPlantBlock() {
|
public EndWallPlantBlock() {}
|
||||||
}
|
|
||||||
|
|
||||||
public EndWallPlantBlock(int light) {
|
public EndWallPlantBlock(int light) {
|
||||||
super(light);
|
super(light);
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
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.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;
|
||||||
|
@ -24,9 +28,6 @@ import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.IRenderTyped;
|
import ru.bclib.interfaces.IRenderTyped;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
|
public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
|
||||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||||
private final ItemLike drop;
|
private final ItemLike drop;
|
||||||
|
@ -61,7 +62,7 @@ public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||||
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||||
return Lists.newArrayList(new ItemStack(this));
|
return Lists.newArrayList(new ItemStack(this));
|
||||||
}
|
}
|
||||||
else if (dropChance < 1 || MHelper.RANDOM.nextInt(dropChance) == 0) {
|
else if (dropChance < 1 || MHelper.RANDOM.nextInt(dropChance) == 0) {
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
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()));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,15 @@
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
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.client.renderer.block.model.BlockModel;
|
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||||
import net.minecraft.client.resources.model.UnbakedModel;
|
import net.minecraft.client.resources.model.UnbakedModel;
|
||||||
|
@ -23,8 +30,6 @@ import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.EntityBlock;
|
import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
|
@ -35,7 +40,6 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.blocks.BaseBlockNotFull;
|
import ru.bclib.blocks.BaseBlockNotFull;
|
||||||
import ru.bclib.blocks.BlockProperties;
|
import ru.bclib.blocks.BlockProperties;
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
|
@ -48,13 +52,6 @@ import ru.betterend.client.models.Patterns;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.rituals.InfusionRitual;
|
import ru.betterend.rituals.InfusionRitual;
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
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 {
|
||||||
public final static EnumProperty<PedestalState> STATE = EndBlockProperties.PEDESTAL_STATE;
|
public final static EnumProperty<PedestalState> STATE = EndBlockProperties.PEDESTAL_STATE;
|
||||||
|
@ -69,6 +66,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
private static final VoxelShape SHAPE_BOTTOM;
|
private static final VoxelShape SHAPE_BOTTOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* Register new Pedestal block with Better End mod id.
|
* Register new Pedestal block with Better End mod id.
|
||||||
*
|
*
|
||||||
* @param name pedestal name
|
* @param name pedestal name
|
||||||
|
@ -80,6 +78,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* Register new Pedestal block with specified mod id.
|
* Register new Pedestal block with specified mod id.
|
||||||
*
|
*
|
||||||
* @param id pedestal id
|
* @param id pedestal id
|
||||||
|
@ -94,19 +93,11 @@ 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(getLuminance(parent.defaultBlockState())));
|
super(FabricBlockSettings.copyOf(parent).luminance(state -> state.getValue(HAS_LIGHT) ? 12 : 0));
|
||||||
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;
|
||||||
|
@ -130,8 +121,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
pedestal.setItem(0, itemStack);
|
pedestal.setItem(0, itemStack);
|
||||||
checkRitual(world, pos);
|
checkRitual(world, pos);
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ItemStack itemStack = pedestal.getItem(0);
|
ItemStack itemStack = pedestal.getItem(0);
|
||||||
if (player.addItem(itemStack)) {
|
if (player.addItem(itemStack)) {
|
||||||
pedestal.removeItemNoUpdate(0);
|
pedestal.removeItemNoUpdate(0);
|
||||||
|
@ -147,7 +137,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
@Override
|
@Override
|
||||||
public void destroy(LevelAccessor levelAccessor, BlockPos blockPos, BlockState blockState) {
|
public void destroy(LevelAccessor levelAccessor, BlockPos blockPos, BlockState blockState) {
|
||||||
MutableBlockPos posMutable = new MutableBlockPos();
|
MutableBlockPos posMutable = new MutableBlockPos();
|
||||||
for (Point point : InfusionRitual.getMap()) {
|
for (Point point: InfusionRitual.getMap()) {
|
||||||
posMutable.set(blockPos).move(point.x, 0, point.y);
|
posMutable.set(blockPos).move(point.x, 0, point.y);
|
||||||
BlockState state = levelAccessor.getBlockState(posMutable);
|
BlockState state = levelAccessor.getBlockState(posMutable);
|
||||||
if (state.getBlock() instanceof InfusionPedestal) {
|
if (state.getBlock() instanceof InfusionPedestal) {
|
||||||
|
@ -165,7 +155,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
|
|
||||||
public void checkRitual(Level world, BlockPos pos) {
|
public void checkRitual(Level world, BlockPos pos) {
|
||||||
MutableBlockPos posMutable = new MutableBlockPos();
|
MutableBlockPos posMutable = new MutableBlockPos();
|
||||||
for (Point point : InfusionRitual.getMap()) {
|
for (Point point: InfusionRitual.getMap()) {
|
||||||
posMutable.set(pos).move(point.x, 0, point.y);
|
posMutable.set(pos).move(point.x, 0, point.y);
|
||||||
BlockState state = world.getBlockState(posMutable);
|
BlockState state = world.getBlockState(posMutable);
|
||||||
if (state.getBlock() instanceof InfusionPedestal) {
|
if (state.getBlock() instanceof InfusionPedestal) {
|
||||||
|
@ -187,17 +177,13 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
boolean hasPedestalUnder = downState.getBlock() instanceof PedestalBlock;
|
boolean hasPedestalUnder = downState.getBlock() instanceof PedestalBlock;
|
||||||
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
||||||
return defaultBlockState().setValue(STATE, PedestalState.COLUMN_TOP);
|
return defaultBlockState().setValue(STATE, PedestalState.COLUMN_TOP);
|
||||||
}
|
} else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
||||||
else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
|
||||||
return defaultBlockState().setValue(STATE, PedestalState.COLUMN);
|
return defaultBlockState().setValue(STATE, PedestalState.COLUMN);
|
||||||
}
|
} else if (hasPedestalUnder && hasPedestalOver) {
|
||||||
else if (hasPedestalUnder && hasPedestalOver) {
|
|
||||||
return defaultBlockState().setValue(STATE, PedestalState.PILLAR);
|
return defaultBlockState().setValue(STATE, PedestalState.PILLAR);
|
||||||
}
|
} else if (hasPedestalUnder) {
|
||||||
else if (hasPedestalUnder) {
|
|
||||||
return defaultBlockState().setValue(STATE, PedestalState.PEDESTAL_TOP);
|
return defaultBlockState().setValue(STATE, PedestalState.PEDESTAL_TOP);
|
||||||
}
|
} else if (hasPedestalOver) {
|
||||||
else if (hasPedestalOver) {
|
|
||||||
return defaultBlockState().setValue(STATE, PedestalState.BOTTOM);
|
return defaultBlockState().setValue(STATE, PedestalState.BOTTOM);
|
||||||
}
|
}
|
||||||
return defaultBlockState();
|
return defaultBlockState();
|
||||||
|
@ -225,27 +211,21 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
if (direction == Direction.UP) {
|
if (direction == Direction.UP) {
|
||||||
upSideSolid = newState.isFaceSturdy(world, posFrom, Direction.DOWN) || newState.is(BlockTags.WALLS);
|
upSideSolid = newState.isFaceSturdy(world, posFrom, Direction.DOWN) || newState.is(BlockTags.WALLS);
|
||||||
hasPedestalOver = newState.getBlock() instanceof PedestalBlock;
|
hasPedestalOver = newState.getBlock() instanceof PedestalBlock;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
hasPedestalUnder = newState.getBlock() instanceof PedestalBlock;
|
hasPedestalUnder = newState.getBlock() instanceof PedestalBlock;
|
||||||
}
|
}
|
||||||
BlockState updatedState;
|
BlockState updatedState;
|
||||||
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
||||||
updatedState = state.setValue(STATE, PedestalState.COLUMN_TOP);
|
updatedState = state.setValue(STATE, PedestalState.COLUMN_TOP);
|
||||||
}
|
} else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
||||||
else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
|
||||||
updatedState = state.setValue(STATE, PedestalState.COLUMN);
|
updatedState = state.setValue(STATE, PedestalState.COLUMN);
|
||||||
}
|
} else if (hasPedestalUnder && hasPedestalOver) {
|
||||||
else if (hasPedestalUnder && hasPedestalOver) {
|
|
||||||
updatedState = state.setValue(STATE, PedestalState.PILLAR);
|
updatedState = state.setValue(STATE, PedestalState.PILLAR);
|
||||||
}
|
} else if (hasPedestalUnder) {
|
||||||
else if (hasPedestalUnder) {
|
|
||||||
updatedState = state.setValue(STATE, PedestalState.PEDESTAL_TOP);
|
updatedState = state.setValue(STATE, PedestalState.PEDESTAL_TOP);
|
||||||
}
|
} else if (hasPedestalOver) {
|
||||||
else if (hasPedestalOver) {
|
|
||||||
updatedState = state.setValue(STATE, PedestalState.BOTTOM);
|
updatedState = state.setValue(STATE, PedestalState.BOTTOM);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
updatedState = state.setValue(STATE, PedestalState.DEFAULT);
|
updatedState = state.setValue(STATE, PedestalState.DEFAULT);
|
||||||
}
|
}
|
||||||
if (!isPlaceable(updatedState)) {
|
if (!isPlaceable(updatedState)) {
|
||||||
|
@ -266,8 +246,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
drop.add(pedestal.getItem(0));
|
drop.add(pedestal.getItem(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return drop;
|
return drop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,23 +268,18 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (!state.is(this)) {
|
if (!state.is(this)) {
|
||||||
dropStoredStack(blockEntity, stack, pos);
|
dropStoredStack(blockEntity, stack, pos);
|
||||||
}
|
} else if (state.getValue(STATE).equals(PedestalState.PILLAR)) {
|
||||||
else if (state.getValue(STATE).equals(PedestalState.PILLAR)) {
|
|
||||||
moveStoredStack(blockEntity, world, stack, pos.above());
|
moveStoredStack(blockEntity, world, stack, pos.above());
|
||||||
}
|
} else if (!isPlaceable(state)) {
|
||||||
else if (!isPlaceable(state)) {
|
|
||||||
dropStoredStack(blockEntity, stack, pos);
|
dropStoredStack(blockEntity, stack, pos);
|
||||||
}
|
} else if (blockEntity instanceof PedestalBlockEntity) {
|
||||||
else if (blockEntity instanceof PedestalBlockEntity) {
|
|
||||||
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
||||||
if (pedestal.isEmpty()) {
|
if (pedestal.isEmpty()) {
|
||||||
pedestal.setItem(0, stack);
|
pedestal.setItem(0, stack);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dropStoredStack(blockEntity, stack, pos);
|
dropStoredStack(blockEntity, stack, pos);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dropStoredStack(blockEntity, stack, pos);
|
dropStoredStack(blockEntity, stack, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,7 +299,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
if (world.getBlockState(pos.above()).isAir()) {
|
if (world.getBlockState(pos.above()).isAir()) {
|
||||||
return pos.above();
|
return pos.above();
|
||||||
}
|
}
|
||||||
for (int i = 2; i < Direction.values().length; i++) {
|
for(int i = 2; i < Direction.values().length; i++) {
|
||||||
dropPos = pos.relative(Direction.from3DDataValue(i));
|
dropPos = pos.relative(Direction.from3DDataValue(i));
|
||||||
if (world.getBlockState(dropPos).isAir()) {
|
if (world.getBlockState(dropPos).isAir()) {
|
||||||
return dropPos.immutable();
|
return dropPos.immutable();
|
||||||
|
@ -345,7 +319,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||||
if (state.is(this)) {
|
if (state.is(this)) {
|
||||||
switch (state.getValue(STATE)) {
|
switch(state.getValue(STATE)) {
|
||||||
case BOTTOM: {
|
case BOTTOM: {
|
||||||
return SHAPE_BOTTOM;
|
return SHAPE_BOTTOM;
|
||||||
}
|
}
|
||||||
|
@ -375,8 +349,8 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||||
return new PedestalBlockEntity(blockPos, blockState);
|
return new PedestalBlockEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasUniqueEntity() {
|
public boolean hasUniqueEntity() {
|
||||||
|
@ -396,13 +370,11 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public BlockModel getItemModel(ResourceLocation blockId) {
|
public BlockModel getItemModel(ResourceLocation blockId) {
|
||||||
return getBlockModel(blockId, defaultBlockState());
|
return getBlockModel(blockId, defaultBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||||
Map<String, String> textures = createTexturesMap();
|
Map<String, String> textures = createTexturesMap();
|
||||||
PedestalState state = blockState.getValue(STATE);
|
PedestalState state = blockState.getValue(STATE);
|
||||||
|
@ -423,14 +395,12 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
case PILLAR:
|
case PILLAR:
|
||||||
pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_PILLAR, textures);
|
pattern = Patterns.createJson(Patterns.BLOCK_PEDESTAL_PILLAR, textures);
|
||||||
break;
|
break;
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return ModelsHelper.fromPattern(pattern);
|
return ModelsHelper.fromPattern(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@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(),
|
||||||
|
@ -444,9 +414,8 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
String name = blockId.getPath();
|
String name = blockId.getPath();
|
||||||
return new HashMap<String, String>() {
|
return new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
{
|
{
|
||||||
put("%mod%", blockId.getNamespace());
|
put("%mod%", blockId.getNamespace() );
|
||||||
put("%top%", name + "_top");
|
put("%top%", name + "_top");
|
||||||
put("%base%", name + "_base");
|
put("%base%", name + "_base");
|
||||||
put("%pillar%", name + "_pillar");
|
put("%pillar%", name + "_pillar");
|
||||||
|
@ -473,10 +442,4 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
||||||
SHAPE_COLUMN = Shapes.or(basin, SHAPE_PILLAR, columnTop);
|
SHAPE_COLUMN = Shapes.or(basin, SHAPE_PILLAR, columnTop);
|
||||||
SHAPE_BOTTOM = Shapes.or(basin, SHAPE_PILLAR);
|
SHAPE_BOTTOM = Shapes.or(basin, SHAPE_PILLAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
|
|
||||||
return level.isClientSide() ? PedestalBlockEntity::tick : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import java.util.Optional;
|
||||||
import net.fabricmc.api.Environment;
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.client.color.block.BlockColor;
|
import net.minecraft.client.color.block.BlockColor;
|
||||||
import net.minecraft.client.color.item.ItemColor;
|
import net.minecraft.client.color.item.ItemColor;
|
||||||
|
@ -13,14 +15,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 org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.client.models.ModelsHelper;
|
import ru.bclib.client.models.ModelsHelper;
|
||||||
import ru.bclib.interfaces.IColorProvider;
|
import ru.bclib.interfaces.IColorProvider;
|
||||||
import ru.betterend.client.models.Patterns;
|
import ru.betterend.client.models.Patterns;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class StoneLanternBlock extends EndLanternBlock implements IColorProvider {
|
public class StoneLanternBlock extends EndLanternBlock implements IColorProvider {
|
||||||
private static final VoxelShape SHAPE_CEIL = Block.box(3, 1, 3, 13, 16, 13);
|
private static final VoxelShape SHAPE_CEIL = Block.box(3, 1, 3, 13, 16, 13);
|
||||||
private static final VoxelShape SHAPE_FLOOR = Block.box(3, 0, 3, 13, 15, 13);
|
private static final VoxelShape SHAPE_FLOOR = Block.box(3, 0, 3, 13, 15, 13);
|
||||||
|
@ -45,7 +44,6 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@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) ?
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package ru.betterend.blocks.complex;
|
package ru.betterend.blocks.complex;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.world.item.DyeColor;
|
import net.minecraft.world.item.DyeColor;
|
||||||
|
@ -14,9 +18,6 @@ import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.config.Configs;
|
import ru.betterend.config.Configs;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class ColoredMaterial {
|
public class ColoredMaterial {
|
||||||
private static final Map<Integer, ItemLike> DYES = Maps.newHashMap();
|
private static final Map<Integer, ItemLike> DYES = Maps.newHashMap();
|
||||||
private static final Map<Integer, String> COLORS = Maps.newHashMap();
|
private static final Map<Integer, String> COLORS = Maps.newHashMap();
|
||||||
|
@ -52,7 +53,7 @@ public class ColoredMaterial {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (DyeColor color : DyeColor.values()) {
|
for (DyeColor color: DyeColor.values()) {
|
||||||
int colorRGB = color.getMaterialColor().col;
|
int colorRGB = color.getMaterialColor().col;
|
||||||
COLORS.put(colorRGB, color.getName());
|
COLORS.put(colorRGB, color.getName());
|
||||||
DYES.put(colorRGB, DyeItem.byColor(color));
|
DYES.put(colorRGB, DyeItem.byColor(color));
|
||||||
|
|
|
@ -4,6 +4,8 @@ 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;
|
||||||
|
@ -11,8 +13,6 @@ 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 LitBaseBlock(material));
|
polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material));
|
||||||
tiles = EndBlocks.registerBlock(name + "_tiles", new LitBaseBlock(material));
|
tiles = EndBlocks.registerBlock(name + "_tiles", new BaseBlock(material));
|
||||||
pillar = EndBlocks.registerBlock(name + "_pillar", new LitPillarBlock(material));
|
pillar = EndBlocks.registerBlock(name + "_pillar", new BaseRotatedPillarBlock(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 LitBaseBlock(material));
|
bricks = EndBlocks.registerBlock(name + "_bricks", new BaseBlock(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));
|
||||||
|
|
|
@ -3,7 +3,6 @@ package ru.betterend.blocks.complex;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
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.tags.Tag;
|
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.item.ArmorMaterial;
|
import net.minecraft.world.item.ArmorMaterial;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
@ -15,12 +14,10 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
import ru.bclib.api.TagAPI;
|
|
||||||
import ru.bclib.blocks.BaseBlock;
|
import ru.bclib.blocks.BaseBlock;
|
||||||
import ru.bclib.blocks.BaseChainBlock;
|
import ru.bclib.blocks.BaseChainBlock;
|
||||||
import ru.bclib.blocks.BaseDoorBlock;
|
import ru.bclib.blocks.BaseDoorBlock;
|
||||||
import ru.bclib.blocks.BaseMetalBarsBlock;
|
import ru.bclib.blocks.BaseMetalBarsBlock;
|
||||||
import ru.bclib.blocks.BaseOreBlock;
|
|
||||||
import ru.bclib.blocks.BaseSlabBlock;
|
import ru.bclib.blocks.BaseSlabBlock;
|
||||||
import ru.bclib.blocks.BaseStairsBlock;
|
import ru.bclib.blocks.BaseStairsBlock;
|
||||||
import ru.bclib.blocks.BaseTrapdoorBlock;
|
import ru.bclib.blocks.BaseTrapdoorBlock;
|
||||||
|
@ -28,6 +25,7 @@ import ru.bclib.blocks.WoodenPressurePlateBlock;
|
||||||
import ru.bclib.items.ModelProviderItem;
|
import ru.bclib.items.ModelProviderItem;
|
||||||
import ru.bclib.items.tool.BaseAxeItem;
|
import ru.bclib.items.tool.BaseAxeItem;
|
||||||
import ru.bclib.items.tool.BaseHoeItem;
|
import ru.bclib.items.tool.BaseHoeItem;
|
||||||
|
import ru.bclib.items.tool.BasePickaxeItem;
|
||||||
import ru.bclib.items.tool.BaseShovelItem;
|
import ru.bclib.items.tool.BaseShovelItem;
|
||||||
import ru.bclib.items.tool.BaseSwordItem;
|
import ru.bclib.items.tool.BaseSwordItem;
|
||||||
import ru.bclib.recipes.FurnaceRecipe;
|
import ru.bclib.recipes.FurnaceRecipe;
|
||||||
|
@ -43,11 +41,11 @@ import ru.betterend.config.Configs;
|
||||||
import ru.betterend.item.EndAnvilItem;
|
import ru.betterend.item.EndAnvilItem;
|
||||||
import ru.betterend.item.EndArmorItem;
|
import ru.betterend.item.EndArmorItem;
|
||||||
import ru.betterend.item.tool.EndHammerItem;
|
import ru.betterend.item.tool.EndHammerItem;
|
||||||
import ru.betterend.item.tool.EndPickaxe;
|
|
||||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||||
import ru.betterend.recipe.builders.AnvilRecipe;
|
import ru.betterend.recipe.builders.AnvilRecipe;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
import ru.betterend.registry.EndTags;
|
||||||
|
|
||||||
public class MetalMaterial {
|
public class MetalMaterial {
|
||||||
public final Block ore;
|
public final Block ore;
|
||||||
|
@ -68,7 +66,6 @@ public class MetalMaterial {
|
||||||
public final Block anvilBlock;
|
public final Block anvilBlock;
|
||||||
public final Item anvilItem;
|
public final Item anvilItem;
|
||||||
|
|
||||||
public final Item rawOre;
|
|
||||||
public final Item nugget;
|
public final Item nugget;
|
||||||
public final Item ingot;
|
public final Item ingot;
|
||||||
|
|
||||||
|
@ -92,8 +89,6 @@ public class MetalMaterial {
|
||||||
public final Item leggings;
|
public final Item leggings;
|
||||||
public final Item boots;
|
public final Item boots;
|
||||||
|
|
||||||
public final Tag.Named<Item> alloyingOre;
|
|
||||||
|
|
||||||
public static MetalMaterial makeNormal(String name, MaterialColor color, Tier material, ArmorMaterial armor) {
|
public static MetalMaterial makeNormal(String name, MaterialColor color, Tier material, ArmorMaterial armor) {
|
||||||
return new MetalMaterial(name, true, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor);
|
return new MetalMaterial(name, true, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor);
|
||||||
}
|
}
|
||||||
|
@ -114,13 +109,7 @@ public class MetalMaterial {
|
||||||
BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings).hardness(1).resistance(1).luminance(15).sound(SoundType.LANTERN);
|
BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings).hardness(1).resistance(1).luminance(15).sound(SoundType.LANTERN);
|
||||||
final int level = material.getLevel();
|
final int level = material.getLevel();
|
||||||
|
|
||||||
rawOre = hasOre ? EndItems.registerEndItem(name + "_raw", new ModelProviderItem(itemSettings)) : null;
|
ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseBlock(FabricBlockSettings.copyOf(Blocks.END_STONE))) : null;
|
||||||
ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseOreBlock(rawOre, 1, 3, 1)) : null;
|
|
||||||
alloyingOre = hasOre ? TagAPI.makeItemTag(BetterEnd.MOD_ID, name + "_alloying") : null;
|
|
||||||
if (hasOre) {
|
|
||||||
TagHelper.addTag(alloyingOre, ore, rawOre);
|
|
||||||
}
|
|
||||||
|
|
||||||
block = EndBlocks.registerBlock(name + "_block", new BaseBlock(settings));
|
block = EndBlocks.registerBlock(name + "_block", new BaseBlock(settings));
|
||||||
tile = EndBlocks.registerBlock(name + "_tile", new BaseBlock(settings));
|
tile = EndBlocks.registerBlock(name + "_tile", new BaseBlock(settings));
|
||||||
stairs = EndBlocks.registerBlock(name + "_stairs", new BaseStairsBlock(tile));
|
stairs = EndBlocks.registerBlock(name + "_stairs", new BaseStairsBlock(tile));
|
||||||
|
@ -147,7 +136,7 @@ public class MetalMaterial {
|
||||||
|
|
||||||
shovel = EndItems.registerEndTool(name + "_shovel", new BaseShovelItem(material, 1.5F, -3.0F, itemSettings));
|
shovel = EndItems.registerEndTool(name + "_shovel", new BaseShovelItem(material, 1.5F, -3.0F, itemSettings));
|
||||||
sword = EndItems.registerEndTool(name + "_sword", new BaseSwordItem(material, 3, -2.4F, itemSettings));
|
sword = EndItems.registerEndTool(name + "_sword", new BaseSwordItem(material, 3, -2.4F, itemSettings));
|
||||||
pickaxe = EndItems.registerEndTool(name + "_pickaxe", new EndPickaxe(material, 1, -2.8F, itemSettings));
|
pickaxe = EndItems.registerEndTool(name + "_pickaxe", new BasePickaxeItem(material, 1, -2.8F, itemSettings));
|
||||||
axe = EndItems.registerEndTool(name + "_axe", new BaseAxeItem(material, 6.0F, -3.0F, itemSettings));
|
axe = EndItems.registerEndTool(name + "_axe", new BaseAxeItem(material, 6.0F, -3.0F, itemSettings));
|
||||||
hoe = EndItems.registerEndTool(name + "_hoe", new BaseHoeItem(material, -3, 0.0F, itemSettings));
|
hoe = EndItems.registerEndTool(name + "_hoe", new BaseHoeItem(material, -3, 0.0F, itemSettings));
|
||||||
hammer = EndItems.registerEndTool(name + "_hammer", new EndHammerItem(material, 5.0F, -3.2F, 0.3D, itemSettings));
|
hammer = EndItems.registerEndTool(name + "_hammer", new EndHammerItem(material, 5.0F, -3.2F, 0.3D, itemSettings));
|
||||||
|
@ -162,9 +151,8 @@ public class MetalMaterial {
|
||||||
anvilItem = EndItems.registerEndItem(name + "_anvil_item", new EndAnvilItem(anvilBlock));
|
anvilItem = EndItems.registerEndItem(name + "_anvil_item", new EndAnvilItem(anvilBlock));
|
||||||
|
|
||||||
if (hasOre) {
|
if (hasOre) {
|
||||||
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace_ore", ore, ingot).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_ingot").buildWithBlasting();
|
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace", ore, ingot).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_ingot").buildWithBlasting();
|
||||||
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace_raw", rawOre, ingot).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_ingot").buildWithBlasting();
|
AlloyingRecipe.Builder.create(name + "_ingot_alloy").setInput(ore, ore).setOutput(ingot, 3).setExpiriense(2.1F).build();
|
||||||
AlloyingRecipe.Builder.create(name + "_ingot_alloy").setInput(alloyingOre, alloyingOre).setOutput(ingot, 3).setExpiriense(2.1F).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic recipes
|
// Basic recipes
|
||||||
|
@ -224,7 +212,6 @@ public class MetalMaterial {
|
||||||
TagHelper.addTag(BlockTags.ANVIL, anvilBlock);
|
TagHelper.addTag(BlockTags.ANVIL, anvilBlock);
|
||||||
TagHelper.addTag(BlockTags.BEACON_BASE_BLOCKS, block);
|
TagHelper.addTag(BlockTags.BEACON_BASE_BLOCKS, block);
|
||||||
TagHelper.addTag(ItemTags.BEACON_PAYMENT_ITEMS, ingot);
|
TagHelper.addTag(ItemTags.BEACON_PAYMENT_ITEMS, ingot);
|
||||||
TagHelper.addTag(TagAPI.DRAGON_IMMUNE, ore, bars);
|
TagHelper.addTag(EndTags.DRAGON_IMMUNE, ore, bars);
|
||||||
TagHelper.addTag(TagAPI.HAMMERS, hammer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,7 +16,6 @@ import ru.bclib.blocks.BaseBarkBlock;
|
||||||
import ru.bclib.blocks.BaseBarrelBlock;
|
import ru.bclib.blocks.BaseBarrelBlock;
|
||||||
import ru.bclib.blocks.BaseBlock;
|
import ru.bclib.blocks.BaseBlock;
|
||||||
import ru.bclib.blocks.BaseBookshelfBlock;
|
import ru.bclib.blocks.BaseBookshelfBlock;
|
||||||
import ru.bclib.blocks.BaseChestBlock;
|
|
||||||
import ru.bclib.blocks.BaseComposterBlock;
|
import ru.bclib.blocks.BaseComposterBlock;
|
||||||
import ru.bclib.blocks.BaseCraftingTableBlock;
|
import ru.bclib.blocks.BaseCraftingTableBlock;
|
||||||
import ru.bclib.blocks.BaseDoorBlock;
|
import ru.bclib.blocks.BaseDoorBlock;
|
||||||
|
@ -91,7 +90,7 @@ public class WoodenMaterial {
|
||||||
ladder = EndBlocks.registerBlock(name + "_ladder", new BaseLadderBlock(planks));
|
ladder = EndBlocks.registerBlock(name + "_ladder", new BaseLadderBlock(planks));
|
||||||
sign = EndBlocks.registerBlock(name + "_sign", new BaseSignBlock(planks));
|
sign = EndBlocks.registerBlock(name + "_sign", new BaseSignBlock(planks));
|
||||||
|
|
||||||
chest = EndBlocks.registerBlock(name + "_chest", new BaseChestBlock(planks));
|
chest = EndBlocks.registerBlock(name + "_chest", new BaseFenceBlock(planks));
|
||||||
barrel = EndBlocks.registerBlock(name + "_barrel", new BaseBarrelBlock(planks));
|
barrel = EndBlocks.registerBlock(name + "_barrel", new BaseBarrelBlock(planks));
|
||||||
shelf = EndBlocks.registerBlock(name + "_bookshelf", new BaseBookshelfBlock(planks));
|
shelf = EndBlocks.registerBlock(name + "_bookshelf", new BaseBookshelfBlock(planks));
|
||||||
composter = EndBlocks.registerBlock(name + "_composter", new BaseComposterBlock(planks));
|
composter = EndBlocks.registerBlock(name + "_composter", new BaseComposterBlock(planks));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ru.betterend.blocks.entities;
|
package ru.betterend.blocks.entities;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import java.util.List;
|
||||||
|
|
||||||
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.core.particles.ParticleTypes;
|
||||||
|
@ -8,8 +9,8 @@ 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;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.world.level.block.entity.TickableBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -19,54 +20,48 @@ import ru.betterend.registry.EndBlockEntities;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndParticles;
|
import ru.betterend.registry.EndParticles;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockEntityHydrothermalVent extends BlockEntity implements TickableBlockEntity {
|
||||||
|
|
||||||
public class BlockEntityHydrothermalVent extends BlockEntity {
|
|
||||||
private final static Vec3 POSITIVE_Y = new Vec3(0.0f, 1.0f, 0.0f);
|
private final static Vec3 POSITIVE_Y = new Vec3(0.0f, 1.0f, 0.0f);
|
||||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
|
||||||
|
|
||||||
public BlockEntityHydrothermalVent(BlockPos blockPos, BlockState blockState) {
|
public BlockEntityHydrothermalVent() {
|
||||||
super(EndBlockEntities.HYDROTHERMAL_VENT, blockPos, blockState);
|
super(EndBlockEntities.HYDROTHERMAL_VENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BlockEntity> void tick(Level level, BlockPos worldPosition, BlockState state, T uncastedEntity) {
|
@Override
|
||||||
if (level != null && uncastedEntity instanceof BlockEntityHydrothermalVent && state.is(EndBlocks.HYDROTHERMAL_VENT)) {
|
public void tick() {
|
||||||
BlockEntityHydrothermalVent blockEntity = (BlockEntityHydrothermalVent) uncastedEntity;
|
if (level != null) {
|
||||||
if (level.isClientSide()) {
|
BlockState state = getBlockState();
|
||||||
clientTick(level, worldPosition, state, blockEntity);
|
if (state.is(EndBlocks.HYDROTHERMAL_VENT)) {
|
||||||
}
|
|
||||||
//else {
|
|
||||||
serverTick(level, worldPosition, state, blockEntity);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void clientTick(Level level, BlockPos worldPosition, BlockState state, BlockEntityHydrothermalVent blockEntity) {
|
|
||||||
boolean active = state.getValue(HydrothermalVentBlock.ACTIVATED);
|
boolean active = state.getValue(HydrothermalVentBlock.ACTIVATED);
|
||||||
if (active && level.random.nextInt(20) == 0 && state.getValue(HydrothermalVentBlock.WATERLOGGED)) {
|
if (active && level.random.nextInt(20) == 0) {
|
||||||
double x = worldPosition.getX() + level.random.nextDouble();
|
double x = worldPosition.getX() + level.random.nextDouble();
|
||||||
double y = worldPosition.getY() + 0.9 + level.random.nextDouble() * 0.3;
|
double y = worldPosition.getY() + 0.9 + level.random.nextDouble() * 0.3;
|
||||||
double z = worldPosition.getZ() + level.random.nextDouble();
|
double z = worldPosition.getZ() + level.random.nextDouble();
|
||||||
|
if (state.getValue(HydrothermalVentBlock.WATERLOGGED)) {
|
||||||
level.addParticle(EndParticles.GEYSER_PARTICLE, x, y, z, 0, 0, 0);
|
level.addParticle(EndParticles.GEYSER_PARTICLE, x, y, z, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
level.addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MutableBlockPos mutable = worldPosition.mutable().move(Direction.UP);
|
||||||
private static void serverTick(Level level, BlockPos worldPosition, BlockState state, BlockEntityHydrothermalVent blockEntity) {
|
|
||||||
boolean active = state.getValue(HydrothermalVentBlock.ACTIVATED);
|
|
||||||
POS.set(worldPosition).move(Direction.UP);
|
|
||||||
int height = active ? 85 : 25;
|
int height = active ? 85 : 25;
|
||||||
AABB box = new AABB(POS.offset(-1, 0, -1), POS.offset(1, height, 1));
|
AABB box = new AABB(mutable.offset(-1, 0, -1), mutable.offset(1, height, 1));
|
||||||
List<LivingEntity> entities = level.getEntitiesOfClass(LivingEntity.class, box);
|
List<LivingEntity> entities = level.getEntitiesOfClass(LivingEntity.class, box);
|
||||||
if (entities.size() > 0) {
|
if (entities.size() > 0) {
|
||||||
while (POS.getY() < box.maxY) {
|
while (mutable.getY() < box.maxY) {
|
||||||
BlockState blockState = level.getBlockState(POS);
|
BlockState blockState = level.getBlockState(mutable);
|
||||||
if (blockState.isSolidRender(level, POS)) break;
|
if (blockState.isSolidRender(level, mutable)) break;
|
||||||
if (blockState.isAir()) {
|
if (blockState.isAir()) {
|
||||||
double mult = active ? 3.0 : 5.0;
|
double mult = active ? 3.0 : 5.0;
|
||||||
float force = (float) ((1.0 - (POS.getY() / box.maxY)) / mult);
|
float force = (float) ((1.0 - (mutable.getY() / box.maxY)) / mult);
|
||||||
entities.stream().filter(entity -> (int) entity.getY() == POS.getY() && blockEntity.hasElytra(entity) && entity.isFallFlying()).forEach(entity -> entity.moveRelative(force, POSITIVE_Y));
|
entities.stream().filter(entity -> (int) entity.getY() == mutable.getY() &&
|
||||||
|
hasElytra(entity) && entity.isFallFlying())
|
||||||
|
.forEach(entity -> entity.moveRelative(force, POSITIVE_Y));
|
||||||
|
}
|
||||||
|
mutable.move(Direction.UP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
POS.move(Direction.UP);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package ru.betterend.blocks.entities;
|
package ru.betterend.blocks.entities;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
import net.fabricmc.fabric.api.registry.FuelRegistry;
|
import net.fabricmc.fabric.api.registry.FuelRegistry;
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -33,6 +37,7 @@ import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
|
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
|
import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
|
||||||
|
import net.minecraft.world.level.block.entity.TickableBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
@ -41,15 +46,11 @@ import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
|
||||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||||
import ru.betterend.registry.EndBlockEntities;
|
import ru.betterend.registry.EndBlockEntities;
|
||||||
|
|
||||||
import java.util.Iterator;
|
public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeHolder, StackedContentsCompatible, TickableBlockEntity {
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeHolder, StackedContentsCompatible {
|
private static final int[] TOP_SLOTS = new int[] { 0, 1 };
|
||||||
|
private static final int[] BOTTOM_SLOTS = new int[] { 2, 3 };
|
||||||
private static final int[] TOP_SLOTS = new int[]{0, 1};
|
private static final int[] SIDE_SLOTS = new int[] { 1, 2 };
|
||||||
private static final int[] BOTTOM_SLOTS = new int[]{2, 3};
|
|
||||||
private static final int[] SIDE_SLOTS = new int[]{1, 2};
|
|
||||||
private static final Map<Item, Integer> AVAILABLE_FUELS = Maps.newHashMap();
|
private static final Map<Item, Integer> AVAILABLE_FUELS = Maps.newHashMap();
|
||||||
|
|
||||||
private final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
|
private final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
|
||||||
|
@ -61,13 +62,13 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
private int burnTime;
|
private int burnTime;
|
||||||
private int fuelTime;
|
private int fuelTime;
|
||||||
|
|
||||||
public EndStoneSmelterBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public EndStoneSmelterBlockEntity() {
|
||||||
super(EndBlockEntities.END_STONE_SMELTER, blockPos, blockState);
|
super(EndBlockEntities.END_STONE_SMELTER);
|
||||||
this.inventory = NonNullList.withSize(4, ItemStack.EMPTY);
|
this.inventory = NonNullList.withSize(4, ItemStack.EMPTY);
|
||||||
this.recipesUsed = new Object2IntOpenHashMap<>();
|
this.recipesUsed = new Object2IntOpenHashMap<>();
|
||||||
this.propertyDelegate = new ContainerData() {
|
this.propertyDelegate = new ContainerData() {
|
||||||
public int get(int index) {
|
public int get(int index) {
|
||||||
switch (index) {
|
switch(index) {
|
||||||
case 0:
|
case 0:
|
||||||
return EndStoneSmelterBlockEntity.this.burnTime;
|
return EndStoneSmelterBlockEntity.this.burnTime;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -82,7 +83,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(int index, int value) {
|
public void set(int index, int value) {
|
||||||
switch (index) {
|
switch(index) {
|
||||||
case 0:
|
case 0:
|
||||||
EndStoneSmelterBlockEntity.this.burnTime = value;
|
EndStoneSmelterBlockEntity.this.burnTime = value;
|
||||||
break;
|
break;
|
||||||
|
@ -121,8 +122,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;
|
||||||
}
|
}
|
||||||
|
@ -178,8 +178,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
if (recipe instanceof AlloyingRecipe) {
|
if (recipe instanceof AlloyingRecipe) {
|
||||||
AlloyingRecipe alloying = (AlloyingRecipe) recipe;
|
AlloyingRecipe alloying = (AlloyingRecipe) recipe;
|
||||||
dropExperience(player.level, player.position(), entry.getIntValue(), alloying.getExperience());
|
dropExperience(player.level, player.position(), entry.getIntValue(), alloying.getExperience());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
BlastingRecipe blasting = (BlastingRecipe) recipe;
|
BlastingRecipe blasting = (BlastingRecipe) recipe;
|
||||||
dropExperience(player.level, player.position(), entry.getIntValue(), blasting.getExperience());
|
dropExperience(player.level, player.position(), entry.getIntValue(), blasting.getExperience());
|
||||||
}
|
}
|
||||||
|
@ -196,7 +195,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
expTotal++;
|
expTotal++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (expTotal > 0) {
|
while(expTotal > 0) {
|
||||||
int expVal = ExperienceOrb.getExperienceValue(expTotal);
|
int expVal = ExperienceOrb.getExperienceValue(expTotal);
|
||||||
expTotal -= expVal;
|
expTotal -= expVal;
|
||||||
world.addFreshEntity(new ExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, expVal));
|
world.addFreshEntity(new ExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, expVal));
|
||||||
|
@ -226,62 +225,61 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
return new EndStoneSmelterScreenHandler(syncId, playerInventory, this, propertyDelegate);
|
return new EndStoneSmelterScreenHandler(syncId, playerInventory, this, propertyDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tick(Level tickLevel, BlockPos tickPos, BlockState tickState, EndStoneSmelterBlockEntity blockEntity) {
|
@Override
|
||||||
if (tickLevel == null) return;
|
public void tick() {
|
||||||
|
if (level == null) return;
|
||||||
|
|
||||||
boolean initialBurning = blockEntity.isBurning();
|
boolean initialBurning = isBurning();
|
||||||
if (initialBurning) {
|
if (initialBurning) {
|
||||||
blockEntity.burnTime--;
|
burnTime--;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean burning = initialBurning;
|
boolean burning = initialBurning;
|
||||||
if (!tickLevel.isClientSide) {
|
if (!level.isClientSide) {
|
||||||
ItemStack fuel = blockEntity.inventory.get(2);
|
ItemStack fuel = inventory.get(2);
|
||||||
if (!burning && (fuel.isEmpty() || blockEntity.inventory.get(0).isEmpty() && blockEntity.inventory.get(1).isEmpty())) {
|
if (!burning && (fuel.isEmpty() || inventory.get(0).isEmpty() && inventory.get(1).isEmpty())) {
|
||||||
if (blockEntity.smeltTime > 0) {
|
if (smeltTime > 0) {
|
||||||
blockEntity.smeltTime = Mth.clamp(blockEntity.smeltTime - 2, 0, blockEntity.smeltTimeTotal);
|
smeltTime = Mth.clamp(smeltTime - 2, 0, smeltTimeTotal);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
Recipe<?> recipe = level.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, this, level).orElse(null);
|
||||||
Recipe<?> recipe = tickLevel.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, blockEntity, tickLevel).orElse(null);
|
|
||||||
if (recipe == null) {
|
if (recipe == null) {
|
||||||
recipe = tickLevel.getRecipeManager().getRecipeFor(RecipeType.BLASTING, blockEntity, tickLevel).orElse(null);
|
recipe = level.getRecipeManager().getRecipeFor(RecipeType.BLASTING, this, level).orElse(null);
|
||||||
}
|
}
|
||||||
boolean accepted = blockEntity.canAcceptRecipeOutput(recipe);
|
boolean accepted = this.canAcceptRecipeOutput(recipe);
|
||||||
if (!burning && accepted) {
|
if (!burning && accepted) {
|
||||||
blockEntity.burnTime = blockEntity.getFuelTime(fuel);
|
burnTime = getFuelTime(fuel);
|
||||||
blockEntity.fuelTime = blockEntity.burnTime;
|
fuelTime = burnTime;
|
||||||
burning = blockEntity.isBurning();
|
burning = isBurning();
|
||||||
if (burning) {
|
if (burning) {
|
||||||
if (!fuel.isEmpty()) {
|
if (!fuel.isEmpty()) {
|
||||||
Item item = fuel.getItem();
|
Item item = fuel.getItem();
|
||||||
fuel.shrink(1);
|
fuel.shrink(1);
|
||||||
if (fuel.isEmpty()) {
|
if (fuel.isEmpty()) {
|
||||||
Item remainFuel = item.getCraftingRemainingItem();
|
Item remainFuel = item.getCraftingRemainingItem();
|
||||||
blockEntity.inventory.set(2, remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel));
|
inventory.set(2, remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blockEntity.setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (burning && accepted) {
|
if (burning && accepted) {
|
||||||
blockEntity.smeltTime++;
|
this.smeltTime++;
|
||||||
if (blockEntity.smeltTime == blockEntity.smeltTimeTotal) {
|
if (smeltTime == smeltTimeTotal) {
|
||||||
blockEntity.smeltTime = 0;
|
smeltTime = 0;
|
||||||
blockEntity.smeltTimeTotal = blockEntity.getSmeltTime();
|
smeltTimeTotal = getSmeltTime();
|
||||||
blockEntity.craftRecipe(recipe);
|
craftRecipe(recipe);
|
||||||
blockEntity.setChanged();
|
setChanged();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
smeltTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
blockEntity.smeltTime = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
burning = blockEntity.isBurning();
|
|
||||||
if (initialBurning != burning) {
|
if (initialBurning != burning) {
|
||||||
tickLevel.setBlock(tickPos, tickState.setValue(EndStoneSmelter.LIT, burning), 3);
|
level.setBlock(worldPosition, level.getBlockState(worldPosition).setValue(EndStoneSmelter.LIT, burning), 3);
|
||||||
blockEntity.setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,8 +290,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -326,8 +323,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
ItemStack output = inventory.get(3);
|
ItemStack output = inventory.get(3);
|
||||||
if (output.isEmpty()) {
|
if (output.isEmpty()) {
|
||||||
inventory.set(3, result.copy());
|
inventory.set(3, result.copy());
|
||||||
}
|
} else if (output.getItem() == result.getItem()) {
|
||||||
else if (output.getItem() == result.getItem()) {
|
|
||||||
output.grow(result.getCount());
|
output.grow(result.getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,12 +335,10 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
if (recipe instanceof AlloyingRecipe) {
|
if (recipe instanceof AlloyingRecipe) {
|
||||||
inventory.get(0).shrink(1);
|
inventory.get(0).shrink(1);
|
||||||
inventory.get(1).shrink(1);
|
inventory.get(1).shrink(1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (!inventory.get(0).isEmpty()) {
|
if (!inventory.get(0).isEmpty()) {
|
||||||
inventory.get(0).shrink(1);
|
inventory.get(0).shrink(1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
inventory.get(1).shrink(1);
|
inventory.get(1).shrink(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,8 +395,8 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CompoundTag tag) {
|
public void load(BlockState state, CompoundTag tag) {
|
||||||
super.load(tag);
|
super.load(state, tag);
|
||||||
inventory = NonNullList.withSize(getContainerSize(), ItemStack.EMPTY);
|
inventory = NonNullList.withSize(getContainerSize(), ItemStack.EMPTY);
|
||||||
ContainerHelper.loadAllItems(tag, inventory);
|
ContainerHelper.loadAllItems(tag, inventory);
|
||||||
burnTime = tag.getShort("BurnTime");
|
burnTime = tag.getShort("BurnTime");
|
||||||
|
@ -433,8 +427,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
||||||
public boolean canPlaceItem(int slot, ItemStack stack) {
|
public boolean canPlaceItem(int slot, ItemStack stack) {
|
||||||
if (slot == 3) {
|
if (slot == 3) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (slot != 2) {
|
||||||
else if (slot != 2) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ItemStack itemStack = this.inventory.get(2);
|
ItemStack itemStack = this.inventory.get(2);
|
||||||
|
|
|
@ -3,15 +3,14 @@ package ru.betterend.blocks.entities;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import ru.betterend.registry.EndBlockEntities;
|
import ru.betterend.registry.EndBlockEntities;
|
||||||
import ru.betterend.rituals.EternalRitual;
|
import ru.betterend.rituals.EternalRitual;
|
||||||
|
|
||||||
public class EternalPedestalEntity extends PedestalBlockEntity {
|
public class EternalPedestalEntity extends PedestalBlockEntity {
|
||||||
private EternalRitual linkedRitual;
|
private EternalRitual linkedRitual;
|
||||||
|
|
||||||
public EternalPedestalEntity(BlockPos blockPos, BlockState blockState) {
|
public EternalPedestalEntity() {
|
||||||
super(EndBlockEntities.ETERNAL_PEDESTAL, blockPos, blockState);
|
super(EndBlockEntities.ETERNAL_PEDESTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasRitual() {
|
public boolean hasRitual() {
|
||||||
|
@ -27,10 +26,10 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLevel(Level level) {
|
public void setLevelAndPosition(Level world, BlockPos pos) {
|
||||||
super.setLevel(level);
|
super.setLevelAndPosition(world, pos);
|
||||||
if (hasRitual()) {
|
if (hasRitual()) {
|
||||||
linkedRitual.setWorld(level);
|
linkedRitual.setWorld(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ package ru.betterend.blocks.entities;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import ru.betterend.registry.EndBlockEntities;
|
import ru.betterend.registry.EndBlockEntities;
|
||||||
import ru.betterend.rituals.InfusionRitual;
|
import ru.betterend.rituals.InfusionRitual;
|
||||||
|
|
||||||
|
@ -12,18 +10,17 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
|
||||||
|
|
||||||
private InfusionRitual linkedRitual;
|
private InfusionRitual linkedRitual;
|
||||||
|
|
||||||
public InfusionPedestalEntity(BlockPos blockPos, BlockState blockState) {
|
public InfusionPedestalEntity() {
|
||||||
super(EndBlockEntities.INFUSION_PEDESTAL, blockPos, blockState);
|
super(EndBlockEntities.INFUSION_PEDESTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLevel(Level world) {
|
public void setLevelAndPosition(Level world, BlockPos pos) {
|
||||||
super.setLevel(world);
|
super.setLevelAndPosition(world, pos);
|
||||||
if (hasRitual()) {
|
if (hasRitual()) {
|
||||||
linkedRitual.setLocation(world, this.getBlockPos());
|
linkedRitual.setLocation(world, pos);
|
||||||
}
|
} else {
|
||||||
else {
|
linkRitual(new InfusionRitual(this, world, pos));
|
||||||
linkRitual(new InfusionRitual(this, world, this.getBlockPos()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +36,14 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
|
||||||
return linkedRitual != null;
|
return linkedRitual != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
if (hasRitual()) {
|
||||||
|
linkedRitual.tick();
|
||||||
|
}
|
||||||
|
super.tick();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag save(CompoundTag tag) {
|
public CompoundTag save(CompoundTag tag) {
|
||||||
if (hasRitual()) {
|
if (hasRitual()) {
|
||||||
|
@ -55,14 +60,4 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
|
||||||
linkedRitual.fromTag(tag.getCompound("ritual"));
|
linkedRitual.fromTag(tag.getCompound("ritual"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BlockEntity> void tickEnity(Level level, BlockPos blockPos, BlockState blockState, T uncastedEntity) {
|
|
||||||
if (uncastedEntity instanceof InfusionPedestalEntity) {
|
|
||||||
InfusionPedestalEntity blockEntity = (InfusionPedestalEntity) uncastedEntity;
|
|
||||||
if (blockEntity.hasRitual()) {
|
|
||||||
blockEntity.linkedRitual.tick();
|
|
||||||
}
|
|
||||||
PedestalBlockEntity.tick(level, blockPos, blockState, blockEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,30 @@
|
||||||
package ru.betterend.blocks.entities;
|
package ru.betterend.blocks.entities;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
|
import net.minecraft.world.level.block.entity.TickableBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import ru.betterend.blocks.basis.PedestalBlock;
|
import ru.betterend.blocks.basis.PedestalBlock;
|
||||||
import ru.betterend.registry.EndBlockEntities;
|
import ru.betterend.registry.EndBlockEntities;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
public class PedestalBlockEntity extends BlockEntity implements Container, BlockEntityClientSerializable {
|
public class PedestalBlockEntity extends BlockEntity implements Container, TickableBlockEntity, BlockEntityClientSerializable {
|
||||||
private ItemStack activeItem = ItemStack.EMPTY;
|
private ItemStack activeItem = ItemStack.EMPTY;
|
||||||
|
|
||||||
private final int maxAge = 314;
|
private final int maxAge = 314;
|
||||||
private int age;
|
private int age;
|
||||||
|
|
||||||
public PedestalBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public PedestalBlockEntity() {
|
||||||
this(EndBlockEntities.PEDESTAL, blockPos, blockState);
|
super(EndBlockEntities.PEDESTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PedestalBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) {
|
public PedestalBlockEntity(BlockEntityType<?> type) {
|
||||||
super(blockEntityType, blockPos, blockState);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
|
@ -88,8 +87,7 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
|
||||||
BlockState trueState = state.setValue(PedestalBlock.HAS_ITEM, !isEmpty());
|
BlockState trueState = state.setValue(PedestalBlock.HAS_ITEM, !isEmpty());
|
||||||
if (activeItem.getItem() == EndItems.ETERNAL_CRYSTAL) {
|
if (activeItem.getItem() == EndItems.ETERNAL_CRYSTAL) {
|
||||||
trueState = trueState.setValue(PedestalBlock.HAS_LIGHT, true);
|
trueState = trueState.setValue(PedestalBlock.HAS_LIGHT, true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
trueState = trueState.setValue(PedestalBlock.HAS_LIGHT, false);
|
trueState = trueState.setValue(PedestalBlock.HAS_LIGHT, false);
|
||||||
}
|
}
|
||||||
level.setBlockAndUpdate(worldPosition, trueState);
|
level.setBlockAndUpdate(worldPosition, trueState);
|
||||||
|
@ -105,8 +103,8 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CompoundTag tag) {
|
public void load(BlockState state, CompoundTag tag) {
|
||||||
super.load(tag);
|
super.load(state, tag);
|
||||||
fromTag(tag);
|
fromTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,15 +131,12 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BlockEntity> void tick(Level level, BlockPos blockPos, BlockState blockState, T uncastedEntity) {
|
@Override
|
||||||
clientTick(level, blockPos, blockState, (PedestalBlockEntity) uncastedEntity);
|
public void tick() {
|
||||||
}
|
if (!isEmpty()) {
|
||||||
|
age++;
|
||||||
private static void clientTick(Level tickLevel, BlockPos tickPos, BlockState tickState, PedestalBlockEntity blockEntity) {
|
if (age > maxAge) {
|
||||||
if (!blockEntity.isEmpty()) {
|
age = 0;
|
||||||
blockEntity.age++;
|
|
||||||
if (blockEntity.age > blockEntity.maxAge) {
|
|
||||||
blockEntity.age = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.betterend.client;
|
package ru.betterend.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
|
@ -28,8 +30,6 @@ import ru.betterend.registry.EndModelProviders;
|
||||||
import ru.betterend.registry.EndParticles;
|
import ru.betterend.registry.EndParticles;
|
||||||
import ru.betterend.registry.EndScreens;
|
import ru.betterend.registry.EndScreens;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BetterEndClient implements ClientModInitializer {
|
public class BetterEndClient implements ClientModInitializer {
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package ru.betterend.client.gui;
|
package ru.betterend.client.gui;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
|
@ -15,10 +20,6 @@ import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
|
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class EndStoneSmelterRecipeBookScreen extends BlastingRecipeBookComponent {
|
public class EndStoneSmelterRecipeBookScreen extends BlastingRecipeBookComponent {
|
||||||
private Iterator<Item> fuelIterator;
|
private Iterator<Item> fuelIterator;
|
||||||
|
@ -48,7 +49,7 @@ public class EndStoneSmelterRecipeBookScreen extends BlastingRecipeBookComponent
|
||||||
this.ghostRecipe.addIngredient(Ingredient.of(result), (slots.get(3)).x, (slots.get(3)).y);
|
this.ghostRecipe.addIngredient(Ingredient.of(result), (slots.get(3)).x, (slots.get(3)).y);
|
||||||
NonNullList<Ingredient> inputs = recipe.getIngredients();
|
NonNullList<Ingredient> inputs = recipe.getIngredients();
|
||||||
Iterator<Ingredient> iterator = inputs.iterator();
|
Iterator<Ingredient> iterator = inputs.iterator();
|
||||||
for (int i = 0; i < 2; i++) {
|
for(int i = 0; i < 2; i++) {
|
||||||
if (!iterator.hasNext()) {
|
if (!iterator.hasNext()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -78,8 +79,7 @@ public class EndStoneSmelterRecipeBookScreen extends BlastingRecipeBookComponent
|
||||||
int slotX = this.fuelSlot.x + x;
|
int slotX = this.fuelSlot.x + x;
|
||||||
int slotY = this.fuelSlot.y + y;
|
int slotY = this.fuelSlot.y + y;
|
||||||
GuiComponent.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822018048);
|
GuiComponent.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822018048);
|
||||||
//TODO: test k=0
|
this.minecraft.getItemRenderer().renderAndDecorateItem(minecraft.player, this.getFuel().getDefaultInstance(), slotX, slotY);
|
||||||
this.minecraft.getItemRenderer().renderAndDecorateItem(minecraft.player, this.getFuel().getDefaultInstance(), slotX, slotY, 0);
|
|
||||||
RenderSystem.depthFunc(516);
|
RenderSystem.depthFunc(516);
|
||||||
GuiComponent.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822083583);
|
GuiComponent.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822083583);
|
||||||
RenderSystem.depthFunc(515);
|
RenderSystem.depthFunc(515);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package ru.betterend.client.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.gui.components.ImageButton;
|
import net.minecraft.client.gui.components.ImageButton;
|
||||||
|
@ -31,22 +32,21 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
//TODO: test in 1.17
|
|
||||||
narrow = width < 379;
|
narrow = width < 379;
|
||||||
recipeBook.init(width, height, minecraft, narrow, menu);
|
recipeBook.init(width, height, minecraft, narrow, menu);
|
||||||
leftPos = recipeBook.updateScreenPosition(width, imageWidth);
|
leftPos = recipeBook.updateScreenPosition(narrow, width, imageWidth);
|
||||||
addRenderableWidget(new ImageButton(leftPos + 20, height / 2 - 49, 20, 18, 0, 0, 19, RECIPE_BUTTON_TEXTURE, (buttonWidget) -> {
|
addButton(new ImageButton(leftPos + 20, height / 2 - 49, 20, 18, 0, 0, 19, RECIPE_BUTTON_TEXTURE, (buttonWidget) -> {
|
||||||
recipeBook.initVisuals();
|
recipeBook.initVisuals(narrow);
|
||||||
recipeBook.toggleVisibility();
|
recipeBook.toggleVisibility();
|
||||||
leftPos = recipeBook.updateScreenPosition(width, imageWidth);
|
leftPos = recipeBook.updateScreenPosition(narrow, width, imageWidth);
|
||||||
((ImageButton) buttonWidget).setPosition(leftPos + 20, height / 2 - 49);
|
((ImageButton) buttonWidget).setPosition(leftPos + 20, height / 2 - 49);
|
||||||
}));
|
}));
|
||||||
titleLabelX = (imageWidth - font.width(title)) / 2;
|
titleLabelX = (imageWidth - font.width(title)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void containerTick() {
|
public void tick() {
|
||||||
super.containerTick();
|
super.tick();
|
||||||
recipeBook.tick();
|
recipeBook.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,7 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
|
||||||
if (recipeBook.isVisible() && narrow) {
|
if (recipeBook.isVisible() && narrow) {
|
||||||
renderBg(matrices, delta, mouseX, mouseY);
|
renderBg(matrices, delta, mouseX, mouseY);
|
||||||
recipeBook.render(matrices, mouseX, mouseY, delta);
|
recipeBook.render(matrices, mouseX, mouseY, delta);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
recipeBook.render(matrices, mouseX, mouseY, delta);
|
recipeBook.render(matrices, mouseX, mouseY, delta);
|
||||||
super.render(matrices, mouseX, mouseY, delta);
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
recipeBook.renderGhostRecipe(matrices, leftPos, topPos, true, delta);
|
recipeBook.renderGhostRecipe(matrices, leftPos, topPos, true, delta);
|
||||||
|
@ -70,8 +69,7 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
if (this.recipeBook.mouseClicked(mouseX, mouseY, button)) {
|
if (this.recipeBook.mouseClicked(mouseX, mouseY, button)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return narrow && recipeBook.isVisible() || super.mouseClicked(mouseX, mouseY, button);
|
return narrow && recipeBook.isVisible() || super.mouseClicked(mouseX, mouseY, button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,10 +109,8 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
|
||||||
@Override
|
@Override
|
||||||
protected void renderBg(PoseStack matrices, float delta, int mouseX, int mouseY) {
|
protected void renderBg(PoseStack matrices, float delta, int mouseX, int mouseY) {
|
||||||
if (minecraft == null) return;
|
if (minecraft == null) return;
|
||||||
//TODO: verify
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
minecraft.getTextureManager().bind(BACKGROUND_TEXTURE);
|
||||||
RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE);
|
|
||||||
//minecraft.getTextureManager().bind(BACKGROUND_TEXTURE);
|
|
||||||
blit(matrices, leftPos, topPos, 0, 0, imageWidth, imageHeight);
|
blit(matrices, leftPos, topPos, 0, 0, imageWidth, imageHeight);
|
||||||
int progress;
|
int progress;
|
||||||
if (menu.isBurning()) {
|
if (menu.isBurning()) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue