-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add production model for sal ammoniac accumulator
Closes #104
- Loading branch information
1 parent
2d5a7d1
commit df3b5fd
Showing
22 changed files
with
262 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.20.1 2023-08-09T18:51:43.5516968 Languages: en_us | ||
7d945b41d6dfc83722dc10485c93b477893bf147 assets/theurgy/lang/en_us.json | ||
// 1.20.1 2023-10-10T14:29:25.6583765 Languages: en_us | ||
13c4aafac66d9901f8eb7b2f36e30ea04fc313a8 assets/theurgy/lang/en_us.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
src/generated/resources/assets/theurgy/models/block/sal_ammoniac_accumulator.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
{ | ||
"parent": "theurgy:block/sal_ammoniac_accumulator_template", | ||
"ambientocclusion": false, | ||
"textures": { | ||
"particle": "minecraft:block/copper_block", | ||
"texture": "theurgy:block/sal_ammoniac_accumulator" | ||
"particle": "minecraft:block/copper_block" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/generated/resources/assets/theurgy/models/item/sal_ammoniac_accumulator.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"parent": "theurgy:block/sal_ammoniac_accumulator" | ||
"parent": "minecraft:builtin/entity" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/generated/resources/data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-FileCopyrightText: 2023 klikli-dev | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator; | ||
|
||
import com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render.SalAmmoniacAccumulatorBEWLR; | ||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraftforge.client.extensions.common.IClientItemExtensions; | ||
import software.bernie.geckolib.animatable.GeoItem; | ||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; | ||
import software.bernie.geckolib.core.animation.AnimatableManager; | ||
import software.bernie.geckolib.util.GeckoLibUtil; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public class SalAmmoniacAccumulatorBlockItem extends BlockItem implements GeoItem { | ||
|
||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); | ||
|
||
public SalAmmoniacAccumulatorBlockItem(Block pBlock, Properties pProperties) { | ||
super(pBlock, pProperties); | ||
} | ||
|
||
|
||
@Override | ||
public void initializeClient(Consumer<IClientItemExtensions> consumer) { | ||
consumer.accept(new IClientItemExtensions() { | ||
@Override | ||
public BlockEntityWithoutLevelRenderer getCustomRenderer() { | ||
return SalAmmoniacAccumulatorBEWLR.get(); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { | ||
//do not show anims on item | ||
} | ||
|
||
@Override | ||
public AnimatableInstanceCache getAnimatableInstanceCache() { | ||
return this.cache; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
.../theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorBEWLR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// SPDX-FileCopyrightText: 2023 klikli-dev | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render; | ||
|
||
import com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.SalAmmoniacAccumulatorBlockItem; | ||
import com.klikli_dev.theurgy.content.apparatus.salammoniactank.SalAmmoniacTankBlockItem; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.block.model.ItemTransform; | ||
import net.minecraft.world.item.ItemDisplayContext; | ||
import org.joml.Matrix4f; | ||
import org.joml.Vector3f; | ||
import software.bernie.geckolib.cache.object.BakedGeoModel; | ||
import software.bernie.geckolib.renderer.GeoItemRenderer; | ||
|
||
public class SalAmmoniacAccumulatorBEWLR extends GeoItemRenderer<SalAmmoniacAccumulatorBlockItem> { | ||
|
||
private static final SalAmmoniacAccumulatorBEWLR instance = new SalAmmoniacAccumulatorBEWLR(); | ||
private final ItemTransform transform; | ||
|
||
public SalAmmoniacAccumulatorBEWLR() { | ||
super(new SalAmmoniacAccumulatorModel()); | ||
this.withScale(0.5f); | ||
this.transform = new ItemTransform(new Vector3f(30, 255, 0), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1)); | ||
} | ||
|
||
public static SalAmmoniacAccumulatorBEWLR get() { | ||
return instance; | ||
} | ||
|
||
@Override | ||
public void preRender(PoseStack poseStack, SalAmmoniacAccumulatorBlockItem animatable, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, | ||
float alpha) { | ||
//copied from parent, but fixed to also center the model when scaling | ||
this.itemRenderTranslations = new Matrix4f(poseStack.last().pose()); | ||
|
||
if (this.scaleWidth != 1 && this.scaleHeight != 1) { | ||
poseStack.scale(this.scaleWidth, this.scaleHeight, this.scaleWidth); | ||
|
||
//this is not as clean as I would like it - but it exactly centers the model for 0.5 scale :D | ||
poseStack.translate(this.scaleWidth / 0.5 - 0.5, -0.1, this.scaleWidth / 0.5 - 0.5); | ||
} | ||
|
||
poseStack.translate(0.5f, 0.51f, 0.5f); | ||
|
||
if (this.renderPerspective == ItemDisplayContext.GUI) { | ||
this.transform.apply(false, poseStack); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: 2023 klikli-dev | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render; | ||
|
||
import com.klikli_dev.theurgy.Theurgy; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.resources.ResourceLocation; | ||
import software.bernie.geckolib.core.animatable.GeoAnimatable; | ||
import software.bernie.geckolib.model.GeoModel; | ||
|
||
public class SalAmmoniacAccumulatorModel extends GeoModel { | ||
@Override | ||
public ResourceLocation getModelResource(GeoAnimatable animatable) { | ||
return Theurgy.loc("geo/sal_ammoniac_accumulator.geo.json"); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureResource(GeoAnimatable animatable) { | ||
return Theurgy.loc("textures/block/sal_ammoniac_accumulator.png"); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getAnimationResource(GeoAnimatable animatable) { | ||
return Theurgy.loc(""); | ||
} | ||
} |
Oops, something went wrong.