diff --git a/src/main/java/vazkii/botania/client/model/ManaGunModel.java b/src/main/java/vazkii/botania/client/model/ManaGunModel.java new file mode 100644 index 000000000..50ce901ba --- /dev/null +++ b/src/main/java/vazkii/botania/client/model/ManaGunModel.java @@ -0,0 +1,47 @@ +package vazkii.botania.client.model; + +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +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.texture.TextureAtlasSprite; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import vazkii.botania.common.item.ItemManaGun; + +import java.util.List; + +public class ManaGunModel implements IBakedModel { + + private final ItemHandler itemHandler = new ItemHandler(); + + @Override public List getQuads(IBlockState state, EnumFacing side, long rand) { return null; } + @Override public boolean isAmbientOcclusion() { return true; } + @Override public boolean isGui3d() { return true; } + @Override public boolean isBuiltInRenderer() { return false; } + @Override public TextureAtlasSprite getParticleTexture() { return null; } + @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } + + @Override + public ItemOverrideList getOverrides() { + return itemHandler; + } + + private class ItemHandler extends ItemOverrideList { + private ItemHandler() { + super(ImmutableList.of()); + } + + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { + boolean hasClip = ItemManaGun.hasClip(stack); + if (hasClip) { + List lenses = ItemManaGun.getAllLens(stack); + } + } + } +} diff --git a/src/main/java/vazkii/botania/common/item/ItemManaGun.java b/src/main/java/vazkii/botania/common/item/ItemManaGun.java index 65d8a32ef..63da4edd6 100644 --- a/src/main/java/vazkii/botania/common/item/ItemManaGun.java +++ b/src/main/java/vazkii/botania/common/item/ItemManaGun.java @@ -50,6 +50,7 @@ import vazkii.botania.common.entity.EntityManaBurst; import vazkii.botania.common.lib.LibItemNames; import java.awt.*; +import java.util.ArrayList; import java.util.List; public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable { @@ -314,6 +315,16 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem, IColorable { return null; } + public static List getAllLens(ItemStack stack) { + List ret = new ArrayList<>(); + + for (int i = 0; i < 6; i++) { + ret.add(getLensAtPos(stack, i)); + } + + return ret; + } + @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { if(par1ItemStack.isItemDamaged()) diff --git a/src/main/resources/assets/botania/models/item/manaGun.json b/src/main/resources/assets/botania/models/item/manaGun.json index fa04ed4ee..16e586c2d 100644 --- a/src/main/resources/assets/botania/models/item/manaGun.json +++ b/src/main/resources/assets/botania/models/item/manaGun.json @@ -1,28 +1,165 @@ -{ - "parent": "minecraft:item/handheld", - "textures": { - "layer0": "botania:items/manaGun0", - "layer1": "botania:items/manaGun1" - }, - "overrides": [ - { - "predicate": { - "botania:clip": 1 - }, - "model": "botania:item/manaGunClip" - }, - { - "predicate": { - "botania:desu": 1 - }, - "model": "botania:item/desuGun" - }, - { - "predicate": { - "botania:desu": 1, - "botania:clip": 1 - }, - "model": "botania:item/desuGunClip" - } - ] +{ + "__comment": "", + "textures": { + "layer0": "botania:items/manaBlaster", + "layer1": "botania:items/manaBlasterColor", + "layer2": "botania:items/manaBlasterGlass", + "layer3": "botania:items/manaBlasterLensClip" + }, + "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 ] }, + "east": { "texture": "layer1", "uv": [ 0.0, 0.0, 5.0, 5.0 ] }, + "south": { "texture": "layer1", "uv": [ 0.0, 0.0, 8.0, 5.0 ] } + } + }, + { + "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 ] } + } + }, + { + "name": "Clip", + "from": [ -4.5, 2.0, 5.0 ], + "to": [ 8.5, 8.0, 11.0 ], + "faces": { + "north": { "texture": "layer3", "uv": [ 0.01, 6.51, 6.5, 9.49 ] }, + "east": { "texture": "layer3", "uv": [ 6.01, 0.0, 9.0, 3.0 ] }, + "south": { "texture": "layer3", "uv": [ 6.5, 6.5, 0.01, 9.5 ] }, + "west": { "texture": "layer3", "uv": [ 6.0, 3.0, 9.0, 6.0 ] }, + "up": { "texture": "layer3", "uv": [ 0.0, 0.01, 3.0, 6.5 ], "rotation": 90 }, + "down": { "texture": "layer3", "uv": [ 3.0, 0.01, 6.0, 6.5 ], "rotation": 90 } + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/manaGunOld.json b/src/main/resources/assets/botania/models/item/manaGunOld.json new file mode 100644 index 000000000..fa04ed4ee --- /dev/null +++ b/src/main/resources/assets/botania/models/item/manaGunOld.json @@ -0,0 +1,28 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "botania:items/manaGun0", + "layer1": "botania:items/manaGun1" + }, + "overrides": [ + { + "predicate": { + "botania:clip": 1 + }, + "model": "botania:item/manaGunClip" + }, + { + "predicate": { + "botania:desu": 1 + }, + "model": "botania:item/desuGun" + }, + { + "predicate": { + "botania:desu": 1, + "botania:clip": 1 + }, + "model": "botania:item/desuGunClip" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/textures/items/manaBlaster.png b/src/main/resources/assets/botania/textures/items/manaBlaster.png new file mode 100644 index 000000000..828aace99 Binary files /dev/null and b/src/main/resources/assets/botania/textures/items/manaBlaster.png differ diff --git a/src/main/resources/assets/botania/textures/items/manaBlasterColor.png b/src/main/resources/assets/botania/textures/items/manaBlasterColor.png new file mode 100644 index 000000000..fb072d114 Binary files /dev/null and b/src/main/resources/assets/botania/textures/items/manaBlasterColor.png differ diff --git a/src/main/resources/assets/botania/textures/items/manaBlasterGlass.png b/src/main/resources/assets/botania/textures/items/manaBlasterGlass.png new file mode 100644 index 000000000..247d3c943 Binary files /dev/null and b/src/main/resources/assets/botania/textures/items/manaBlasterGlass.png differ diff --git a/src/main/resources/assets/botania/textures/items/manaBlasterLensClip.png b/src/main/resources/assets/botania/textures/items/manaBlasterLensClip.png new file mode 100644 index 000000000..427aa933a Binary files /dev/null and b/src/main/resources/assets/botania/textures/items/manaBlasterLensClip.png differ