mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Added the second magical plant
This commit is contained in:
parent
99fc4ea904
commit
80225bf1e7
10 changed files with 656 additions and 0 deletions
1
assets/models/tentacle.bbmodel
Normal file
1
assets/models/tentacle.bbmodel
Normal file
File diff suppressed because one or more lines are too long
169
assets/models/tentacle.java
Normal file
169
assets/models/tentacle.java
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
// Made with Blockbench 4.8.3
|
||||||
|
// Exported for Minecraft version 1.17+ for Yarn
|
||||||
|
// Paste this class into your mod and generate all required imports
|
||||||
|
public class tentacle extends EntityModel<Entity> {
|
||||||
|
private final ModelPart bone_a;
|
||||||
|
private final ModelPart flower_4;
|
||||||
|
private final ModelPart cube_r1;
|
||||||
|
private final ModelPart cube_r2;
|
||||||
|
private final ModelPart flower_8;
|
||||||
|
private final ModelPart cube_r3;
|
||||||
|
private final ModelPart cube_r4;
|
||||||
|
private final ModelPart flower_3;
|
||||||
|
private final ModelPart cube_r5;
|
||||||
|
private final ModelPart cube_r6;
|
||||||
|
private final ModelPart flower_7;
|
||||||
|
private final ModelPart cube_r7;
|
||||||
|
private final ModelPart cube_r8;
|
||||||
|
private final ModelPart flower_2;
|
||||||
|
private final ModelPart cube_r9;
|
||||||
|
private final ModelPart cube_r10;
|
||||||
|
private final ModelPart flower_6;
|
||||||
|
private final ModelPart cube_r11;
|
||||||
|
private final ModelPart cube_r12;
|
||||||
|
private final ModelPart flower_1;
|
||||||
|
private final ModelPart cube_r13;
|
||||||
|
private final ModelPart cube_r14;
|
||||||
|
private final ModelPart flower_5;
|
||||||
|
private final ModelPart cube_r15;
|
||||||
|
private final ModelPart cube_r16;
|
||||||
|
private final ModelPart bone_b;
|
||||||
|
private final ModelPart bone_c;
|
||||||
|
private final ModelPart flower_9;
|
||||||
|
private final ModelPart cube_r17;
|
||||||
|
private final ModelPart cube_r18;
|
||||||
|
private final ModelPart bone_d;
|
||||||
|
private final ModelPart flower_10;
|
||||||
|
private final ModelPart cube_r19;
|
||||||
|
private final ModelPart cube_r20;
|
||||||
|
private final ModelPart bone_e;
|
||||||
|
private final ModelPart bone_f;
|
||||||
|
private final ModelPart flower_11;
|
||||||
|
private final ModelPart cube_r21;
|
||||||
|
private final ModelPart cube_r22;
|
||||||
|
private final ModelPart bone_g;
|
||||||
|
private final ModelPart bone_h;
|
||||||
|
private final ModelPart flower_12;
|
||||||
|
private final ModelPart cube_r23;
|
||||||
|
private final ModelPart cube_r24;
|
||||||
|
private final ModelPart flower_13;
|
||||||
|
private final ModelPart cube_r25;
|
||||||
|
private final ModelPart cube_r26;
|
||||||
|
private final ModelPart flower_14;
|
||||||
|
private final ModelPart cube_r27;
|
||||||
|
private final ModelPart cube_r28;
|
||||||
|
public tentacle(ModelPart root) {
|
||||||
|
this.bone_a = root.getChild("bone_a");
|
||||||
|
}
|
||||||
|
public static TexturedModelData getTexturedModelData() {
|
||||||
|
ModelData modelData = new ModelData();
|
||||||
|
ModelPartData modelPartData = modelData.getRoot();
|
||||||
|
ModelPartData bone_a = modelPartData.addChild("bone_a", ModelPartBuilder.create().uv(0, 0).cuboid(-7.0F, -10.0F, -7.0F, 14.0F, 16.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 24.0F, 0.0F, 0.0F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData flower_4 = bone_a.addChild("flower_4", ModelPartBuilder.create(), ModelTransform.of(6.0F, 0.6703F, -6.7725F, 1.5929F, -0.909F, -1.1179F));
|
||||||
|
|
||||||
|
ModelPartData cube_r1 = flower_4.addChild("cube_r1", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r2 = flower_4.addChild("cube_r2", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_8 = flower_4.addChild("flower_8", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, 2.9259F, -0.8201F, -2.1974F));
|
||||||
|
|
||||||
|
ModelPartData cube_r3 = flower_8.addChild("cube_r3", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r4 = flower_8.addChild("cube_r4", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_3 = bone_a.addChild("flower_3", ModelPartBuilder.create(), ModelTransform.of(6.0F, 0.6703F, 4.2275F, -2.4079F, 0.2344F, -2.5374F));
|
||||||
|
|
||||||
|
ModelPartData cube_r5 = flower_3.addChild("cube_r5", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r6 = flower_3.addChild("cube_r6", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_7 = flower_3.addChild("flower_7", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, -2.4079F, 0.2344F, -2.5374F));
|
||||||
|
|
||||||
|
ModelPartData cube_r7 = flower_7.addChild("cube_r7", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r8 = flower_7.addChild("cube_r8", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_2 = bone_a.addChild("flower_2", ModelPartBuilder.create(), ModelTransform.of(-5.0F, 0.6703F, 4.2275F, -1.2698F, 0.9678F, -1.7981F));
|
||||||
|
|
||||||
|
ModelPartData cube_r9 = flower_2.addChild("cube_r9", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r10 = flower_2.addChild("cube_r10", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_6 = flower_2.addChild("flower_6", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, -1.2698F, 0.9678F, -1.7981F));
|
||||||
|
|
||||||
|
ModelPartData cube_r11 = flower_6.addChild("cube_r11", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r12 = flower_6.addChild("cube_r12", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_1 = bone_a.addChild("flower_1", ModelPartBuilder.create(), ModelTransform.of(-3.0F, 0.6703F, -7.7725F, 0.6103F, -0.0535F, -0.5864F));
|
||||||
|
|
||||||
|
ModelPartData cube_r13 = flower_1.addChild("cube_r13", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r14 = flower_1.addChild("cube_r14", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_5 = flower_1.addChild("flower_5", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.6103F, -0.0535F, -0.5864F));
|
||||||
|
|
||||||
|
ModelPartData cube_r15 = flower_5.addChild("cube_r15", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r16 = flower_5.addChild("cube_r16", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData bone_b = bone_a.addChild("bone_b", ModelPartBuilder.create().uv(0, 30).cuboid(-6.0F, -18.0F, -6.0F, 12.0F, 19.0F, 12.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -9.0F, 0.0F, -0.2618F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData bone_c = bone_b.addChild("bone_c", ModelPartBuilder.create().uv(48, 20).cuboid(-5.0F, -23.0F, -5.0F, 10.0F, 23.0F, 10.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -16.0F, 0.0F, 0.0F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData flower_9 = bone_c.addChild("flower_9", ModelPartBuilder.create(), ModelTransform.of(4.0F, -15.6242F, -3.3435F, 2.9259F, -0.8201F, -2.4592F));
|
||||||
|
|
||||||
|
ModelPartData cube_r17 = flower_9.addChild("cube_r17", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r18 = flower_9.addChild("cube_r18", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData bone_d = bone_c.addChild("bone_d", ModelPartBuilder.create().uv(40, 53).cuboid(-4.0F, -23.0F, -4.0F, 8.0F, 21.0F, 8.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -18.0F, 0.0F, -0.1745F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData flower_10 = bone_d.addChild("flower_10", ModelPartBuilder.create(), ModelTransform.of(-2.0F, -17.1355F, 3.0055F, -2.8606F, -0.5942F, 2.4482F));
|
||||||
|
|
||||||
|
ModelPartData cube_r19 = flower_10.addChild("cube_r19", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r20 = flower_10.addChild("cube_r20", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData bone_e = bone_d.addChild("bone_e", ModelPartBuilder.create().uv(0, 61).cuboid(-3.0F, -25.0F, -3.0F, 6.0F, 22.0F, 6.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -18.0F, 0.0F, 0.1745F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData bone_f = bone_e.addChild("bone_f", ModelPartBuilder.create().uv(72, 53).cuboid(-3.0F, -17.0F, -3.0F, 6.0F, 15.0F, 6.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -22.0F, 0.0F, 0.1745F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData flower_11 = bone_f.addChild("flower_11", ModelPartBuilder.create(), ModelTransform.of(-2.0F, -6.0251F, 0.478F, 2.7587F, 0.3479F, 2.5432F));
|
||||||
|
|
||||||
|
ModelPartData cube_r21 = flower_11.addChild("cube_r21", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r22 = flower_11.addChild("cube_r22", ModelPartBuilder.create().uv(86, 0).cuboid(-14.0F, 0.0F, 0.0F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData bone_g = bone_f.addChild("bone_g", ModelPartBuilder.create().uv(56, 0).cuboid(-2.6F, -16.0F, -2.6F, 5.2F, 15.0F, 5.2F, new Dilation(0.0F)), ModelTransform.of(0.0F, -15.0F, 0.0F, 0.3054F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData bone_h = bone_g.addChild("bone_h", ModelPartBuilder.create().uv(24, 61).cuboid(-2.1F, -17.0F, -2.1F, 4.2F, 15.0F, 4.2F, new Dilation(0.0F)), ModelTransform.of(0.0F, -13.0F, 0.0F, 0.2618F, 0.0F, 0.0F));
|
||||||
|
|
||||||
|
ModelPartData flower_12 = bone_h.addChild("flower_12", ModelPartBuilder.create(), ModelTransform.of(0.0F, -15.1462F, 0.6365F, 2.7587F, 0.3479F, 2.9795F));
|
||||||
|
|
||||||
|
ModelPartData cube_r23 = flower_12.addChild("cube_r23", ModelPartBuilder.create().uv(86, 0).cuboid(-50.2096F, 2.6718F, -13.6647F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r24 = flower_12.addChild("cube_r24", ModelPartBuilder.create().uv(86, 0).cuboid(-27.1617F, -35.2665F, 9.3832F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_13 = flower_12.addChild("flower_13", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, 2.7587F, 0.3479F, 2.5868F));
|
||||||
|
|
||||||
|
ModelPartData cube_r25 = flower_13.addChild("cube_r25", ModelPartBuilder.create().uv(86, 0).cuboid(-50.2096F, 2.6718F, -13.6647F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r26 = flower_13.addChild("cube_r26", ModelPartBuilder.create().uv(86, 0).cuboid(-27.1617F, -35.2665F, 9.3832F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
|
||||||
|
ModelPartData flower_14 = flower_12.addChild("flower_14", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, -1.9412F, -1.0444F, 1.7406F));
|
||||||
|
|
||||||
|
ModelPartData cube_r27 = flower_14.addChild("cube_r27", ModelPartBuilder.create().uv(86, 0).cuboid(-50.2096F, 2.6718F, -13.6647F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 1.5708F, 0.0F, 0.7854F));
|
||||||
|
|
||||||
|
ModelPartData cube_r28 = flower_14.addChild("cube_r28", ModelPartBuilder.create().uv(86, 0).cuboid(-27.1617F, -35.2665F, 9.3832F, 14.0F, 0.0F, 14.0F, new Dilation(0.0F)), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
return TexturedModelData.of(modelData, 128, 128);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||||
|
bone_a.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
}
|
BIN
assets/models/tentacle.png
Normal file
BIN
assets/models/tentacle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -6,6 +6,7 @@ import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.ability.data.Hit;
|
import com.minelittlepony.unicopia.ability.data.Hit;
|
||||||
import com.minelittlepony.unicopia.ability.data.Pos;
|
import com.minelittlepony.unicopia.ability.data.Pos;
|
||||||
import com.minelittlepony.unicopia.block.UBlocks;
|
import com.minelittlepony.unicopia.block.UBlocks;
|
||||||
|
import com.minelittlepony.unicopia.entity.mob.TentacleEntity;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||||
import com.minelittlepony.unicopia.util.TraceHelper;
|
import com.minelittlepony.unicopia.util.TraceHelper;
|
||||||
|
@ -83,6 +84,14 @@ public class EarthPonyGrowAbility implements Ability<Pos> {
|
||||||
w.setBlockState(pos.down(), Blocks.DIRT.getDefaultState());
|
w.setBlockState(pos.down(), Blocks.DIRT.getDefaultState());
|
||||||
}
|
}
|
||||||
w.setBlockState(pos, UBlocks.PLUNDER_VINE_BUD.getDefaultState());
|
w.setBlockState(pos, UBlocks.PLUNDER_VINE_BUD.getDefaultState());
|
||||||
|
} else if (w.random.nextInt(5000) == 0) {
|
||||||
|
if (w.getBlockState(pos.down()).isOf(Blocks.FARMLAND)) {
|
||||||
|
w.setBlockState(pos.down(), Blocks.DIRT.getDefaultState());
|
||||||
|
}
|
||||||
|
w.breakBlock(pos, true);
|
||||||
|
TentacleEntity tentacle = new TentacleEntity(w, pos);
|
||||||
|
tentacle.updatePositionAndAngles(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 0, 0);
|
||||||
|
w.spawnEntity(tentacle);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ public interface URenderers {
|
||||||
EntityRendererRegistry.register(UEntities.AIR_BALLOON, AirBalloonEntityRenderer::new);
|
EntityRendererRegistry.register(UEntities.AIR_BALLOON, AirBalloonEntityRenderer::new);
|
||||||
EntityRendererRegistry.register(UEntities.FRIENDLY_CREEPER, FriendlyCreeperEntityRenderer::new);
|
EntityRendererRegistry.register(UEntities.FRIENDLY_CREEPER, FriendlyCreeperEntityRenderer::new);
|
||||||
EntityRendererRegistry.register(UEntities.LOOT_BUG, LootBugEntityRenderer::new);
|
EntityRendererRegistry.register(UEntities.LOOT_BUG, LootBugEntityRenderer::new);
|
||||||
|
EntityRendererRegistry.register(UEntities.TENTACLE, TentacleEntityRenderer::new);
|
||||||
|
|
||||||
BlockEntityRendererFactories.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
|
BlockEntityRendererFactories.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
|
||||||
BlockEntityRendererFactories.register(UBlockEntities.FANCY_BED, CloudBedBlockEntityRenderer::new);
|
BlockEntityRendererFactories.register(UBlockEntities.FANCY_BED, CloudBedBlockEntityRenderer::new);
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.minelittlepony.unicopia.client.render.entity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.entity.mob.TentacleEntity;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.Dilation;
|
||||||
|
import net.minecraft.client.model.ModelData;
|
||||||
|
import net.minecraft.client.model.ModelPart;
|
||||||
|
import net.minecraft.client.model.ModelPartBuilder;
|
||||||
|
import net.minecraft.client.model.ModelPartData;
|
||||||
|
import net.minecraft.client.model.ModelTransform;
|
||||||
|
import net.minecraft.client.model.TexturedModelData;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
public class TentacleEntityModel extends EntityModel<TentacleEntity> {
|
||||||
|
private final ModelPart part;
|
||||||
|
|
||||||
|
private final Map<String, ModelPart> parts = new HashMap<>();
|
||||||
|
private final List<ModelPart> bones = new ArrayList<>();
|
||||||
|
private final List<ModelPart> brushes;
|
||||||
|
|
||||||
|
private final ModelPart tip;
|
||||||
|
|
||||||
|
public TentacleEntityModel(ModelPart root) {
|
||||||
|
super(RenderLayer::getEntityTranslucent);
|
||||||
|
this.part = root;
|
||||||
|
for (String key : List.of("bone_a", "bone_b", "bone_c", "bone_d", "bone_e", "bone_f", "bone_g", "bone_h")) {
|
||||||
|
parts.put(key, root = root.getChild(key));
|
||||||
|
bones.add(root);
|
||||||
|
}
|
||||||
|
var bone_a = parts.get("bone_a");
|
||||||
|
brushes = List.of(
|
||||||
|
bone_a.getChild("brush_1"),
|
||||||
|
bone_a.getChild("brush_2"),
|
||||||
|
bone_a.getChild("brush_3"),
|
||||||
|
bone_a.getChild("brush_4"),
|
||||||
|
parts.get("bone_c").getChild("flower_1"),
|
||||||
|
parts.get("bone_d").getChild("flower_2"),
|
||||||
|
parts.get("bone_f").getChild("flower_3"));
|
||||||
|
tip = parts.get("bone_h").getChild("tip");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TexturedModelData getTexturedModelData() {
|
||||||
|
ModelData data = new ModelData();
|
||||||
|
data.getRoot()
|
||||||
|
.addChild("bone_a", ModelPartBuilder.create().uv(0, 0).cuboid(-7, -10, -7, 14, 16, 14, Dilation.NONE), ModelTransform.pivot(0, 24, 0))
|
||||||
|
.addChild("bone_b", ModelPartBuilder.create().uv(0, 30).cuboid(-6, -18, -6, 12, 19, 12, Dilation.NONE), ModelTransform.of(0, -9, 0, -0.2618F, 0, 0))
|
||||||
|
.addChild("bone_c", ModelPartBuilder.create().uv(48, 20).cuboid(-5, -23, -5, 10, 23, 10, Dilation.NONE), ModelTransform.of(0, -16, 0, 0, 0, 0))
|
||||||
|
.addChild("bone_d", ModelPartBuilder.create().uv(40, 53).cuboid(-4, -23, -4, 8, 21, 8, Dilation.NONE), ModelTransform.of(0, -18, 0, -0.1745F, 0, 0))
|
||||||
|
.addChild("bone_e", ModelPartBuilder.create().uv(0, 61).cuboid(-3, -25, -3, 6, 22, 6, Dilation.NONE), ModelTransform.of(0, -18, 0, 0.1745F, 0, 0))
|
||||||
|
.addChild("bone_f", ModelPartBuilder.create().uv(72, 53).cuboid(-3, -17, -3, 6, 15, 6, Dilation.NONE), ModelTransform.of(0, -22, 0, 0.1745F, 0, 0))
|
||||||
|
.addChild("bone_g", ModelPartBuilder.create().uv(56, 0).cuboid(-2.6F, -16, -2.6F, 5.2F, 15, 5.2F, Dilation.NONE), ModelTransform.of(0, -15, 0, 0.3054F, 0, 0))
|
||||||
|
.addChild("bone_h", ModelPartBuilder.create().uv(24, 61).cuboid(-2.1F, -17, -2.1F, 4.2F, 15, 4.2F, Dilation.NONE), ModelTransform.of(0, -13, 0, 0.2618F, 0, 0));
|
||||||
|
return TexturedModelData.of(addFlowers(data), 128, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ModelData addFlowers(ModelData data) {
|
||||||
|
ModelPartData bone_a = data.getRoot().getChild("bone_a");
|
||||||
|
createFlowerSinglet(createFlowerSinglet(bone_a.addChild("brush_1", ModelPartBuilder.create(), ModelTransform.of(-3, 0.6703F, -7.7725F, 0.6103F, -0.0535F, -0.5864F))).addChild("bundle", ModelPartBuilder.create(), ModelTransform.rotation(0.6103F, -0.0535F, -0.5864F)));
|
||||||
|
createFlowerSinglet(createFlowerSinglet(bone_a.addChild("brush_2", ModelPartBuilder.create(), ModelTransform.of(-5, 0.6703F, 4.2275F, -1.2698F, 0.9678F, -1.7981F))).addChild("bundle", ModelPartBuilder.create(), ModelTransform.rotation(-1.2698F, 0.9678F, -1.7981F)));
|
||||||
|
createFlowerSinglet(createFlowerSinglet(bone_a.addChild("brush_3", ModelPartBuilder.create(), ModelTransform.of( 6, 0.6703F, 4.2275F, -2.4079F, 0.2344F, -2.5374F))).addChild("bundle", ModelPartBuilder.create(), ModelTransform.rotation(-2.4079F, 0.2344F, -2.5374F)));
|
||||||
|
createFlowerSinglet(createFlowerSinglet(bone_a.addChild("brush_4", ModelPartBuilder.create(), ModelTransform.of( 6, 0.6703F, -6.7725F, 1.5929F, -0.909F, -1.1179F))).addChild("bundle", ModelPartBuilder.create(), ModelTransform.rotation(2.9259F, -0.8201F, -2.1974F)));
|
||||||
|
|
||||||
|
ModelPartData bone_c = bone_a.getChild("bone_b").getChild("bone_c");
|
||||||
|
createFlowerSinglet(bone_c.addChild("flower_1", ModelPartBuilder.create(), ModelTransform.of( 4, -15.6242F, -3.3435F, 2.9259F, -0.8201F, -2.4592F)));
|
||||||
|
|
||||||
|
ModelPartData bone_d = bone_c.getChild("bone_d");
|
||||||
|
createFlowerSinglet(bone_d.addChild("flower_2", ModelPartBuilder.create(), ModelTransform.of(-2, -17.1355F, 3.0055F, -2.8606F, -0.5942F, 2.4482F)));
|
||||||
|
ModelPartData bone_f = bone_d.getChild("bone_e").getChild("bone_f");
|
||||||
|
createFlowerSinglet(bone_f.addChild("flower_3", ModelPartBuilder.create(), ModelTransform.of(-2, -6.0251F, 0.478F, 2.7587F, 0.3479F, 2.5432F)));
|
||||||
|
|
||||||
|
ModelPartData flower_12 = createFlowerBunch(bone_f.getChild("bone_g").getChild("bone_h").addChild("tip", ModelPartBuilder.create(), ModelTransform.of(0, -15.1462F, 0.6365F, 2.7587F, 0.3479F, 2.9795F)));
|
||||||
|
createFlowerBunch(flower_12.addChild("bundle_1", ModelPartBuilder.create(), ModelTransform.rotation( 2.7587F, 0.3479F, 2.5868F)));
|
||||||
|
createFlowerBunch(flower_12.addChild("bundle_2", ModelPartBuilder.create(), ModelTransform.rotation(-1.9412F, -1.0444F, 1.7406F)));
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ModelPartData createFlowerSinglet(ModelPartData parent) {
|
||||||
|
parent.addChild("flower_1", ModelPartBuilder.create().uv(86, 0).cuboid(-14, 0, 0, 14, 0, 14, Dilation.NONE), ModelTransform.rotation(1.5708F, 0, 0.7854F));
|
||||||
|
parent.addChild("flower_2", ModelPartBuilder.create().uv(86, 0).cuboid(-14, 0, 0, 14, 0, 14, Dilation.NONE), ModelTransform.rotation(3.1416F, 0.7854F, 1.5708F));
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ModelPartData createFlowerBunch(ModelPartData parent) {
|
||||||
|
parent.addChild("flower_1", ModelPartBuilder.create().uv(86, 0).cuboid(-50.2096F, 2.6718F, -13.6647F, 14, 0, 14, Dilation.NONE), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 1.5708F, 0, 0.7854F));
|
||||||
|
parent.addChild("flower_2", ModelPartBuilder.create().uv(86, 0).cuboid(-27.1617F, -35.2665F, 9.3832F, 14, 0, 14, Dilation.NONE), ModelTransform.of(36.0432F, 15.5243F, -3.1436F, 3.1416F, 0.7854F, 1.5708F));
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAngles(TentacleEntity entity, float limbSwing, float limbSwingAmount, float tickDelta, float yaw, float pitch) {
|
||||||
|
float age = entity.age + tickDelta + (entity.getUuid().getMostSignificantBits() % 100);
|
||||||
|
float idleWaveTimer = entity.getAnimationTimer(tickDelta);
|
||||||
|
|
||||||
|
float attackProgress = entity.isAttacking() ? Math.abs(MathHelper.sin(entity.getAttackProgress(tickDelta) * MathHelper.PI)) : 0;
|
||||||
|
float attackCurve = attackProgress * -0.5F;
|
||||||
|
float sweepDirection = 1;
|
||||||
|
|
||||||
|
float bendIntentisty = 1 + entity.getAttackProgress(tickDelta) / 2F;
|
||||||
|
|
||||||
|
part.yaw = (yaw * MathHelper.RADIANS_PER_DEGREE) + MathHelper.HALF_PI * attackProgress;
|
||||||
|
|
||||||
|
for (ModelPart bone : bones) {
|
||||||
|
float idlePitch = MathHelper.sin(idleWaveTimer) * 0.0226F * bendIntentisty;
|
||||||
|
float idleYaw = MathHelper.cos(idleWaveTimer + 0.53F) * 0.07F;
|
||||||
|
float idleRoll = MathHelper.sin(idleWaveTimer * 0.2F) * 0.0226F * bendIntentisty;
|
||||||
|
idleWaveTimer += 1.5F;
|
||||||
|
bendIntentisty += 3F;
|
||||||
|
bone.resetTransform();
|
||||||
|
|
||||||
|
bone.pitch = MathHelper.lerp(attackProgress, idlePitch, bone.pitch + attackCurve);
|
||||||
|
bone.yaw = MathHelper.lerp(attackProgress, idleYaw, bone.yaw + sweepDirection * attackCurve);
|
||||||
|
bone.roll = MathHelper.lerp(attackProgress, idleRoll, bone.roll);
|
||||||
|
attackCurve *= 1.04F;
|
||||||
|
}
|
||||||
|
|
||||||
|
float direction = 1;
|
||||||
|
|
||||||
|
for (ModelPart brush : brushes) {
|
||||||
|
brush.resetTransform();
|
||||||
|
brush.pitch += MathHelper.sin(age * 0.003F) * 0.03F;
|
||||||
|
brush.yaw += MathHelper.cos(age * 0.003F) * 0.1F * (direction *= -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
tip.resetTransform();
|
||||||
|
tip.pitch += MathHelper.sin(age * 0.003F) * 0.3F;
|
||||||
|
tip.yaw += MathHelper.sin(age * 0.03F) * 0.3F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||||
|
part.render(matrices, vertices, light, overlay);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.minelittlepony.unicopia.client.render.entity;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
|
import com.minelittlepony.unicopia.entity.mob.TentacleEntity;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class TentacleEntityRenderer extends EntityRenderer<TentacleEntity> {
|
||||||
|
private static final Identifier TEXTURE = Unicopia.id("textures/entity/poison_joke/tentacle.png");
|
||||||
|
|
||||||
|
private final TentacleEntityModel model;
|
||||||
|
|
||||||
|
public TentacleEntityRenderer(EntityRendererFactory.Context context) {
|
||||||
|
super(context);
|
||||||
|
model = new TentacleEntityModel(TentacleEntityModel.getTexturedModelData().createModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(TentacleEntity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertices, int light) {
|
||||||
|
matrices.push();
|
||||||
|
matrices.scale(-1, -1, 1);
|
||||||
|
float scale = entity.getGrowth(tickDelta);
|
||||||
|
|
||||||
|
matrices.scale(scale, scale, scale);
|
||||||
|
matrices.translate(0, -0.9F, 0);
|
||||||
|
|
||||||
|
model.setAngles(entity, 0, 0, tickDelta, entity.getYaw(tickDelta), entity.getPitch(tickDelta));
|
||||||
|
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||||
|
matrices.pop();
|
||||||
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getTexture(TentacleEntity entity) {
|
||||||
|
return TEXTURE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,289 @@
|
||||||
|
package com.minelittlepony.unicopia.entity.mob;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.data.DataTracker;
|
||||||
|
import net.minecraft.entity.data.TrackedData;
|
||||||
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
|
import net.minecraft.entity.decoration.AbstractDecorationEntity;
|
||||||
|
import net.minecraft.entity.mob.HostileEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.registry.tag.ItemTags;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.HitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Box;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.RaycastContext;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class TentacleEntity extends AbstractDecorationEntity {
|
||||||
|
static final byte ATTACK_STATUS = 54;
|
||||||
|
static final int MAX_GROWTH = 25;
|
||||||
|
private static final TrackedData<Integer> GROWTH = DataTracker.registerData(TentacleEntity.class, TrackedDataHandlerRegistry.INTEGER);
|
||||||
|
private static final TrackedData<Integer> MOTION_OFFSET = DataTracker.registerData(TentacleEntity.class, TrackedDataHandlerRegistry.INTEGER);
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Box visibilityBox;
|
||||||
|
|
||||||
|
private int prevGrowth;
|
||||||
|
private int attackingTicks;
|
||||||
|
private float prevAttackingTicks;
|
||||||
|
|
||||||
|
private int ticksActive;
|
||||||
|
private int prevMotionOffset;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private LivingEntity target;
|
||||||
|
private final Comparator<LivingEntity> targetSorting = Comparator.comparing(this::distanceTo);
|
||||||
|
|
||||||
|
public TentacleEntity(EntityType<? extends TentacleEntity> type, World world) {
|
||||||
|
super(type, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TentacleEntity(World world, BlockPos pos) {
|
||||||
|
super(UEntities.TENTACLE, world, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDataTracker() {
|
||||||
|
super.initDataTracker();
|
||||||
|
dataTracker.startTracking(GROWTH, 0);
|
||||||
|
dataTracker.startTracking(MOTION_OFFSET, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void attack(BlockPos pos) {
|
||||||
|
var offset = pos.toCenterPos().subtract(getBlockPos().toCenterPos());
|
||||||
|
|
||||||
|
double dX = offset.x;
|
||||||
|
double dY = offset.y;
|
||||||
|
double dZ = offset.z;
|
||||||
|
double radius = Math.sqrt(dX * dX + dZ * dZ);
|
||||||
|
|
||||||
|
setPitch(MathHelper.wrapDegrees((float)(-(MathHelper.atan2(dY, radius) * MathHelper.DEGREES_PER_RADIAN))));
|
||||||
|
setYaw(MathHelper.wrapDegrees((float)(MathHelper.atan2(dZ, dX) * MathHelper.DEGREES_PER_RADIAN) - 90));
|
||||||
|
getWorld().sendEntityStatus(this, ATTACK_STATUS);
|
||||||
|
attackingTicks = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAttackProgress(float tickDelta) {
|
||||||
|
return (30F - MathHelper.lerp(tickDelta, prevAttackingTicks, attackingTicks)) / 30F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getGrowth(float tickDelta) {
|
||||||
|
return MathHelper.lerp(tickDelta, prevGrowth, getGrowth()) / (float)MAX_GROWTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGrowth() {
|
||||||
|
return dataTracker.get(GROWTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrowth(int growth) {
|
||||||
|
dataTracker.set(GROWTH, Math.max(0, growth));
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAnimationTimer(float tickDelta) {
|
||||||
|
return (age + tickDelta + (getUuid().getMostSignificantBits() % 100)) * 0.00043F
|
||||||
|
+ MathHelper.lerp(tickDelta, prevMotionOffset, getMotionOffset()) * 0.002F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMotionOffset() {
|
||||||
|
return dataTracker.get(MOTION_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotionOffset(int motionOffset) {
|
||||||
|
dataTracker.set(MOTION_OFFSET, motionOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAttacking() {
|
||||||
|
return attackingTicks > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidthPixels() {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeightPixels() {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean damage(DamageSource source, float amount) {
|
||||||
|
if (source.getAttacker() instanceof PlayerEntity player) {
|
||||||
|
if (player.getStackInHand(Hand.MAIN_HAND).isIn(ItemTags.SHOVELS)) {
|
||||||
|
kill();
|
||||||
|
ParticleUtils.spawnParticles(ParticleTypes.EFFECT, this, 10);
|
||||||
|
}
|
||||||
|
if (getWorld().random.nextInt(5) == 0 && canTarget(player)) {
|
||||||
|
setTarget(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ticksActive += 20;
|
||||||
|
playSound(SoundEvents.ENTITY_RAVAGER_ROAR, 5, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
prevMotionOffset = getMotionOffset();
|
||||||
|
prevGrowth = getGrowth();
|
||||||
|
super.tick();
|
||||||
|
prevAttackingTicks = attackingTicks;
|
||||||
|
if (isAttacking()) {
|
||||||
|
if (--attackingTicks == 12) {
|
||||||
|
if (target != null) {
|
||||||
|
target.damage(getDamageSources().generic(), 15);
|
||||||
|
Vec3d diff = target.getPos().subtract(getPos());
|
||||||
|
target.takeKnockback(1, diff.x, diff.z);
|
||||||
|
|
||||||
|
ParticleUtils.spawnParticles(ParticleTypes.CLOUD, target, 10);
|
||||||
|
|
||||||
|
for (Entity bystander : getWorld().getOtherEntities(target, target.getBoundingBox().expand(3))) {
|
||||||
|
if (bystander instanceof LivingEntity l) {
|
||||||
|
diff = l.getPos().subtract(getPos());
|
||||||
|
l.takeKnockback(1, diff.x, diff.z);
|
||||||
|
ParticleUtils.spawnParticles(ParticleTypes.CLOUD, target, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
playSound(SoundEvents.BLOCK_POINTED_DRIPSTONE_LAND, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticleUtils.spawnParticles(ParticleTypes.ASH, this, 4);
|
||||||
|
var sphere = new Sphere(false, 10).translate(getPos());
|
||||||
|
ParticleUtils.spawnParticles(getWorld(), sphere, ParticleTypes.ASH, 4);
|
||||||
|
|
||||||
|
if (!getWorld().isClient) {
|
||||||
|
int growth = getGrowth();
|
||||||
|
|
||||||
|
if (growth >= MAX_GROWTH / 2) {
|
||||||
|
if (age % 50 == 0) {
|
||||||
|
updateTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target != null && !isAttacking()) {
|
||||||
|
attack(target.getBlockPos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (growth < MAX_GROWTH) {
|
||||||
|
setGrowth(growth + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getWorld().random.nextInt(110) == 0) {
|
||||||
|
playSound(SoundEvents.BLOCK_CONDUIT_AMBIENT_SHORT, 1, 0.3F);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ticksActive > 0) {
|
||||||
|
ticksActive--;
|
||||||
|
setMotionOffset(getMotionOffset() + ticksActive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(LivingEntity target) {
|
||||||
|
this.target = target;
|
||||||
|
playSound(SoundEvents.ENTITY_RAVAGER_ROAR, 5, 1);
|
||||||
|
|
||||||
|
if (target instanceof PlayerEntity player) {
|
||||||
|
Pony.of(player).getMagicalReserves().getEnergy().add(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTarget() {
|
||||||
|
if (!canTarget(target)) {
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target == null && !isAttacking()) {
|
||||||
|
getWorld().getEntitiesByClass(HostileEntity.class, getBoundingBox().expand(10, 3, 10), this::canTarget)
|
||||||
|
.stream()
|
||||||
|
.sorted(targetSorting)
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(this::setTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canTarget(LivingEntity target) {
|
||||||
|
return target != null
|
||||||
|
&& !target.isRemoved()
|
||||||
|
&& !target.isSneaky()
|
||||||
|
&& !(target instanceof PlayerEntity player && (player.isCreative() || player.isSpectator()))
|
||||||
|
&& canSee(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canSee(Entity entity) {
|
||||||
|
return entity.getWorld() == getWorld()
|
||||||
|
&& distanceTo(entity) <= 128
|
||||||
|
&& getWorld().raycast(new RaycastContext(getPos(), entity.getPos(), RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, this)).getType() == HitResult.Type.MISS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleStatus(byte status) {
|
||||||
|
switch (status) {
|
||||||
|
case ATTACK_STATUS:
|
||||||
|
attackingTicks = 30;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super.handleStatus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBreak(Entity breaker) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlace() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canStayAttached() {
|
||||||
|
return getWorld().isTopSolid(getBlockPos().down(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Box getVisibilityBoundingBox() {
|
||||||
|
if (visibilityBox == null) {
|
||||||
|
visibilityBox = getBoundingBox().expand(10, 0, 10).stretch(0, 10, 0);
|
||||||
|
}
|
||||||
|
return visibilityBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateAttachmentPosition() {
|
||||||
|
visibilityBox = null;
|
||||||
|
Vec3d pos = attachmentPos.toCenterPos();
|
||||||
|
setPos(pos.x, pos.y, pos.z);
|
||||||
|
setBoundingBox(Box.of(pos, 1, 1, 1).stretch(0, 2, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void move(MovementType movementType, Vec3d movement) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addVelocity(double deltaX, double deltaY, double deltaZ) { }
|
||||||
|
}
|
|
@ -67,6 +67,9 @@ public interface UEntities {
|
||||||
EntityType<LootBugEntity> LOOT_BUG = register("loot_bug", FabricEntityTypeBuilder.create(SpawnGroup.MONSTER, LootBugEntity::new)
|
EntityType<LootBugEntity> LOOT_BUG = register("loot_bug", FabricEntityTypeBuilder.create(SpawnGroup.MONSTER, LootBugEntity::new)
|
||||||
.trackRangeChunks(8)
|
.trackRangeChunks(8)
|
||||||
.dimensions(EntityDimensions.fixed(0.8F, 0.6F)));
|
.dimensions(EntityDimensions.fixed(0.8F, 0.6F)));
|
||||||
|
EntityType<TentacleEntity> TENTACLE = register("tentacle", FabricEntityTypeBuilder.<TentacleEntity>create(SpawnGroup.MISC, TentacleEntity::new)
|
||||||
|
.trackRangeChunks(8)
|
||||||
|
.dimensions(EntityDimensions.fixed(0.8F, 0.8F)));
|
||||||
|
|
||||||
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
|
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
|
||||||
EntityType<T> type = builder.build();
|
EntityType<T> type = builder.build();
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in a new issue