From 2be19f95b2dc61302d35be06de81531407bec595 Mon Sep 17 00:00:00 2001 From: Leaf <80794784+leafreynolds@users.noreply.github.com> Date: Wed, 2 Jun 2021 15:30:08 +1200 Subject: [PATCH] first try of adding an entity Flame spren. basically a zelda fairy. trying to make it act kinda like a minecraft bee. Not yet working as intended. --- blockbench/SprenFlameModel.java | 74 ++ blockbench/master_sword.bbmodel | 1 + blockbench/spren_fire.bbmodel | 1 + src/main/generated/.cache/cache | 2 +- .../generated/assets/cosmere/lang/en_us.json | 2 + src/main/java/leaf/cosmere/Cosmere.java | 2 + .../java/leaf/cosmere/client/ClientSetup.java | 6 +- .../renderer/entity/SprenFlameRenderer.java | 40 ++ .../entity/model/SprenFlameModel.java | 141 ++++ .../wearables}/SpikeModel.java | 2 +- .../cosmere/entities/spren/ASprenEntity.java | 103 +++ .../entities/spren/SprenFlameEntity.java | 660 ++++++++++++++++++ .../items/curio/HemalurgicSpikeItem.java | 2 +- .../cosmere/registry/AttributesRegistry.java | 4 + .../leaf/cosmere/registry/EntityRegistry.java | 29 + .../assets/cosmere/textures/entity/spike.png | Bin 3594 -> 0 bytes .../cosmere/textures/entity/spren_flame.png | Bin 0 -> 116 bytes 17 files changed, 1065 insertions(+), 4 deletions(-) create mode 100644 blockbench/SprenFlameModel.java create mode 100644 blockbench/master_sword.bbmodel create mode 100644 blockbench/spren_fire.bbmodel create mode 100644 src/main/java/leaf/cosmere/client/renderer/entity/SprenFlameRenderer.java create mode 100644 src/main/java/leaf/cosmere/client/renderer/entity/model/SprenFlameModel.java rename src/main/java/leaf/cosmere/client/{render/model => renderer/wearables}/SpikeModel.java (99%) create mode 100644 src/main/java/leaf/cosmere/entities/spren/ASprenEntity.java create mode 100644 src/main/java/leaf/cosmere/entities/spren/SprenFlameEntity.java create mode 100644 src/main/java/leaf/cosmere/registry/EntityRegistry.java delete mode 100644 src/main/resources/assets/cosmere/textures/entity/spike.png create mode 100644 src/main/resources/assets/cosmere/textures/entity/spren_flame.png diff --git a/blockbench/SprenFlameModel.java b/blockbench/SprenFlameModel.java new file mode 100644 index 00000000..5ab9dbdf --- /dev/null +++ b/blockbench/SprenFlameModel.java @@ -0,0 +1,74 @@ +// Made with Blockbench 3.8.3 +// Exported for Minecraft version 1.15 - 1.16 +// Paste this class into your mod and generate all required imports + + +public class SprenFlameModel extends EntityModel { + private final ModelRenderer body; + private final ModelRenderer wingLeft; + private final ModelRenderer wingLeftUpper_r1; + private final ModelRenderer wingLeftLower_r1; + private final ModelRenderer wingRight; + private final ModelRenderer wingRightLower_r1; + private final ModelRenderer wingRightUpper_r1; + + public SprenFlameModel() { + textureWidth = 16; + textureHeight = 16; + + body = new ModelRenderer(this); + body.setRotationPoint(0.0F, 24.0F, 0.0F); + body.setTextureOffset(0, 0).addBox(-2.0F, -4.0F, 0.0F, 4.0F, 4.0F, 0.0F, 0.0F, false); + body.setTextureOffset(0, 0).addBox(-1.0F, -3.0F, -1.0F, 2.0F, 2.0F, 2.0F, 0.0F, false); + + wingLeft = new ModelRenderer(this); + wingLeft.setRotationPoint(0.0F, 0.0F, 0.0F); + body.addChild(wingLeft); + + + wingLeftUpper_r1 = new ModelRenderer(this); + wingLeftUpper_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingLeft.addChild(wingLeftUpper_r1); + setRotationAngle(wingLeftUpper_r1, 0.0F, 0.7854F, -0.1745F); + wingLeftUpper_r1.setTextureOffset(0, 0).addBox(1.0F, -3.75F, 1.0F, 4.0F, 3.0F, 0.0F, 0.0F, false); + + wingLeftLower_r1 = new ModelRenderer(this); + wingLeftLower_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingLeft.addChild(wingLeftLower_r1); + setRotationAngle(wingLeftLower_r1, 0.0F, 0.3491F, 0.0F); + wingLeftLower_r1.setTextureOffset(0, 0).addBox(0.5F, -1.0F, 0.0F, 3.0F, 2.0F, 0.0F, 0.0F, false); + + wingRight = new ModelRenderer(this); + wingRight.setRotationPoint(0.0F, 0.0F, 0.0F); + body.addChild(wingRight); + + + wingRightLower_r1 = new ModelRenderer(this); + wingRightLower_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingRight.addChild(wingRightLower_r1); + setRotationAngle(wingRightLower_r1, 0.0F, -0.3491F, 0.0F); + wingRightLower_r1.setTextureOffset(0, 0).addBox(-3.5F, -1.0F, 0.0F, 3.0F, 2.0F, 0.0F, 0.0F, false); + + wingRightUpper_r1 = new ModelRenderer(this); + wingRightUpper_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingRight.addChild(wingRightUpper_r1); + setRotationAngle(wingRightUpper_r1, 0.0F, -0.7854F, 0.1745F); + wingRightUpper_r1.setTextureOffset(0, 0).addBox(-5.0F, -3.75F, 1.0F, 4.0F, 3.0F, 0.0F, 0.0F, false); + } + + @Override + public void setRotationAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ + //previously the render function, render code was moved to a method below + } + + @Override + public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ + body.render(matrixStack, buffer, packedLight, packedOverlay); + } + + public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} \ No newline at end of file diff --git a/blockbench/master_sword.bbmodel b/blockbench/master_sword.bbmodel new file mode 100644 index 00000000..96a81705 --- /dev/null +++ b/blockbench/master_sword.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"3.6","creation_time":1622580956,"model_format":"java_block","box_uv":false},"name":"master_sword","parent":"forge:item/default","ambientocclusion":true,"front_gui_light":false,"visible_box":[1,1,0],"resolution":{"width":16,"height":16},"elements":[{"name":"blade","rescale":false,"from":[5.999999999999997,13,8.000000000000004],"to":[9.999999999999998,30,8.000000000000004],"autouv":0,"color":7,"locked":false,"origin":[7.999999999999998,21.5,8.000000000000004],"faces":{"north":{"uv":[0,0,3,16],"texture":0},"east":{"uv":[0,0,1,16],"texture":0},"south":{"uv":[0,0,3,16],"texture":0},"west":{"uv":[0,0,1,16],"texture":0},"up":{"uv":[0,0,1,3],"rotation":90,"texture":0},"down":{"uv":[0,0,1,3],"rotation":270,"texture":0}},"uuid":"aaf79074-d592-8e4e-a28b-df4c4687ed74"},{"name":"handguard_inner","rescale":false,"from":[5.499999999999989,9,7.000000000000005],"to":[10.499999999999991,11,9.000000000000005],"autouv":0,"color":7,"locked":false,"origin":[7.99999999999999,10,8.000000000000005],"faces":{"north":{"uv":[13,0,16,3],"texture":0},"east":{"uv":[13,0,16,1],"texture":0},"south":{"uv":[13,0,16,3],"texture":0},"west":{"uv":[13,0,16,1],"texture":0},"up":{"uv":[13,0,16,3],"rotation":270,"texture":0},"down":{"uv":[13,0,16,3],"rotation":90,"texture":0}},"uuid":"a5ffbf16-796c-1a30-5ed1-f1d7d469cbbb"},{"name":"pommel","rescale":false,"from":[6,0,8.000000000000005],"to":[10,3,8.000000000000005],"autouv":0,"color":7,"locked":false,"origin":[8,1.5,8.000000000000005],"faces":{"north":{"uv":[13,12,16,16],"texture":0},"east":{"uv":[13,14,16,16],"texture":0},"south":{"uv":[13,12,16,16],"texture":0},"west":{"uv":[13,14,16,16],"texture":0},"up":{"uv":[13,11,16,14],"texture":0},"down":{"uv":[13,11,16,14],"texture":0}},"uuid":"bc97d4b7-36ef-852f-dec5-55ea442c2128"},{"name":"blade","rescale":false,"from":[6.9999999999999964,12,7.500000000000005],"to":[8.999999999999996,31,8.500000000000005],"autouv":0,"color":7,"locked":false,"origin":[7.9999999999999964,21.5,8.000000000000005],"faces":{"north":{"uv":[0,0,2,16],"texture":0},"east":{"uv":[0,0,1,16],"texture":0},"south":{"uv":[0,0,2,16],"texture":0},"west":{"uv":[0,0,1,16],"texture":0},"up":{"uv":[0,0,1,2],"rotation":90,"texture":0},"down":{"uv":[0,0,1,2],"rotation":270,"texture":0}},"uuid":"fb1e8b98-517b-5524-cdea-9b2caeeaa4a0"},{"name":"handguard_inner","rescale":false,"from":[6,11,7.500000000000005],"to":[10.000000000000002,12,8.500000000000005],"autouv":0,"color":7,"locked":false,"origin":[8,11.5,8.000000000000005],"faces":{"north":{"uv":[13,0,16,1],"texture":0},"east":{"uv":[13,0,16,1],"texture":0},"south":{"uv":[13,0,16,1],"texture":0},"west":{"uv":[13,0,16,1],"texture":0},"up":{"uv":[13,0,16,3],"rotation":270,"texture":0},"down":{"uv":[13,0,16,3],"rotation":90,"texture":0}},"uuid":"883a5785-e5e6-c31c-e221-c7cb0c5f33bf"},{"name":"handguard_inner","rescale":false,"from":[4,9.250000000000004,7.500000000000005],"to":[12.000000000000002,10.250000000000004,8.500000000000005],"autouv":0,"color":7,"locked":false,"origin":[8,9.750000000000004,8.000000000000005],"faces":{"north":{"uv":[13,0,16,1],"texture":0},"east":{"uv":[13,0,16,1],"texture":0},"south":{"uv":[13,0,16,1],"texture":0},"west":{"uv":[13,0,16,1],"texture":0},"up":{"uv":[13,0,16,3],"rotation":270,"texture":0},"down":{"uv":[13,0,16,3],"rotation":90,"texture":0}},"uuid":"aa42abed-b866-408e-11f1-626ee673c252"},{"name":"handle","rescale":false,"from":[7.5123685207504,2,7.470139749457896],"to":[8.5123685207504,9,8.470139749457896],"autouv":0,"color":6,"locked":false,"rotation":[0,45,0],"origin":[8.012368520750398,5.5,7.970139749457895],"faces":{"north":{"uv":[5,8,6,15],"texture":0},"east":{"uv":[5,8,6,15],"texture":0},"south":{"uv":[5,8,6,15],"texture":0},"west":{"uv":[5,8,6,15],"texture":0},"up":{"uv":[5,8,6,9],"rotation":90,"texture":0},"down":{"uv":[5,9,6,10],"rotation":270,"texture":0}},"uuid":"0731ae31-28f7-d982-a3e4-805690efc839"},{"name":"handle","rescale":false,"from":[7.499999999999997,2,7.500000000000005],"to":[8.499999999999998,9,8.500000000000005],"autouv":0,"color":6,"locked":false,"origin":[7.999999999999998,5.5,8.000000000000005],"faces":{"north":{"uv":[5,8,6,15],"texture":0},"east":{"uv":[5,8,6,15],"texture":0},"south":{"uv":[5,8,6,15],"texture":0},"west":{"uv":[5,8,6,15],"texture":0},"up":{"uv":[5,8,6,9],"texture":0},"down":{"uv":[5,9,6,10],"texture":0}},"uuid":"96fefb0e-5486-4393-d862-bffd945afee4"},{"name":"pommel","rescale":false,"from":[3,9.5,8.000000000000005],"to":[5,11.5,8.000000000000005],"autouv":0,"color":7,"locked":false,"origin":[4,10.5,8.000000000000005],"faces":{"north":{"uv":[13,13,15,15],"texture":0},"east":{"uv":[13,14,16,16],"texture":0},"south":{"uv":[14,13,16,15],"texture":0},"west":{"uv":[13,14,16,16],"texture":0},"up":{"uv":[13,11,16,14],"texture":0},"down":{"uv":[13,11,16,14],"texture":0}},"uuid":"12e58443-e2c0-5f50-f9aa-21160e16e7db"},{"name":"pommel","rescale":false,"from":[11,9.5,8.000000000000005],"to":[13,11.5,8.000000000000005],"autouv":0,"color":7,"locked":false,"origin":[12,10.5,8.000000000000005],"faces":{"north":{"uv":[14,13,16,15],"texture":0},"east":{"uv":[13,14,16,16],"texture":0},"south":{"uv":[13,13,15,15],"texture":0},"west":{"uv":[13,14,16,16],"texture":0},"up":{"uv":[13,11,16,14],"rotation":180,"texture":0},"down":{"uv":[13,11,16,14],"rotation":180,"texture":0}},"uuid":"e775309d-8d24-b350-1447-2e553965117f"}],"outliner":[{"name":"blade","origin":[8,8,8],"uuid":"beb6a69e-5040-5673-3714-d017e0029a6f","export":true,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["aaf79074-d592-8e4e-a28b-df4c4687ed74","fb1e8b98-517b-5524-cdea-9b2caeeaa4a0","a5ffbf16-796c-1a30-5ed1-f1d7d469cbbb","883a5785-e5e6-c31c-e221-c7cb0c5f33bf","aa42abed-b866-408e-11f1-626ee673c252","0731ae31-28f7-d982-a3e4-805690efc839","96fefb0e-5486-4393-d862-bffd945afee4","bc97d4b7-36ef-852f-dec5-55ea442c2128","12e58443-e2c0-5f50-f9aa-21160e16e7db","e775309d-8d24-b350-1447-2e553965117f"]}],"textures":[{"path":"","name":"Shardblade_blue","folder":"block","namespace":"","id":"1","particle":true,"visible":true,"mode":"bitmap","saved":false,"uuid":"db0555e9-6e9e-c8b2-f6e1-d38f4235504d","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsElEQVQ4T2N88vL/fwYGBoab104xODuaM4LYhIC1Wx5YDwgwkmvA3GmcDMlZ38k3AMUFIOeDALFeQPYi2AuD1wAnJyd4aO/btw9rDNHGC55hnf+3ryonKk1gdQHFBoBS2tFdk4hzwd79J+EBBUsHhFyAHLiM5BgAciH7nysMP1l0GLAaQMgLGJmpu7udwc/bGZ6UCXkBJP/pw1MGPgFpBsb8kjZwGCAbQCg7g+RhlgAASjKeoxXtPPAAAAAASUVORK5CYII="}],"display":{"thirdperson_righthand":{"rotation":[0,90,0],"translation":[-0.5,0.75,0]},"thirdperson_lefthand":{"rotation":[0,90,0],"translation":[-0.5,0.75,0]},"firstperson_righthand":{"rotation":[0,90,0]},"firstperson_lefthand":{"rotation":[0,90,0]},"ground":{"translation":[0,4,0]},"gui":{"rotation":[0,0,-45],"translation":[-3.5,-3.5,-2],"scale":[0.67,0.67,0.67]},"head":{"rotation":[50,0,0],"translation":[0,2.75,0]},"fixed":{"rotation":[0,0,46],"translation":[4.5,-3.75,-1.25],"scale":[0.78,0.78,0.78]}}} \ No newline at end of file diff --git a/blockbench/spren_fire.bbmodel b/blockbench/spren_fire.bbmodel new file mode 100644 index 00000000..fe363375 --- /dev/null +++ b/blockbench/spren_fire.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"3.6","creation_time":1622597082,"model_format":"modded_entity","box_uv":true},"name":"SprenFlameModel","geometry_name":"SprenFlameModel","modded_entity_version":"1.15","visible_box":[1,1,0],"layered_textures":false,"resolution":{"width":16,"height":16},"elements":[{"name":"body","rescale":false,"from":[-1,1,-1],"to":[1,3,1],"autouv":1,"color":1,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[2,2,4,4],"texture":0},"east":{"uv":[0,2,2,4],"texture":0},"south":{"uv":[6,2,8,4],"texture":0},"west":{"uv":[4,2,6,4],"texture":0},"up":{"uv":[4,2,2,0],"texture":0},"down":{"uv":[6,0,4,2],"texture":0}},"uuid":"76456099-bf80-da7d-c86c-3e64e97c9b8d"},{"name":"shine","rescale":false,"from":[-2,0,0],"to":[2,4,0],"autouv":1,"color":7,"locked":false,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,4,4],"texture":0},"east":{"uv":[0,0,0,4],"texture":null},"south":{"uv":[4,0,8,4],"texture":0},"west":{"uv":[4,0,4,4],"texture":null},"up":{"uv":[4,0,0,0],"texture":null},"down":{"uv":[8,0,4,0],"texture":null}},"uuid":"e28a7c06-90aa-4575-1208-6b2714fd258c"},{"name":"wingLeftUpper","rescale":false,"from":[-5,0.75,1],"to":[-1,3.75,1],"autouv":0,"color":3,"locked":false,"rotation":[0,-45,-10],"origin":[0,0,0],"faces":{"north":{"uv":[0,0,4,3],"texture":0},"east":{"uv":[0,0,0,3],"texture":null},"south":{"uv":[4,0,8,3],"texture":0},"west":{"uv":[4,0,4,3],"texture":null},"up":{"uv":[4,0,0,0],"texture":null},"down":{"uv":[8,0,4,0],"texture":null}},"uuid":"efc5a28f-b378-2f8c-f3ab-ac469e9dd76a"},{"name":"wingLeftLower","rescale":false,"from":[-3.5,-1,0],"to":[-0.5,1,0],"autouv":0,"color":3,"locked":false,"rotation":[0,-20,0],"origin":[0,0,0],"faces":{"north":{"uv":[0,0,3,2],"texture":0},"east":{"uv":[0,0,0,2],"texture":null},"south":{"uv":[3,0,6,2],"texture":0},"west":{"uv":[3,0,3,2],"texture":null},"up":{"uv":[3,0,0,0],"texture":null},"down":{"uv":[6,0,3,0],"texture":null}},"uuid":"8ed175c2-6275-2364-2a0f-27ec59dd7f1e"},{"name":"wingRightLower","rescale":false,"from":[0.5,-1,0],"to":[3.5,1,0],"autouv":1,"color":3,"locked":false,"rotation":[0,20,0],"origin":[0,0,0],"faces":{"north":{"uv":[0,0,3,2],"texture":0},"east":{"uv":[0,0,0,2],"texture":null},"south":{"uv":[3,0,6,2],"texture":0},"west":{"uv":[3,0,3,2],"texture":null},"up":{"uv":[3,0,0,0],"texture":null},"down":{"uv":[6,0,3,0],"texture":null}},"uuid":"0e9a6c15-eb66-f416-2f3d-e765a2af7d15"},{"name":"wingRightUpper","rescale":false,"from":[1,0.75,1],"to":[5,3.75,1],"autouv":1,"color":3,"locked":false,"rotation":[0,45,10],"origin":[0,0,0],"faces":{"north":{"uv":[0,0,4,3],"texture":0},"east":{"uv":[0,0,0,3],"texture":null},"south":{"uv":[4,0,8,3],"texture":0},"west":{"uv":[4,0,4,3],"texture":null},"up":{"uv":[4,0,0,0],"texture":null},"down":{"uv":[8,0,4,0],"texture":null}},"uuid":"61d19791-1533-5adc-2150-1c2b8d078428"}],"outliner":[{"name":"body","origin":[0,0,0],"uuid":"68bafcc8-aa5d-7fce-2ecc-65ebdae04cc0","export":true,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["e28a7c06-90aa-4575-1208-6b2714fd258c","76456099-bf80-da7d-c86c-3e64e97c9b8d",{"name":"wingLeft","origin":[0,0,0],"uuid":"d6df0177-9765-a781-64a7-7d03cd044f0b","export":true,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["8ed175c2-6275-2364-2a0f-27ec59dd7f1e","efc5a28f-b378-2f8c-f3ab-ac469e9dd76a"]},{"name":"wingRight","origin":[0,0,0],"uuid":"05622feb-c442-384d-0344-83e77361c874","export":true,"isOpen":false,"locked":false,"visibility":true,"autouv":0,"children":["61d19791-1533-5adc-2150-1c2b8d078428","0e9a6c15-eb66-f416-2f3d-e765a2af7d15"]}]}],"textures":[{"path":"E:\\Repo\\LabDay\\Minecraft\\cosmere\\src\\main\\resources\\assets\\cosmere\\textures\\entity\\firespren.png","name":"firespren.png","folder":"entity","namespace":"cosmere","id":"0","particle":false,"visible":true,"mode":"bitmap","saved":true,"uuid":"d91cae4f-85f7-fdf6-90bc-7d2980ed15dc","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAO0lEQVQ4T2M8nWLznwEPMJl9mKGi+S5OFYzDwID////jDQOQ5/GGwdAwILtgMu5oJMYLowYwMAzzMAAAd1hZl8Uc/pMAAAAASUVORK5CYII="}]} \ No newline at end of file diff --git a/src/main/generated/.cache/cache b/src/main/generated/.cache/cache index 1eee98e2..cf19539c 100644 --- a/src/main/generated/.cache/cache +++ b/src/main/generated/.cache/cache @@ -30,7 +30,7 @@ edaa7877000a497242bfd5901b6773cfa26fc309 assets/cosmere/blockstates/tin_block.js b118f65ac1078511bdff353013a20ebe62732b22 assets/cosmere/blockstates/tin_ore.json edaa7877000a497242bfd5901b6773cfa26fc309 assets/cosmere/blockstates/zinc_block.json b118f65ac1078511bdff353013a20ebe62732b22 assets/cosmere/blockstates/zinc_ore.json -1d56a6a8128ca5b3d38fb47c6061caf4cc5515cf assets/cosmere/lang/en_us.json +36eca81a90d2cd07b2a287cd22cedf54a038d66d assets/cosmere/lang/en_us.json e9fe228cb639a8823d11fe37d1d1b079e9bd4cb7 assets/cosmere/models/block/gem_block.json b66394816822b5feda05810c580e11ddb986f4a0 assets/cosmere/models/block/metal_block.json 645553d67807b60210c1bfae147ccd31ec88eaf0 assets/cosmere/models/block/ore_block.json diff --git a/src/main/generated/assets/cosmere/lang/en_us.json b/src/main/generated/assets/cosmere/lang/en_us.json index 4d91a38a..3d7aadb3 100644 --- a/src/main/generated/assets/cosmere/lang/en_us.json +++ b/src/main/generated/assets/cosmere/lang/en_us.json @@ -72,6 +72,7 @@ "effect.cosmere.tapping_steel": "Tapping Steel", "effect.cosmere.tapping_tin": "Tapping Tin", "effect.cosmere.tapping_zinc": "Tapping Zinc", + "entity.cosmere.spren_flame": "Spren Flame", "gui.cosmere.button.back": "Back", "gui.cosmere.cancel": "> Cancel", "gui.cosmere.confirm": "> Confirm", @@ -214,6 +215,7 @@ "item.cosmere.steel_nugget": "Steel Nugget", "item.cosmere.steel_ring_metalmind": "Steel Ring Metalmind", "item.cosmere.steel_spike": "Steel Spike", + "item.cosmere.test_blade": "Test Blade", "item.cosmere.tin_bracelet_metalmind": "Tin Bracelet Metalmind", "item.cosmere.tin_ingot": "Tin Ingot", "item.cosmere.tin_necklace_metalmind": "Tin Necklace Metalmind", diff --git a/src/main/java/leaf/cosmere/Cosmere.java b/src/main/java/leaf/cosmere/Cosmere.java index adc1942b..d8138d24 100644 --- a/src/main/java/leaf/cosmere/Cosmere.java +++ b/src/main/java/leaf/cosmere/Cosmere.java @@ -49,6 +49,7 @@ public Cosmere() LootModifierRegistry.LOOT_MODIFIERS.register(modBus); ManifestationRegistry.MANIFESTATIONS.register(modBus); AttributesRegistry.ATTRIBUTES.register(modBus); + EntityRegistry.ENTITIES.register(modBus); FeatureRegistry.FEATURES.register(modBus); RecipeRegistry.SPECIAL_RECIPES.register(modBus); @@ -66,6 +67,7 @@ private void commonSetup(FMLCommonSetupEvent event) event.enqueueWork(() -> { FeatureRegistry.registerConfiguredFeatures(); + EntityRegistry.PrepareEntityAttributes(); }); //Entity Caps diff --git a/src/main/java/leaf/cosmere/client/ClientSetup.java b/src/main/java/leaf/cosmere/client/ClientSetup.java index 037d30ab..633febb0 100644 --- a/src/main/java/leaf/cosmere/client/ClientSetup.java +++ b/src/main/java/leaf/cosmere/client/ClientSetup.java @@ -6,11 +6,12 @@ import leaf.cosmere.Cosmere; import leaf.cosmere.client.gui.SpriteIconPositioning; +import leaf.cosmere.client.renderer.entity.*; import leaf.cosmere.constants.Metals; +import leaf.cosmere.registry.*; import leaf.cosmere.utils.helpers.LogHelper; import leaf.cosmere.utils.helpers.ResourceLocationHelper; import leaf.cosmere.manifestation.AManifestation; -import leaf.cosmere.registry.ManifestationRegistry; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; @@ -22,6 +23,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.client.registry.*; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -51,6 +53,8 @@ public static void init(final FMLClientSetupEvent event) RenderTypeLookup.setRenderLayer(metalType.getOreBlock(), cutoutMipped); } + RenderingRegistry.registerEntityRenderingHandler(EntityRegistry.SPREN_FIRE.get(), SprenFlameRenderer::new); + LogHelper.info("Client setup complete!"); } diff --git a/src/main/java/leaf/cosmere/client/renderer/entity/SprenFlameRenderer.java b/src/main/java/leaf/cosmere/client/renderer/entity/SprenFlameRenderer.java new file mode 100644 index 00000000..25f46728 --- /dev/null +++ b/src/main/java/leaf/cosmere/client/renderer/entity/SprenFlameRenderer.java @@ -0,0 +1,40 @@ +package leaf.cosmere.client.renderer.entity; + +import com.mojang.blaze3d.matrix.*; +import leaf.cosmere.client.renderer.entity.model.*; +import leaf.cosmere.entities.spren.*; +import leaf.cosmere.utils.helpers.*; +import net.minecraft.client.renderer.entity.*; +import net.minecraft.util.*; +import net.minecraft.util.math.MathHelper; +import net.minecraftforge.api.distmarker.*; + +@OnlyIn(Dist.CLIENT) +public class SprenFlameRenderer extends MobRenderer> +{ + private static final ResourceLocation FIRE_SPREN_TEXTURES = ResourceLocationHelper.prefix("textures/entity/spren_flame.png"); + + public SprenFlameRenderer(EntityRendererManager renderManagerIn) + { + super(renderManagerIn, new SprenFlameModel(), 0.25F); + } + + /** + * Returns the location of an entity's texture. + */ + public ResourceLocation getEntityTexture(SprenFlameEntity entity) + { + return FIRE_SPREN_TEXTURES; + } + + protected void preRenderCallback(SprenFlameEntity entitylivingbaseIn, MatrixStack matrixStackIn, float partialTickTime) + { + matrixStackIn.scale(0.8F, 0.8F, 0.8F); + } + + protected void applyRotations(SprenFlameEntity entityLiving, MatrixStack matrixStackIn, float ageInTicks, float rotationYaw, float partialTicks) + { + matrixStackIn.translate(0.0D, (double) (MathHelper.cos(ageInTicks * 0.3F) * 0.1F), 0.0D); + super.applyRotations(entityLiving, matrixStackIn, ageInTicks, rotationYaw, partialTicks); + } +} \ No newline at end of file diff --git a/src/main/java/leaf/cosmere/client/renderer/entity/model/SprenFlameModel.java b/src/main/java/leaf/cosmere/client/renderer/entity/model/SprenFlameModel.java new file mode 100644 index 00000000..db01c042 --- /dev/null +++ b/src/main/java/leaf/cosmere/client/renderer/entity/model/SprenFlameModel.java @@ -0,0 +1,141 @@ +package leaf.cosmere.client.renderer.entity.model;// Made with Blockbench 3.8.3 +// Exported for Minecraft version 1.15 - 1.16 +// Paste this class into your mod and generate all required imports + + +import com.google.common.collect.*; +import com.mojang.blaze3d.matrix.*; +import com.mojang.blaze3d.vertex.*; +import leaf.cosmere.entities.spren.*; +import net.minecraft.client.renderer.entity.model.*; +import net.minecraft.client.renderer.model.*; +import net.minecraft.entity.*; +import net.minecraft.entity.passive.*; +import net.minecraft.util.math.*; + +public class SprenFlameModel extends AgeableModel +{ + private final ModelRenderer body; + private final ModelRenderer wingLeft; + private final ModelRenderer wingLeftUpper_r1; + private final ModelRenderer wingLeftLower_r1; + private final ModelRenderer wingRight; + private final ModelRenderer wingRightLower_r1; + private final ModelRenderer wingRightUpper_r1; + + private float bodyPitch; + + public SprenFlameModel() + { + textureWidth = 16; + textureHeight = 16; + + body = new ModelRenderer(this); + body.setRotationPoint(0.0F, 24.0F, 0.0F); + body.setTextureOffset(0, 0).addBox(-2.0F, -4.0F, 0.0F, 4.0F, 4.0F, 0.0F, 0.0F, false); + body.setTextureOffset(0, 0).addBox(-1.0F, -3.0F, -1.0F, 2.0F, 2.0F, 2.0F, 0.0F, false); + + wingLeft = new ModelRenderer(this); + wingLeft.setRotationPoint(0.0F, 0.0F, 0.0F); + body.addChild(wingLeft); + + + wingLeftUpper_r1 = new ModelRenderer(this); + wingLeftUpper_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingLeft.addChild(wingLeftUpper_r1); + setRotationAngle(wingLeftUpper_r1, 0.0F, 0.7854F, -0.1745F); + wingLeftUpper_r1.setTextureOffset(0, 0).addBox(1.0F, -3.75F, 1.0F, 4.0F, 3.0F, 0.0F, 0.0F, false); + + wingLeftLower_r1 = new ModelRenderer(this); + wingLeftLower_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingLeft.addChild(wingLeftLower_r1); + setRotationAngle(wingLeftLower_r1, 0.0F, 0.3491F, 0.0F); + wingLeftLower_r1.setTextureOffset(0, 0).addBox(0.5F, -1.0F, 0.0F, 3.0F, 2.0F, 0.0F, 0.0F, false); + + wingRight = new ModelRenderer(this); + wingRight.setRotationPoint(0.0F, 0.0F, 0.0F); + body.addChild(wingRight); + + + wingRightLower_r1 = new ModelRenderer(this); + wingRightLower_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingRight.addChild(wingRightLower_r1); + setRotationAngle(wingRightLower_r1, 0.0F, -0.3491F, 0.0F); + wingRightLower_r1.setTextureOffset(0, 0).addBox(-3.5F, -1.0F, 0.0F, 3.0F, 2.0F, 0.0F, 0.0F, false); + + wingRightUpper_r1 = new ModelRenderer(this); + wingRightUpper_r1.setRotationPoint(0.0F, 0.0F, 0.0F); + wingRight.addChild(wingRightUpper_r1); + setRotationAngle(wingRightUpper_r1, 0.0F, -0.7854F, 0.1745F); + wingRightUpper_r1.setTextureOffset(0, 0).addBox(-5.0F, -3.75F, 1.0F, 4.0F, 3.0F, 0.0F, 0.0F, false); + } + + @Override + public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) + { + this.wingRight.rotateAngleX = 0.0F; + + this.body.rotateAngleX = 0.0F; + this.body.rotationPointY = 19.0F; + + boolean flag = entityIn.isOnGround() && entityIn.getMotion().lengthSquared() < 1.0E-7D; + if (flag) + { + this.wingRight.rotateAngleY = -0.2618F; + this.wingRight.rotateAngleZ = 0.0F; + this.wingLeft.rotateAngleX = 0.0F; + this.wingLeft.rotateAngleY = 0.2618F; + this.wingLeft.rotateAngleZ = 0.0F; + } + else + { + float f = ageInTicks * 2.1F; + this.wingRight.rotateAngleY = 0.0F; + this.wingRight.rotateAngleZ = MathHelper.cos(f) * (float) Math.PI * 0.15F; + this.wingLeft.rotateAngleX = this.wingRight.rotateAngleX; + this.wingLeft.rotateAngleY = this.wingRight.rotateAngleY; + this.wingLeft.rotateAngleZ = -this.wingRight.rotateAngleZ; + this.body.rotateAngleX = 0.0F; + this.body.rotateAngleY = 180.0F; + this.body.rotateAngleZ = 0.0F; + } + + + if (this.bodyPitch > 0.0F) + { + this.body.rotateAngleX = ModelUtils.func_228283_a_(this.body.rotateAngleX, 3.0915928F, this.bodyPitch); + } + } + + @Override + public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) + { + body.render(matrixStack, buffer, packedLight, packedOverlay); + } + + @Override + protected Iterable getHeadParts() + { + return ImmutableList.of(); + } + + + @Override + protected Iterable getBodyParts() + { + return ImmutableList.of(this.body); + } + + public void setLivingAnimations(T entityIn, float limbSwing, float limbSwingAmount, float partialTick) + { + super.setLivingAnimations(entityIn, limbSwing, limbSwingAmount, partialTick); + this.bodyPitch = entityIn.getBodyPitch(partialTick); + } + + public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} \ No newline at end of file diff --git a/src/main/java/leaf/cosmere/client/render/model/SpikeModel.java b/src/main/java/leaf/cosmere/client/renderer/wearables/SpikeModel.java similarity index 99% rename from src/main/java/leaf/cosmere/client/render/model/SpikeModel.java rename to src/main/java/leaf/cosmere/client/renderer/wearables/SpikeModel.java index 4a1b17c0..c104b119 100644 --- a/src/main/java/leaf/cosmere/client/render/model/SpikeModel.java +++ b/src/main/java/leaf/cosmere/client/renderer/wearables/SpikeModel.java @@ -9,7 +9,7 @@ * */ -package leaf.cosmere.client.render.model; +package leaf.cosmere.client.renderer.wearables; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; diff --git a/src/main/java/leaf/cosmere/entities/spren/ASprenEntity.java b/src/main/java/leaf/cosmere/entities/spren/ASprenEntity.java new file mode 100644 index 00000000..f3d8a342 --- /dev/null +++ b/src/main/java/leaf/cosmere/entities/spren/ASprenEntity.java @@ -0,0 +1,103 @@ +package leaf.cosmere.entities.spren; + +import leaf.cosmere.registry.*; +import net.minecraft.entity.*; +import net.minecraft.entity.ai.*; +import net.minecraft.entity.ai.goal.*; +import net.minecraft.entity.passive.*; +import net.minecraft.util.math.*; +import net.minecraft.util.math.vector.*; +import net.minecraft.world.*; + +import javax.annotation.*; +import java.util.*; + +public abstract class ASprenEntity extends AnimalEntity implements IFlyingAnimal +{ + protected ASprenEntity(EntityType type, World worldIn) + { + super(type, worldIn); + } + + public CreatureAttribute getCreatureAttribute() + { + return AttributesRegistry.SPREN; + } + + + public class WanderGoal extends Goal + { + WanderGoal() + { + this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); + } + + /** + * Returns whether execution should begin. You can also read and cache any state necessary for execution in this + * method as well. + */ + public boolean shouldExecute() + { + return ASprenEntity.this.navigator.noPath() && ASprenEntity.this.rand.nextInt(10) == 0; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean shouldContinueExecuting() + { + return ASprenEntity.this.navigator.hasPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + Vector3d vector3d = this.getRandomLocation(); + if (vector3d != null) + { + ASprenEntity.this.navigator.setPath(ASprenEntity.this.navigator.getPathToPos(new BlockPos(vector3d), 1), 1.0D); + } + + } + + @Nullable + private Vector3d getRandomLocation() + { + Vector3d vector3d = ASprenEntity.this.getLook(0.0F); + + Vector3d vector3d2 = RandomPositionGenerator.findAirTarget(ASprenEntity.this, 8, 7, vector3d, ((float) Math.PI / 2F), 2, 1); + return vector3d2 != null ? vector3d2 : RandomPositionGenerator.findGroundTarget(ASprenEntity.this, 8, 4, -2, vector3d, (double) ((float) Math.PI / 2F)); + } + } + + protected abstract class PassiveGoal extends Goal + { + public PassiveGoal() + { + + } + + public abstract boolean canSprenStart(); + + public abstract boolean canSprenContinue(); + + /** + * Returns whether execution should begin. You can also read and cache any state necessary for execution in this + * method as well. + */ + public boolean shouldExecute() + { + return this.canSprenStart(); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean shouldContinueExecuting() + { + return this.canSprenContinue(); + } + } +} diff --git a/src/main/java/leaf/cosmere/entities/spren/SprenFlameEntity.java b/src/main/java/leaf/cosmere/entities/spren/SprenFlameEntity.java new file mode 100644 index 00000000..172b484b --- /dev/null +++ b/src/main/java/leaf/cosmere/entities/spren/SprenFlameEntity.java @@ -0,0 +1,660 @@ +package leaf.cosmere.entities.spren; + +import com.google.common.collect.*; +import leaf.cosmere.registry.*; +import net.minecraft.block.*; +import net.minecraft.entity.*; +import net.minecraft.entity.ai.*; +import net.minecraft.entity.ai.attributes.*; +import net.minecraft.entity.ai.controller.*; +import net.minecraft.entity.ai.goal.*; +import net.minecraft.fluid.*; +import net.minecraft.item.*; +import net.minecraft.item.crafting.*; +import net.minecraft.nbt.*; +import net.minecraft.network.datasync.*; +import net.minecraft.particles.*; +import net.minecraft.pathfinding.*; +import net.minecraft.tags.*; +import net.minecraft.util.*; +import net.minecraft.util.math.*; +import net.minecraft.util.math.vector.*; +import net.minecraft.world.*; +import net.minecraft.world.server.*; +import net.minecraftforge.api.distmarker.*; + +import javax.annotation.*; +import java.util.*; + +public class SprenFlameEntity extends ASprenEntity +{ + private static final DataParameter DATA_FLAGS_ID = EntityDataManager.createKey(SprenFlameEntity.class, DataSerializers.BYTE); + + private float rollAmount; + private float rollAmountO; + + private int stayOutOfFireCountdown; + + private int remainingCooldownBeforeLocatingNewFire = 0; + private int remainingCooldownBeforeLocatingNewFlower = 0; + + @Nullable + private BlockPos firePos = null; + + private MoveToFireGoal moveToFireGoal; + + private int underWaterTicks; + + public SprenFlameEntity(EntityType type, World worldIn) + { + super(type, worldIn); + this.moveController = new FlyingMovementController(this, 20, true); + this.lookController = new LookController(this); + this.setPathPriority(PathNodeType.WATER, -1.0F); + this.setPathPriority(PathNodeType.WATER_BORDER, 16.0F); + this.setPathPriority(PathNodeType.COCOA, -1.0F); + this.setPathPriority(PathNodeType.FENCE, -1.0F); + } + + @Override + public boolean isImmuneToFire() + { + return true; + } + + protected void registerData() + { + super.registerData(); + this.dataManager.register(DATA_FLAGS_ID, (byte) 0); + } + + public static AttributeModifierMap.MutableAttribute prepareAttributes() + { + return MobEntity.func_233666_p_() + .createMutableAttribute(Attributes.MAX_HEALTH, 10.0D) + .createMutableAttribute(Attributes.FLYING_SPEED, 0.6F) + .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.3F) + .createMutableAttribute(Attributes.ATTACK_DAMAGE, 2.0D) + .createMutableAttribute(Attributes.FOLLOW_RANGE, 48.0D); + } + + public float getBlockPathWeight(BlockPos pos, IWorldReader worldIn) + { + return worldIn.getBlockState(pos).isAir() ? 10.0F : 0.0F; + } + + protected void registerGoals() + { + this.goalSelector.addGoal(1, new SprenFlameEntity.EnterFireGoal()); + this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D)); + this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.fromItems(Items.TORCH, Items.SOUL_TORCH), false)); + this.goalSelector.addGoal(5, new FollowParentGoal(this, 1.25D)); + + this.goalSelector.addGoal(5, new SprenFlameEntity.UpdateFireGoal()); + + this.moveToFireGoal = new MoveToFireGoal(); + this.goalSelector.addGoal(5, this.moveToFireGoal); + + this.goalSelector.addGoal(8, new SprenFlameEntity.WanderGoal()); + + this.goalSelector.addGoal(9, new SwimGoal(this)); + } + + public void writeAdditional(CompoundNBT compound) + { + super.writeAdditional(compound); + + if (this.hasFire()) + { + compound.put("FirePos", NBTUtil.writeBlockPos(this.getFirePos())); + } + + compound.putInt("CannotEnterFireTicks", this.stayOutOfFireCountdown); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readAdditional(CompoundNBT compound) + { + this.firePos = null; + if (compound.contains("FirePos")) + { + this.firePos = NBTUtil.readBlockPos(compound.getCompound("FirePos")); + } + + this.stayOutOfFireCountdown = compound.getInt("CannotEnterFireTicks"); + } + + + /** + * Called to update the entity's position/logic. + */ + public void tick() + { + super.tick(); + if (this.rand.nextFloat() < 0.05F) + { + for (int i = 0; i < this.rand.nextInt(2) + 1; ++i) + { + this.addParticle(this.world, + this.getPosX() - (double) 0.3F, + this.getPosX() + (double) 0.3F, + this.getPosZ() - (double) 0.3F, + this.getPosZ() + (double) 0.3F, + this.getPosYHeight(0.5D)); + } + } + + this.updateBodyPitch(); + } + + private void addParticle(World worldIn, double p_226397_2_, double p_226397_4_, double p_226397_6_, double p_226397_8_, double posY) + { + worldIn.addParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, MathHelper.lerp(worldIn.rand.nextDouble(), p_226397_2_, p_226397_4_), posY, MathHelper.lerp(worldIn.rand.nextDouble(), p_226397_6_, p_226397_8_), 0.0D, 0.0D, 0.0D); + } + + private void startMovingTo(BlockPos pos) + { + Vector3d vector3d = Vector3d.copyCenteredHorizontally(pos); + int i = 0; + BlockPos blockpos = this.getPosition(); + int j = (int) vector3d.y - blockpos.getY(); + if (j > 2) + { + i = 4; + } + else if (j < -2) + { + i = -4; + } + + int k = 6; + int l = 8; + int i1 = blockpos.manhattanDistance(pos); + if (i1 < 15) + { + k = i1 / 2; + l = i1 / 2; + } + + Vector3d vector3d1 = RandomPositionGenerator.func_226344_b_(this, k, l, i, vector3d, (float) Math.PI / 10F); + if (vector3d1 != null) + { + this.navigator.setSearchDepthMultiplier(0.5F); + this.navigator.tryMoveToXYZ(vector3d1.x, vector3d1.y, vector3d1.z, 1.0D); + } + } + + + private boolean canEnterFire() + { + return (this.stayOutOfFireCountdown <= 0) || (this.world.isRaining() || this.world.isNightTime()); + } + + @OnlyIn(Dist.CLIENT) + public float getBodyPitch(float p_226455_1_) + { + return MathHelper.lerp(p_226455_1_, this.rollAmountO, this.rollAmount); + } + + private void updateBodyPitch() + { + this.rollAmountO = this.rollAmount; + this.rollAmount = Math.max(0.0F, this.rollAmount - 0.24F); + } + + protected void updateAITasks() + { + if (this.isInWaterOrBubbleColumn()) + { + ++this.underWaterTicks; + } + else + { + this.underWaterTicks = 0; + } + + if (this.underWaterTicks > 20) + { + this.attackEntityFrom(DamageSource.DROWN, 10.0F); + } + + } + + public boolean hasFire() + { + return this.firePos != null; + } + + @Nullable + public BlockPos getFirePos() + { + return this.firePos; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void livingTick() + { + super.livingTick(); + if (!this.world.isRemote) + { + if (this.stayOutOfFireCountdown > 0) + { + --this.stayOutOfFireCountdown; + } + + if (this.remainingCooldownBeforeLocatingNewFire > 0) + { + --this.remainingCooldownBeforeLocatingNewFire; + } + + if (this.remainingCooldownBeforeLocatingNewFlower > 0) + { + --this.remainingCooldownBeforeLocatingNewFlower; + } + + if (this.ticksExisted % 20 == 0 && !this.isFireValid()) + { + this.firePos = null; + } + } + + } + + private boolean isFireValid() + { + if (!this.hasFire()) + { + return false; + } + else + { + return this.world.getBlockState(this.firePos).getBlock() == Blocks.FIRE; + } + } + + private boolean isTooFar(BlockPos pos) + { + return !this.isWithinDistance(pos, 32); + } + + /** + * Returns new PathNavigateGround instance + */ + protected PathNavigator createNavigator(World worldIn) + { + FlyingPathNavigator flyingpathnavigator = new FlyingPathNavigator(this, worldIn) + { + public boolean canEntityStandOnPos(BlockPos pos) + { + return !this.world.getBlockState(pos.down()).isAir(); + } + + public void tick() + { + super.tick(); + } + }; + flyingpathnavigator.setCanOpenDoors(false); + flyingpathnavigator.setCanSwim(false); + flyingpathnavigator.setCanEnterDoors(true); + return flyingpathnavigator; + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack.getItem().isIn(ItemTags.FLOWERS); + } + + protected void playStepSound(BlockPos pos, BlockState blockIn) + { + } + + protected SoundEvent getAmbientSound() + { + return null; + } + + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return SoundEvents.ENTITY_BEE_HURT; + } + + protected SoundEvent getDeathSound() + { + return SoundEvents.ENTITY_BEE_DEATH; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + public SprenFlameEntity createChild(ServerWorld world, AgeableEntity mate) + { + return EntityRegistry.SPREN_FIRE.get().create(world); + } + + protected float getStandingEyeHeight(Pose poseIn, EntitySize sizeIn) + { + return this.isChild() ? sizeIn.height * 0.5F : sizeIn.height * 0.5F; + } + + public boolean onLivingFall(float distance, float damageMultiplier) + { + return false; + } + + protected void updateFallState(double y, boolean onGroundIn, BlockState state, BlockPos pos) + { + } + + protected boolean makeFlySound() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isInvulnerableTo(source)) + { + return false; + } + else + { + return super.attackEntityFrom(source, amount); + } + } + + public CreatureAttribute getCreatureAttribute() + { + return AttributesRegistry.SPREN; + } + + protected void handleFluidJump(ITag fluidTag) + { + this.setMotion(this.getMotion().add(0.0D, 0.01D, 0.0D)); + } + + @OnlyIn(Dist.CLIENT) + public Vector3d getLeashStartPosition() + { + return new Vector3d(0.0D, 0.5F * this.getEyeHeight(), this.getWidth() * 0.2F); + } + + private boolean isWithinDistance(BlockPos pos, int distance) + { + try + { + SprenFlameEntity sprenFlameEntity = this; + BlockPos position = sprenFlameEntity.getPosition(); + return pos != null && pos.withinDistance(position, distance); + + } + catch (Exception e) + { + return false; + } + } + + class EnterFireGoal extends SprenFlameEntity.PassiveGoal + { + protected EnterFireGoal() + { + } + + public boolean canSprenStart() + { + if (SprenFlameEntity.this.hasFire() && SprenFlameEntity.this.canEnterFire() && SprenFlameEntity.this.firePos.withinDistance(SprenFlameEntity.this.getPositionVec(), 2.0D)) + { + return true; + } + + return false; + } + + public boolean canSprenContinue() + { + return false; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + if (isFireValid()) + { + SprenFlameEntity.this.remove(); + } + } + } + + public class MoveToFireGoal extends SprenFlameEntity.PassiveGoal + { + private int ticks = SprenFlameEntity.this.world.rand.nextInt(10); + private List possibleFires = Lists.newArrayList(); + @Nullable + private Path path = null; + private int field_234183_f_; + + MoveToFireGoal() + { + this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); + } + + public boolean canSprenStart() + { + return SprenFlameEntity.this.firePos != null && !SprenFlameEntity.this.detachHome() && SprenFlameEntity.this.canEnterFire() && !this.isCloseEnough(SprenFlameEntity.this.firePos); + } + + public boolean canSprenContinue() + { + return this.canSprenStart(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.ticks = 0; + this.field_234183_f_ = 0; + super.startExecuting(); + } + + /** + * Reset the task's internal state. Called when this task is interrupted by another one + */ + public void resetTask() + { + this.ticks = 0; + this.field_234183_f_ = 0; + SprenFlameEntity.this.navigator.clearPath(); + SprenFlameEntity.this.navigator.resetSearchDepthMultiplier(); + } + + /** + * Keep ticking a continuous task that has already been started + */ + public void tick() + { + if (SprenFlameEntity.this.firePos != null) + { + ++this.ticks; + if (this.ticks > 600) + { + this.makeChosenFirePossibleFire(); + } + else if (!SprenFlameEntity.this.navigator.hasPath()) + { + if (!SprenFlameEntity.this.isWithinDistance(SprenFlameEntity.this.firePos, 16)) + { + if (SprenFlameEntity.this.isTooFar(SprenFlameEntity.this.firePos)) + { + this.reset(); + } + else + { + SprenFlameEntity.this.startMovingTo(SprenFlameEntity.this.firePos); + } + } + else + { + boolean flag = this.startMovingToFar(SprenFlameEntity.this.firePos); + if (!flag) + { + this.makeChosenFirePossibleFire(); + } + else if (this.path != null && SprenFlameEntity.this.navigator.getPath().isSamePath(this.path)) + { + ++this.field_234183_f_; + if (this.field_234183_f_ > 60) + { + this.reset(); + this.field_234183_f_ = 0; + } + } + else + { + this.path = SprenFlameEntity.this.navigator.getPath(); + } + + } + } + } + } + + private boolean startMovingToFar(BlockPos pos) + { + SprenFlameEntity.this.navigator.setSearchDepthMultiplier(10.0F); + SprenFlameEntity.this.navigator.tryMoveToXYZ(pos.getX(), pos.getY(), pos.getZ(), 1.0D); + return SprenFlameEntity.this.navigator.getPath() != null && SprenFlameEntity.this.navigator.getPath().reachesTarget(); + } + + private boolean isPossibleFire(BlockPos pos) + { + return this.possibleFires.contains(pos); + } + + private void addPossibleFires(BlockPos pos) + { + this.possibleFires.add(pos); + + while (this.possibleFires.size() > 3) + { + this.possibleFires.remove(0); + } + + } + + private void clearPossibleFires() + { + this.possibleFires.clear(); + } + + private void makeChosenFirePossibleFire() + { + if (SprenFlameEntity.this.firePos != null) + { + this.addPossibleFires(SprenFlameEntity.this.firePos); + } + + this.reset(); + } + + private void reset() + { + SprenFlameEntity.this.firePos = null; + SprenFlameEntity.this.remainingCooldownBeforeLocatingNewFire = 200; + } + + private boolean isCloseEnough(BlockPos pos) + { + if (SprenFlameEntity.this.isWithinDistance(pos, 2)) + { + return true; + } + else + { + Path path = SprenFlameEntity.this.navigator.getPath(); + return path != null && path.getTarget().equals(pos) && path.reachesTarget() && path.isFinished(); + } + } + } + + class UpdateFireGoal extends SprenFlameEntity.PassiveGoal + { + private UpdateFireGoal() + { + } + + public boolean canSprenStart() + { + return SprenFlameEntity.this.remainingCooldownBeforeLocatingNewFire == 0 && !SprenFlameEntity.this.hasFire() && SprenFlameEntity.this.canEnterFire(); + } + + public boolean canSprenContinue() + { + return false; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + SprenFlameEntity.this.remainingCooldownBeforeLocatingNewFire = 200; + List list = this.getNearbyFreeFires(); + if (!list.isEmpty()) + { + for (BlockPos blockpos : list) + { + if (!SprenFlameEntity.this.moveToFireGoal.isPossibleFire(blockpos)) + { + SprenFlameEntity.this.firePos = blockpos; + return; + } + } + + SprenFlameEntity.this.moveToFireGoal.clearPossibleFires(); + SprenFlameEntity.this.firePos = list.get(0); + } + } + + private List getNearbyFreeFires() + { + List found = new ArrayList<>(); + BlockPos.getProximitySortedBoxPositions(SprenFlameEntity.this.getPosition(), 15, 15, 15) + .filter(blockPos -> + { + Block block = SprenFlameEntity.this.world.getBlockState(blockPos).getBlock(); + + if (block instanceof FireBlock) + { + return true; + } + + return false; + }) + .forEach(found::add); + return found; + } + } + +} + diff --git a/src/main/java/leaf/cosmere/items/curio/HemalurgicSpikeItem.java b/src/main/java/leaf/cosmere/items/curio/HemalurgicSpikeItem.java index e4f5eabf..0d8d35a7 100644 --- a/src/main/java/leaf/cosmere/items/curio/HemalurgicSpikeItem.java +++ b/src/main/java/leaf/cosmere/items/curio/HemalurgicSpikeItem.java @@ -10,7 +10,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder; import leaf.cosmere.Cosmere; import leaf.cosmere.cap.entity.SpiritwebCapability; -import leaf.cosmere.client.render.model.SpikeModel; +import leaf.cosmere.client.renderer.wearables.SpikeModel; import leaf.cosmere.constants.Metals; import leaf.cosmere.items.Metalmind; import leaf.cosmere.manifestation.AManifestation; diff --git a/src/main/java/leaf/cosmere/registry/AttributesRegistry.java b/src/main/java/leaf/cosmere/registry/AttributesRegistry.java index 538c9c1c..8f2b270a 100644 --- a/src/main/java/leaf/cosmere/registry/AttributesRegistry.java +++ b/src/main/java/leaf/cosmere/registry/AttributesRegistry.java @@ -6,6 +6,7 @@ import leaf.cosmere.Cosmere; import leaf.cosmere.constants.Metals; +import net.minecraft.entity.*; import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.RangedAttribute; import net.minecraftforge.fml.RegistryObject; @@ -21,6 +22,9 @@ public class AttributesRegistry public static final Map> MANIFESTATION_STRENGTH_ATTRIBUTES = makeAttributeMap(); + + public static final CreatureAttribute SPREN = new CreatureAttribute(); + public static Map> makeAttributeMap() { Map> attributeModifiers = new HashMap<>(); diff --git a/src/main/java/leaf/cosmere/registry/EntityRegistry.java b/src/main/java/leaf/cosmere/registry/EntityRegistry.java new file mode 100644 index 00000000..3952e39e --- /dev/null +++ b/src/main/java/leaf/cosmere/registry/EntityRegistry.java @@ -0,0 +1,29 @@ +package leaf.cosmere.registry; + +import leaf.cosmere.entities.spren.*; +import net.minecraft.entity.*; +import net.minecraft.entity.ai.attributes.*; +import net.minecraftforge.fml.*; +import net.minecraftforge.registries.*; + +import static leaf.cosmere.Cosmere.MODID; + +public class EntityRegistry +{ + public static final DeferredRegister> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MODID); + + public static final RegistryObject> SPREN_FIRE = + ENTITIES.register( + "spren_flame", + () -> EntityType.Builder + .create(SprenFlameEntity::new, EntityClassification.CREATURE) + .size(.5f, .5f) + .setShouldReceiveVelocityUpdates(false) + .build("spren_flame")); + + + public static void PrepareEntityAttributes() + { + GlobalEntityTypeAttributes.put(SPREN_FIRE.get(), SprenFlameEntity.prepareAttributes().create()); + } +} diff --git a/src/main/resources/assets/cosmere/textures/entity/spike.png b/src/main/resources/assets/cosmere/textures/entity/spike.png deleted file mode 100644 index 23128be791e3040c81b3bedf37fd0d07a717de1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3594 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 Qu>b%707*qoM6N<$g0O_YnE(I) diff --git a/src/main/resources/assets/cosmere/textures/entity/spren_flame.png b/src/main/resources/assets/cosmere/textures/entity/spren_flame.png new file mode 100644 index 0000000000000000000000000000000000000000..09342d893fdbfa4a30e5ed0fd29f97a858629c52 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`)}AhoAr}70Hgl6c&u8Q}m{~hx z;i8{bJ$|Nk*B^MvOg+YVkZP}rSd^e#i?824f}0|TDV1`G`45s}l6%KV!Q PG={;`)z4*}Q$iB}#rP+V literal 0 HcmV?d00001