From 2877d304ceb96f6017b7ca7af861e6dd071612d2 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Sat, 13 Aug 2016 12:50:17 -0500 Subject: [PATCH] Mana blaster now shows active lens on model --- .../core/handler/MiscellaneousIcons.java | 11 + .../vazkii/botania/client/model/GunModel.java | 171 ++++++++ .../botania/common/item/ItemManaGun.java | 44 +- .../assets/botania/models/item/manaGun.json | 395 +++++++++--------- .../botania/models/item/manaGunClip.json | 6 +- 5 files changed, 405 insertions(+), 222 deletions(-) create mode 100644 src/main/java/vazkii/botania/client/model/GunModel.java diff --git a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java index a7dcbe448..de96858f4 100644 --- a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java +++ b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java @@ -10,6 +10,7 @@ package vazkii.botania.client.core.handler; import com.google.common.collect.Maps; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; @@ -24,6 +25,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import vazkii.botania.client.core.helper.IconHelper; import vazkii.botania.client.model.FloatingFlowerModel; +import vazkii.botania.client.model.GunModel; import vazkii.botania.client.model.LexiconModel; import vazkii.botania.client.model.PlatformModel; import vazkii.botania.common.Botania; @@ -97,6 +99,15 @@ public class MiscellaneousIcons { // Lexicon evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon", "inventory"), new LexiconModel()); + + // Mana Blaster + ModelResourceLocation key = new ModelResourceLocation("botania:manaGun", "inventory"); + IBakedModel originalModel = evt.getModelRegistry().getObject(key); + evt.getModelRegistry().putObject(key, new GunModel(originalModel)); + + key = new ModelResourceLocation("botania:manaGunClip", "inventory"); + originalModel = evt.getModelRegistry().getObject(key); + evt.getModelRegistry().putObject(key, new GunModel(originalModel)); } @SubscribeEvent diff --git a/src/main/java/vazkii/botania/client/model/GunModel.java b/src/main/java/vazkii/botania/client/model/GunModel.java new file mode 100644 index 000000000..0e0140c25 --- /dev/null +++ b/src/main/java/vazkii/botania/client/model/GunModel.java @@ -0,0 +1,171 @@ +package vazkii.botania.client.model; + +import com.google.common.base.Preconditions; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelManager; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.client.model.pipeline.IVertexConsumer; +import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; +import net.minecraftforge.client.model.pipeline.VertexTransformer; +import net.minecraftforge.common.model.TRSRTransformation; +import org.apache.commons.lang3.tuple.Pair; +import vazkii.botania.common.Botania; +import vazkii.botania.common.item.ItemManaGun; +import vazkii.botania.common.item.ModItems; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import javax.vecmath.Vector3f; +import javax.vecmath.Vector4f; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class GunModel implements IBakedModel { + + private final IBakedModel originalModel; + + public GunModel(IBakedModel originalModel) { + this.originalModel = Preconditions.checkNotNull(originalModel); + } + + private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) { + @Nonnull + @Override + public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity) { + ItemStack lens = ItemManaGun.getLens(stack); + if(lens != null) { + IBakedModel lensModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(lens); + return GunModel.this.getModel(lensModel); + } + else return GunModel.this; + } + }; + + @Nonnull + @Override + public ItemOverrideList getOverrides() { + return itemHandler; + } + + @Nonnull @Override public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { return originalModel.getQuads(state, side, rand); } + @Override public boolean isAmbientOcclusion() { return originalModel.isAmbientOcclusion(); } + @Override public boolean isGui3d() { return originalModel.isGui3d(); } + @Override public boolean isBuiltInRenderer() { return originalModel.isBuiltInRenderer(); } + @Nonnull @Override public TextureAtlasSprite getParticleTexture() { return originalModel.getParticleTexture(); } + @Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return originalModel.getItemCameraTransforms(); } + + private final IdentityHashMap cache = new IdentityHashMap<>(); + + private CompositeBakedModel getModel(IBakedModel lens) { + CompositeBakedModel model = cache.get(lens); + if(model == null) { + model = new CompositeBakedModel(lens, originalModel); + cache.put(lens, model); + } + return model; + } + + protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) { + UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM); + final IVertexConsumer consumer = new VertexTransformer(builder) { + @Override + public void put(int element, float... data) { + VertexFormatElement formatElement = DefaultVertexFormats.ITEM.getElement(element); + switch(formatElement.getUsage()) { + case POSITION: { + float[] newData = new float[4]; + Vector4f vec = new Vector4f(data); + transform.getMatrix().transform(vec); + vec.get(newData); + parent.put(element, newData); + break; + } + default: { + parent.put(element, data); + break; + } + } + } + }; + quad.pipe(consumer); + return builder.build(); + } + + private static class CompositeBakedModel implements IPerspectiveAwareModel { + + private final IBakedModel gun; + private final List genQuads; + private final Map> faceQuads = new EnumMap<>(EnumFacing.class); + + CompositeBakedModel(IBakedModel lens, IBakedModel gun) { + this.gun = gun; + + ImmutableList.Builder genBuilder = ImmutableList.builder(); + final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(-0.4F, 0.25F, 0), null, new Vector3f(0.625F, 0.625F, 0.625F), TRSRTransformation.quatFromXYZ(0, (float) Math.PI / 2, 0))); + + for(EnumFacing e : EnumFacing.VALUES) + faceQuads.put(e, new ArrayList<>()); + + // Add lens quads, scaled and translated + for(BakedQuad quad : lens.getQuads(null, null, 0)) { + genBuilder.add(transform(quad, transform)); + } + + for(EnumFacing e : EnumFacing.VALUES) { + faceQuads.get(e).addAll(lens.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList())); + } + + // Add gun quads + genBuilder.addAll(gun.getQuads(null, null, 0)); + for(EnumFacing e : EnumFacing.VALUES) { + faceQuads.get(e).addAll(gun.getQuads(null, e, 0)); + } + + genQuads = genBuilder.build(); + + } + + @Nonnull @Override public List getQuads(IBlockState state, EnumFacing face, long rand) { return face == null ? genQuads : faceQuads.get(face); } + + // Forward all to gun model + @Override public boolean isAmbientOcclusion() { return gun.isAmbientOcclusion(); } + @Override public boolean isGui3d() { return gun.isGui3d(); } + @Override public boolean isBuiltInRenderer() { return gun.isBuiltInRenderer(); } + @Nonnull @Override public TextureAtlasSprite getParticleTexture() { return gun.getParticleTexture();} + @Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return gun.getItemCameraTransforms(); } + @Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; } + + @Override + public Pair handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { + if(gun instanceof IPerspectiveAwareModel) { + Pair pair = ((IPerspectiveAwareModel) gun).handlePerspective(cameraTransformType); + if(pair != null && pair.getRight() != null) + return Pair.of(this, pair.getRight()); + } + return Pair.of(this, TRSRTransformation.identity().getMatrix()); + } + } + +} diff --git a/src/main/java/vazkii/botania/common/item/ItemManaGun.java b/src/main/java/vazkii/botania/common/item/ItemManaGun.java index 5fd2d2163..539116ae1 100644 --- a/src/main/java/vazkii/botania/common/item/ItemManaGun.java +++ b/src/main/java/vazkii/botania/common/item/ItemManaGun.java @@ -12,6 +12,7 @@ package vazkii.botania.common.item; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -29,6 +30,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -75,9 +77,6 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable { RecipeSorter.register("botania:manaGunLens", ManaGunLensRecipe.class, Category.SHAPELESS, ""); RecipeSorter.register("botania:manaGunRemoveLens", ManaGunRemoveLensRecipe.class, Category.SHAPELESS, ""); RecipeSorter.register("botania:manaGunClip", ManaGunClipRecipe.class, Category.SHAPELESS, ""); - - addPropertyOverride(new ResourceLocation("botania", "clip"), (itemStack, world, entityLivingBase) -> hasClip(itemStack) ? 1 : 0); - addPropertyOverride(new ResourceLocation("botania", "desu"), (itemStack, world, entityLivingBase) -> isSugoiKawaiiDesuNe(itemStack) ? 1 : 0); } @Nonnull @@ -141,17 +140,21 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable { @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack par1ItemStack, int tintIndex) { - if(tintIndex != 1) - return 0xFFFFFF; + public int getColorFromItemStack(ItemStack stack, int tintIndex) { + ItemStack lens = getLens(stack); + if(lens != null && tintIndex == 0) + return ((IColorable) ModItems.lens).getColorFromItemStack(lens, tintIndex); - EntityManaBurst burst = getBurst(Minecraft.getMinecraft().thePlayer, par1ItemStack, false); - Color color = new Color(burst == null ? 0x20FF20 : burst.getColor()); + if(tintIndex == 2) { + EntityManaBurst burst = getBurst(Minecraft.getMinecraft().thePlayer, stack, false); + Color color = new Color(burst == null ? 0x20FF20 : burst.getColor()); - float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F); - int c = (int) (255 * mul); + float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F); + int c = (int) (255 * mul); + + return new Color(Math.max(0, Math.min(255, color.getRed() + c)), Math.max(0, Math.min(255, color.getGreen() + c)), Math.max(0, Math.min(255, color.getBlue() + c))).getRGB(); + } else return 0xFFFFFF; - return new Color(Math.max(0, Math.min(255, color.getRed() + c)), Math.max(0, Math.min(255, color.getGreen() + c)), Math.max(0, Math.min(255, color.getBlue() + c))).getRGB(); } @Override @@ -331,4 +334,23 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable { public boolean usesMana(ItemStack stack) { return true; } + + @SideOnly(Side.CLIENT) + @Override + public void registerModels() { + ModelLoader.registerItemVariants(this, + new ModelResourceLocation("botania:desuGunClip", "inventory"), + new ModelResourceLocation("botania:desuGun", "inventory"), + new ModelResourceLocation("botania:manaGunClip", "inventory"), + new ModelResourceLocation("botania:manaGun", "inventory")); + ModelLoader.setCustomMeshDefinition(this, stack -> { + if (hasClip(stack) && isSugoiKawaiiDesuNe(stack)) + return new ModelResourceLocation("botania:desuGunClip", "inventory"); + else if (isSugoiKawaiiDesuNe(stack)) + return new ModelResourceLocation("botania:desuGun", "inventory"); + else if(hasClip(stack)) + return new ModelResourceLocation("botania:manaGunClip", "inventory"); + else return new ModelResourceLocation("botania:manaGun", "inventory"); + }); + } } diff --git a/src/main/resources/assets/botania/models/item/manaGun.json b/src/main/resources/assets/botania/models/item/manaGun.json index 5e6ef87b7..2173f234e 100644 --- a/src/main/resources/assets/botania/models/item/manaGun.json +++ b/src/main/resources/assets/botania/models/item/manaGun.json @@ -1,209 +1,188 @@ -{ - "__comment": "Author: wiiv", - "textures": { - "layer0": "botania:items/manaBlaster", - "layer1": "botania:items/manaBlasterColor", - "layer2": "botania:items/manaBlasterGlass" - }, - "elements": [ - { - "name": "Barrel1", - "from": [ -10.0, 5.0, 5.5 ], - "to": [ -3.0, 14.0, 10.5 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 0.0, 7.01, 3.5, 11.49 ] }, - "east": { "texture": "layer0", "uv": [ 6.0, 7.0, 8.5, 11.5 ] }, - "south": { "texture": "layer0", "uv": [ 3.5, 7.01, 0.0, 11.49 ] }, - "west": { "texture": "layer0", "uv": [ 3.5, 7.01, 6.0, 11.49 ] }, - "up": { "texture": "layer0", "uv": [ 11.01, 10.5, 13.49, 13.99 ], "rotation": 90 }, - "down": { "texture": "layer0", "uv": [ 13.5, 10.5, 16.0, 14.0 ], "rotation": 90 } - } - }, - { - "name": "Barrel2", - "from": [ -3.0, 5.0, 5.5 ], - "to": [ 7.0, 9.0, 10.5 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 11.01, 14.0, 15.99, 15.99 ] }, - "south": { "texture": "layer0", "uv": [ 16.0, 14.0, 11.0, 16.0 ] }, - "up": { "texture": "layer0", "uv": [ 11.01, 5.0, 13.49, 10.0 ], "rotation": 270 }, - "down": { "texture": "layer0", "uv": [ 13.5, 5.0, 15.99, 10.0 ], "rotation": 270 } - } - }, - { - "name": "Barrel3", - "from": [ 7.0, 5.0, 5.5 ], - "to": [ 10.0, 14.0, 10.5 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 0.0, 11.5, 1.5, 16.0 ] }, - "east": { "texture": "layer0", "uv": [ 1.5, 11.5, 4.0, 16.0 ] }, - "south": { "texture": "layer0", "uv": [ 0.0, 11.5, 1.5, 16.0 ] }, - "west": { "texture": "layer0", "uv": [ 1.5, 11.5, 4.0, 16.0 ] }, - "up": { "texture": "layer0", "uv": [ 11.0, 4.0, 13.5, 5.5 ], "rotation": 90 }, - "down": { "texture": "layer0", "uv": [ 13.5, 4.0, 16.0, 5.5 ], "rotation": 90 } - } - }, - { - "name": "Barrel4", - "from": [ 10.0, 12.0, 5.5 ], - "to": [ 18.0, 14.0, 10.5 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 4.01, 14.5, 8.0, 15.5 ] }, - "east": { "texture": "layer0", "uv": [ 4.0, 14.5, 6.5, 15.5 ] }, - "south": { "texture": "layer0", "uv": [ 8.0, 14.5, 4.0, 15.5 ] }, - "up": { "texture": "layer0", "uv": [ 11.01, 0.01, 13.49, 3.99 ], "rotation": 90 }, - "down": { "texture": "layer0", "uv": [ 11.0, 0.01, 13.5, 4.0 ], "rotation": 90 } - } - }, - { - "name": "Barrel5", - "from": [ 10.0, 9.0, 5.5 ], - "to": [ 18.0, 11.0, 10.5 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 8.0, 14.5, 4.0, 15.5 ] }, - "east": { "texture": "layer0", "uv": [ 6.5, 14.5, 4.0, 15.5 ] }, - "south": { "texture": "layer0", "uv": [ 4.0, 14.5, 8.0, 15.5 ] }, - "up": { "texture": "layer0", "uv": [ 11.01, 0.0, 13.49, 3.99 ], "rotation": 90 }, - "down": { "texture": "layer0", "uv": [ 13.51, 0.01, 15.99, 3.99 ], "rotation": 90 } - } - }, - { - "name": "Strap", - "from": [ 14.0, -5.0, 6.5 ], - "to": [ 19.0, 9.0, 9.5 ], - "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "z", "angle": 22.5 }, - "faces": { - "north": { "texture": "layer0", "uv": [ 0.0, 0.01, 2.5, 6.99 ] }, - "east": { "texture": "layer0", "uv": [ 4.0, 0.01, 5.5, 6.99 ] }, - "south": { "texture": "layer0", "uv": [ 2.5, 0.01, 0.0, 6.99 ] }, - "west": { "texture": "layer0", "uv": [ 2.5, 0.01, 4.0, 6.99 ] }, - "down": { "texture": "layer0", "uv": [ 5.5, 0.0, 7.0, 2.5 ], "rotation": 90 } - } - }, - { - "name": "Magazine", - "from": [ 12.5, -6.0, 7.0 ], - "to": [ 18.5, -5.0, 9.0 ], - "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "z", "angle": 22.5 }, - "faces": { - "north": { "texture": "layer0", "uv": [ 7.5, 0.0, 8.0, 3.0 ], "rotation": 90 }, - "east": { "texture": "layer0", "uv": [ 8.0, 0.0, 7.0, 0.5 ] }, - "south": { "texture": "layer0", "uv": [ 8.0, 0.01, 7.5, 3.0 ], "rotation": 90 }, - "west": { "texture": "layer0", "uv": [ 7.0, 0.01, 8.0, 0.5 ] }, - "up": { "texture": "layer0", "uv": [ 7.0, 0.01, 8.0, 3.0 ], "rotation": 90 }, - "down": { "texture": "layer0", "uv": [ 7.01, 0.0, 7.99, 3.0 ], "rotation": 90 } - } - }, - { - "name": "Trigger Guard1", - "from": [ 10.0, 6.0, 7.0 ], - "to": [ 16.0, 7.0, 9.0 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 5.5, 3.01, 8.5, 3.5 ] }, - "south": { "texture": "layer0", "uv": [ 5.5, 3.01, 8.5, 3.49 ] }, - "up": { "texture": "layer0", "uv": [ 5.5, 3.0, 8.5, 4.0 ] }, - "down": { "texture": "layer0", "uv": [ 5.5, 3.0, 8.5, 4.0 ] } - } - }, - { - "name": "Trigger", - "from": [ 13.0, 7.0, 7.5 ], - "to": [ 16.0, 9.0, 8.5 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 5.5, 5.0, 6.5, 6.0 ] }, - "south": { "texture": "layer0", "uv": [ 5.5, 5.0, 6.5, 6.0 ] }, - "west": { "texture": "layer0", "uv": [ 5.5, 5.0, 6.5, 5.5 ] } - } - }, - { - "name": "Trigger Guard2", - "from": [ 10.0, 7.0, 7.0 ], - "to": [ 11.0, 9.0, 9.0 ], - "faces": { - "north": { "texture": "layer0", "uv": [ 5.5, 4.0, 6.0, 5.0 ] }, - "east": { "texture": "layer0", "uv": [ 5.5, 4.0, 6.5, 5.0 ] }, - "south": { "texture": "layer0", "uv": [ 5.5, 4.0, 6.0, 5.0 ] } - } - }, - { - "name": "Colorizer", - "from": [ 9.5, 11.0, 6.0 ], - "to": [ 17.5, 12.0, 10.0 ], - "faces": { - "north": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 1 }, - "east": { "texture": "layer1", "uv": [ 0.0, 0.0, 5.0, 5.0 ], "tintindex": 1 }, - "south": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 1 } - } - }, - { - "name": "Glass", - "from": [ -3.5, 9.5, 6.0 ], - "to": [ 7.5, 13.5, 10.0 ], - "faces": { - "north": { "texture": "layer2", "uv": [ 0.01, 7.01, 6.99, 7.99 ] }, - "east": { "texture": "layer2", "uv": [ 7.01, 7.01, 9.49, 7.99 ] }, - "south": { "texture": "layer2", "uv": [ 6.99, 7.01, 0.01, 7.99 ] }, - "up": { "texture": "layer2", "uv": [ 11.01, 0.01, 13.49, 6.99 ] }, - "down": { "texture": "layer2", "uv": [ 8.51, 0.01, 6.99, 9.99 ] } - } - } - ], - "display": { - "gui": { - "rotation": [ 0, -20, -40 ], - "translation": [ 0, 0, 0 ], - "scale": [ 0.4, 0.4, 0.4 ] - }, - "ground": { - "rotation": [ 0, 0, 0 ], - "translation": [ 0, 0, 0 ], - "scale": [ 0.4, 0.4, 0.4 ] - }, - "fixed": { - "rotation": [ 0, 0, 0 ], - "translation": [ 0, 0, 0 ], - "scale": [ 0.45, 0.45, 0.45 ] - }, - "thirdperson_lefthand": { - "rotation": [ 0, 90, 0 ], - "translation": [ 0, 2.45, -1.5 ], - "scale": [ 0.4, 0.4, 0.4 ] - }, - "thirdperson_righthand": { - "rotation": [ 0, -90, 0 ], - "translation": [ 0, 2.45, -1.5 ], - "scale": [ 0.4, 0.4, 0.4 ] - }, - "firstperson_lefthand": { - "rotation": [ 10, 80, -5 ], - "translation": [ 0.8, 2.5, 0 ], - "scale": [ 0.45, 0.45, 0.45 ] - }, - "firstperson_righthand": { - "rotation": [ 10, -80, 5 ], - "translation": [ -1.8, 2.5, 0 ], - "scale": [ 0.45, 0.45, 0.45 ] - } - }, - "overrides": [ - { - "predicate": { - "botania:desu": 1, - "botania:clip": 1 - }, - "model": "botania:item/desuGunClip" - }, - { - "predicate": { - "botania:clip": 1 - }, - "model": "botania:item/manaGunClip" - }, - { - "predicate": { - "botania:desu": 1 - }, - "model": "botania:item/desuGun" - } - ] +{ + "__comment": "Author: wiiv", + "textures": { + "layer0": "botania:items/manaBlaster", + "layer1": "botania:items/manaBlasterColor", + "layer2": "botania:items/manaBlasterGlass" + }, + "elements": [ + { + "name": "Barrel1", + "from": [ -10.0, 5.0, 5.5 ], + "to": [ -3.0, 14.0, 10.5 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 0.0, 7.01, 3.5, 11.49 ] }, + "east": { "texture": "layer0", "uv": [ 6.0, 7.0, 8.5, 11.5 ] }, + "south": { "texture": "layer0", "uv": [ 3.5, 7.01, 0.0, 11.49 ] }, + "west": { "texture": "layer0", "uv": [ 3.5, 7.01, 6.0, 11.49 ] }, + "up": { "texture": "layer0", "uv": [ 11.01, 10.5, 13.49, 13.99 ], "rotation": 90 }, + "down": { "texture": "layer0", "uv": [ 13.5, 10.5, 16.0, 14.0 ], "rotation": 90 } + } + }, + { + "name": "Barrel2", + "from": [ -3.0, 5.0, 5.5 ], + "to": [ 7.0, 9.0, 10.5 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 11.01, 14.0, 15.99, 15.99 ] }, + "south": { "texture": "layer0", "uv": [ 16.0, 14.0, 11.0, 16.0 ] }, + "up": { "texture": "layer0", "uv": [ 11.01, 5.0, 13.49, 10.0 ], "rotation": 270 }, + "down": { "texture": "layer0", "uv": [ 13.5, 5.0, 15.99, 10.0 ], "rotation": 270 } + } + }, + { + "name": "Barrel3", + "from": [ 7.0, 5.0, 5.5 ], + "to": [ 10.0, 14.0, 10.5 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 0.0, 11.5, 1.5, 16.0 ] }, + "east": { "texture": "layer0", "uv": [ 1.5, 11.5, 4.0, 16.0 ] }, + "south": { "texture": "layer0", "uv": [ 0.0, 11.5, 1.5, 16.0 ] }, + "west": { "texture": "layer0", "uv": [ 1.5, 11.5, 4.0, 16.0 ] }, + "up": { "texture": "layer0", "uv": [ 11.0, 4.0, 13.5, 5.5 ], "rotation": 90 }, + "down": { "texture": "layer0", "uv": [ 13.5, 4.0, 16.0, 5.5 ], "rotation": 90 } + } + }, + { + "name": "Barrel4", + "from": [ 10.0, 12.0, 5.5 ], + "to": [ 18.0, 14.0, 10.5 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 4.01, 14.5, 8.0, 15.5 ] }, + "east": { "texture": "layer0", "uv": [ 4.0, 14.5, 6.5, 15.5 ] }, + "south": { "texture": "layer0", "uv": [ 8.0, 14.5, 4.0, 15.5 ] }, + "up": { "texture": "layer0", "uv": [ 11.01, 0.01, 13.49, 3.99 ], "rotation": 90 }, + "down": { "texture": "layer0", "uv": [ 11.0, 0.01, 13.5, 4.0 ], "rotation": 90 } + } + }, + { + "name": "Barrel5", + "from": [ 10.0, 9.0, 5.5 ], + "to": [ 18.0, 11.0, 10.5 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 8.0, 14.5, 4.0, 15.5 ] }, + "east": { "texture": "layer0", "uv": [ 6.5, 14.5, 4.0, 15.5 ] }, + "south": { "texture": "layer0", "uv": [ 4.0, 14.5, 8.0, 15.5 ] }, + "up": { "texture": "layer0", "uv": [ 11.01, 0.0, 13.49, 3.99 ], "rotation": 90 }, + "down": { "texture": "layer0", "uv": [ 13.51, 0.01, 15.99, 3.99 ], "rotation": 90 } + } + }, + { + "name": "Strap", + "from": [ 14.0, -5.0, 6.5 ], + "to": [ 19.0, 9.0, 9.5 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "z", "angle": 22.5 }, + "faces": { + "north": { "texture": "layer0", "uv": [ 0.0, 0.01, 2.5, 6.99 ] }, + "east": { "texture": "layer0", "uv": [ 4.0, 0.01, 5.5, 6.99 ] }, + "south": { "texture": "layer0", "uv": [ 2.5, 0.01, 0.0, 6.99 ] }, + "west": { "texture": "layer0", "uv": [ 2.5, 0.01, 4.0, 6.99 ] }, + "down": { "texture": "layer0", "uv": [ 5.5, 0.0, 7.0, 2.5 ], "rotation": 90 } + } + }, + { + "name": "Magazine", + "from": [ 12.5, -6.0, 7.0 ], + "to": [ 18.5, -5.0, 9.0 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "z", "angle": 22.5 }, + "faces": { + "north": { "texture": "layer0", "uv": [ 7.5, 0.0, 8.0, 3.0 ], "rotation": 90 }, + "east": { "texture": "layer0", "uv": [ 8.0, 0.0, 7.0, 0.5 ] }, + "south": { "texture": "layer0", "uv": [ 8.0, 0.01, 7.5, 3.0 ], "rotation": 90 }, + "west": { "texture": "layer0", "uv": [ 7.0, 0.01, 8.0, 0.5 ] }, + "up": { "texture": "layer0", "uv": [ 7.0, 0.01, 8.0, 3.0 ], "rotation": 90 }, + "down": { "texture": "layer0", "uv": [ 7.01, 0.0, 7.99, 3.0 ], "rotation": 90 } + } + }, + { + "name": "Trigger Guard1", + "from": [ 10.0, 6.0, 7.0 ], + "to": [ 16.0, 7.0, 9.0 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 5.5, 3.01, 8.5, 3.5 ] }, + "south": { "texture": "layer0", "uv": [ 5.5, 3.01, 8.5, 3.49 ] }, + "up": { "texture": "layer0", "uv": [ 5.5, 3.0, 8.5, 4.0 ] }, + "down": { "texture": "layer0", "uv": [ 5.5, 3.0, 8.5, 4.0 ] } + } + }, + { + "name": "Trigger", + "from": [ 13.0, 7.0, 7.5 ], + "to": [ 16.0, 9.0, 8.5 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 5.5, 5.0, 6.5, 6.0 ] }, + "south": { "texture": "layer0", "uv": [ 5.5, 5.0, 6.5, 6.0 ] }, + "west": { "texture": "layer0", "uv": [ 5.5, 5.0, 6.5, 5.5 ] } + } + }, + { + "name": "Trigger Guard2", + "from": [ 10.0, 7.0, 7.0 ], + "to": [ 11.0, 9.0, 9.0 ], + "faces": { + "north": { "texture": "layer0", "uv": [ 5.5, 4.0, 6.0, 5.0 ] }, + "east": { "texture": "layer0", "uv": [ 5.5, 4.0, 6.5, 5.0 ] }, + "south": { "texture": "layer0", "uv": [ 5.5, 4.0, 6.0, 5.0 ] } + } + }, + { + "name": "Colorizer", + "from": [ 9.5, 11.0, 6.0 ], + "to": [ 17.5, 12.0, 10.0 ], + "faces": { + "north": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 2 }, + "east": { "texture": "layer1", "uv": [ 0.0, 0.0, 5.0, 5.0 ], "tintindex": 2 }, + "south": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 2 } + } + }, + { + "name": "Glass", + "from": [ -3.5, 9.5, 6.0 ], + "to": [ 7.5, 13.5, 10.0 ], + "faces": { + "north": { "texture": "layer2", "uv": [ 0.01, 7.01, 6.99, 7.99 ] }, + "east": { "texture": "layer2", "uv": [ 7.01, 7.01, 9.49, 7.99 ] }, + "south": { "texture": "layer2", "uv": [ 6.99, 7.01, 0.01, 7.99 ] }, + "up": { "texture": "layer2", "uv": [ 11.01, 0.01, 13.49, 6.99 ] }, + "down": { "texture": "layer2", "uv": [ 8.51, 0.01, 6.99, 9.99 ] } + } + } + ], + "display": { + "gui": { + "rotation": [ 0, -20, -40 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.4, 0.4, 0.4 ] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.4, 0.4, 0.4 ] + }, + "fixed": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.45, 0.45, 0.45 ] + }, + "thirdperson_lefthand": { + "rotation": [ 0, 90, 0 ], + "translation": [ 0, 2.45, -1.5 ], + "scale": [ 0.4, 0.4, 0.4 ] + }, + "thirdperson_righthand": { + "rotation": [ 0, -90, 0 ], + "translation": [ 0, 2.45, -1.5 ], + "scale": [ 0.4, 0.4, 0.4 ] + }, + "firstperson_lefthand": { + "rotation": [ 10, 80, -5 ], + "translation": [ 0.8, 2.5, 0 ], + "scale": [ 0.45, 0.45, 0.45 ] + }, + "firstperson_righthand": { + "rotation": [ 10, -80, 5 ], + "translation": [ -1.8, 2.5, 0 ], + "scale": [ 0.45, 0.45, 0.45 ] + } + } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/manaGunClip.json b/src/main/resources/assets/botania/models/item/manaGunClip.json index f13aec897..aa7221398 100644 --- a/src/main/resources/assets/botania/models/item/manaGunClip.json +++ b/src/main/resources/assets/botania/models/item/manaGunClip.json @@ -131,9 +131,9 @@ "from": [ 9.5, 11.0, 6.0 ], "to": [ 17.5, 12.0, 10.0 ], "faces": { - "north": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 1 }, - "east": { "texture": "layer1", "uv": [ 0.0, 0.0, 5.0, 5.0 ], "tintindex": 1 }, - "south": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 1 } + "north": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 2 }, + "east": { "texture": "layer1", "uv": [ 0.0, 0.0, 5.0, 5.0 ], "tintindex": 2 }, + "south": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ], "tintindex": 2 } } }, {