diff --git a/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java b/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java index 27479467..4f7c7905 100644 --- a/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java +++ b/src/main/java/sunsetsatellite/signalindustries/SignalIndustries.java @@ -786,12 +786,13 @@ public class SignalIndustries implements ModInitializer, GameStartEntrypoint { public static final ItemSignalumPowerSuit signalumPowerSuitBoots = (ItemSignalumPowerSuit) ItemHelper.createItem(MOD_ID,new ItemSignalumPowerSuit("reinforced.signalumpowersuit.boots",config.getInt("ItemIDs.signalumPowerSuitBoots"),armorSignalumPowerSuit,3,Tier.REINFORCED),"signalumpowersuit_boots.png"); //public static final Item testingAttachment = ItemHelper.createItem(MOD_ID,new ItemAttachment(config.getInt("ItemIDs.testingAttachment"), listOf(AttachmentPoint.ANY)),"attachment.testingAttachment","energyorb.png"); - public static final Item pulsarAttachment = ItemHelper.createItem(MOD_ID,new ItemPulsarAttachment("reinforced.attachment.pulsar",config.getInt("ItemIDs.pulsarAttachment"), listOf(AttachmentPoint.ARM_FRONT), Tier.REINFORCED),"pulsar_attachment.png").setMaxStackSize(1); - public static final Item extendedEnergyPack = ItemHelper.createItem(MOD_ID,new ItemTieredAttachment("reinforced.attachment.extendedEnergyPack",config.getInt("ItemIDs.extendedEnergyPack"), listOf(AttachmentPoint.CORE_BACK), Tier.REINFORCED),"extended_energy_pack.png").setMaxStackSize(1); - public static final Item crystalWings = ItemHelper.createItem(MOD_ID,new ItemWingsAttachment("reinforced.attachment.wings",config.getInt("ItemIDs.crystalWings"), listOf(AttachmentPoint.CORE_BACK), Tier.REINFORCED),"wings.png").setMaxStackSize(1); - public static final Item basicBackpack = ItemHelper.createItem(MOD_ID,new ItemBackpackAttachment("basic.attachment.backpack",config.getInt("ItemIDs.basicBackpack"), listOf(AttachmentPoint.CORE_BACK), Tier.BASIC),"basic_backpack.png").setMaxStackSize(1); - public static final Item reinforcedBackpack = ItemHelper.createItem(MOD_ID,new ItemBackpackAttachment("reinforced.attachment.backpack",config.getInt("ItemIDs.reinforcedBackpack"), listOf(AttachmentPoint.CORE_BACK), Tier.REINFORCED),"reinforced_backpack.png").setMaxStackSize(1);; - + //implicit max stack size of 1 (defined in ItemAttachment) + public static final Item pulsarAttachment = ItemHelper.createItem(MOD_ID,new ItemPulsarAttachment("reinforced.attachment.pulsar",config.getInt("ItemIDs.pulsarAttachment"), listOf(AttachmentPoint.ARM_FRONT), Tier.REINFORCED),"pulsar_attachment.png"); + public static final Item extendedEnergyPack = ItemHelper.createItem(MOD_ID,new ItemTieredAttachment("reinforced.attachment.extendedEnergyPack",config.getInt("ItemIDs.extendedEnergyPack"), listOf(AttachmentPoint.CORE_BACK), Tier.REINFORCED),"extended_energy_pack.png"); + public static final Item crystalWings = ItemHelper.createItem(MOD_ID,new ItemWingsAttachment("reinforced.attachment.wings",config.getInt("ItemIDs.crystalWings"), listOf(AttachmentPoint.CORE_BACK), Tier.REINFORCED),"wings.png"); + public static final Item basicBackpack = ItemHelper.createItem(MOD_ID,new ItemBackpackAttachment("basic.attachment.backpack",config.getInt("ItemIDs.basicBackpack"), listOf(AttachmentPoint.CORE_BACK), Tier.BASIC),"basic_backpack.png"); + public static final Item reinforcedBackpack = ItemHelper.createItem(MOD_ID,new ItemBackpackAttachment("reinforced.attachment.backpack",config.getInt("ItemIDs.reinforcedBackpack"), listOf(AttachmentPoint.CORE_BACK), Tier.REINFORCED),"reinforced_backpack.png"); + public static final Item nightVisionLens = ItemHelper.createItem(MOD_ID,new ItemNVGAttachment("reinforced.attachment.nightVisionLens",config.getInt("ItemIDs.nightVisionLens"), listOf(AttachmentPoint.HEAD_TOP), Tier.REINFORCED),"night_vision_goggles.png"); public static final SuitBaseAbility testAbility = new TestingAbility(); public static final SuitBaseEffectAbility testEffectAbility = new TestingEffectAbility(); diff --git a/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemAttachment.java b/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemAttachment.java index aadfa18a..6e24a719 100644 --- a/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemAttachment.java +++ b/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemAttachment.java @@ -22,6 +22,7 @@ public class ItemAttachment extends Item implements IAttachment, ICustomDescript public ItemAttachment(String name, int id, List attachmentPoints) { super(name, id); this.attachmentPoints = attachmentPoints; + setMaxStackSize(1); } /*public ItemAttachment(int i, List attachmentPoints) { diff --git a/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemNVGAttachment.java b/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemNVGAttachment.java new file mode 100644 index 00000000..8dfc5c39 --- /dev/null +++ b/src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemNVGAttachment.java @@ -0,0 +1,57 @@ +package sunsetsatellite.signalindustries.items.attachments; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.render.shader.Shaders; +import net.minecraft.client.render.shader.ShadersRenderer; +import net.minecraft.core.entity.player.EntityPlayer; +import net.minecraft.core.item.ItemStack; +import net.minecraft.core.world.World; +import sunsetsatellite.signalindustries.powersuit.SignalumPowerSuit; +import sunsetsatellite.signalindustries.render.ShadersRendererSI; +import sunsetsatellite.signalindustries.util.AttachmentPoint; +import sunsetsatellite.signalindustries.util.Tier; + +import java.util.List; + +public class ItemNVGAttachment extends ItemTieredAttachment { + public ItemNVGAttachment(String name, int id, List attachmentPoints, Tier tier) { + super(name, id, attachmentPoints, tier); + } + + @Override + public void activate(ItemStack stack, SignalumPowerSuit signalumPowerSuit, EntityPlayer player, World world) { + super.activate(stack, signalumPowerSuit, player, world); + Minecraft mc = Minecraft.getMinecraft(this); + if(Shaders.enableShaders){ + if(mc.render instanceof ShadersRendererSI){ + mc.setRenderer(new ShadersRenderer(mc)); + mc.render.reload(); + mc.fullbright = false; + mc.renderGlobal.loadRenderers(); + } else { + mc.setRenderer(new ShadersRendererSI(mc,"nightvision/",signalumPowerSuit)); + mc.render.reload(); + mc.fullbright = true; + mc.renderGlobal.loadRenderers(); + } + } else { + mc.ingameGUI.addChatMessage("Can't activate: Shaders are disabled."); + } + } + + @Override + public void tick(ItemStack stack, SignalumPowerSuit signalumPowerSuit, EntityPlayer player, World world, int slot) { + super.tick(stack, signalumPowerSuit, player, world, slot); + Minecraft mc = Minecraft.getMinecraft(this); + if(mc.render instanceof ShadersRendererSI){ + if(signalumPowerSuit.getEnergy() < 1 ){ + mc.setRenderer(new ShadersRenderer(mc)); + mc.render.reload(); + mc.fullbright = false; + mc.renderGlobal.loadRenderers(); + } else { + signalumPowerSuit.decrementEnergy(1); + } + } + } +} diff --git a/src/main/java/sunsetsatellite/signalindustries/render/ShadersRendererSI.java b/src/main/java/sunsetsatellite/signalindustries/render/ShadersRendererSI.java new file mode 100644 index 00000000..b3acaf64 --- /dev/null +++ b/src/main/java/sunsetsatellite/signalindustries/render/ShadersRendererSI.java @@ -0,0 +1,46 @@ +package sunsetsatellite.signalindustries.render; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.render.shader.ShaderProvider; +import net.minecraft.client.render.shader.ShaderProviderInternal; +import net.minecraft.client.render.shader.ShadersRenderer; +import sunsetsatellite.signalindustries.SignalIndustries; +import sunsetsatellite.signalindustries.items.attachments.ItemAttachment; +import sunsetsatellite.signalindustries.powersuit.SignalumPowerSuit; + +public class ShadersRendererSI extends ShadersRenderer { + + public String currentShaderDir; + private final SignalumPowerSuit powerSuit; + + public ShadersRendererSI(Minecraft minecraft, String dir) { + super(minecraft); + this.currentShaderDir = dir; + this.powerSuit = null; + } + + public ShadersRendererSI(Minecraft minecraft, String dir, SignalumPowerSuit powerSuit) { + super(minecraft); + this.currentShaderDir = dir; + this.powerSuit = powerSuit; + } + + @Override + public void beginRenderGame(float partialTicks) { + if(powerSuit != null){ + if(!powerSuit.hasAttachment((ItemAttachment) SignalIndustries.nightVisionLens) || !powerSuit.active){ + mc.setRenderer(new ShadersRenderer(mc)); + mc.render.reload(); + mc.fullbright = false; + mc.renderGlobal.loadRenderers(); + return; + } + } + super.beginRenderGame(partialTicks); + } + + @Override + public ShaderProvider getShader() { + return new ShaderProviderInternal("/assets/signalindustries/shaders/"+currentShaderDir); + } +} diff --git a/src/main/resources/assets/signalindustries/block/eternal_tree_log.png b/src/main/resources/assets/signalindustries/block/eternal_tree_log.png index d6b64d03..0caa735f 100644 Binary files a/src/main/resources/assets/signalindustries/block/eternal_tree_log.png and b/src/main/resources/assets/signalindustries/block/eternal_tree_log.png differ diff --git a/src/main/resources/assets/signalindustries/block/eternal_tree_log_top.png b/src/main/resources/assets/signalindustries/block/eternal_tree_log_top.png index b0f2dff7..dab2596a 100644 Binary files a/src/main/resources/assets/signalindustries/block/eternal_tree_log_top.png and b/src/main/resources/assets/signalindustries/block/eternal_tree_log_top.png differ diff --git a/src/main/resources/assets/signalindustries/item/night_vision_goggles.png b/src/main/resources/assets/signalindustries/item/night_vision_goggles.png new file mode 100644 index 00000000..2a02b4e9 Binary files /dev/null and b/src/main/resources/assets/signalindustries/item/night_vision_goggles.png differ diff --git a/src/main/resources/assets/signalindustries/shaders/nightvision/base.fsh b/src/main/resources/assets/signalindustries/shaders/nightvision/base.fsh new file mode 100644 index 00000000..abe327d8 --- /dev/null +++ b/src/main/resources/assets/signalindustries/shaders/nightvision/base.fsh @@ -0,0 +1,10 @@ +#version 120 + +uniform sampler2D colortex0; + +varying vec2 texcoord; + +void main(){ + vec4 color = texture2D(colortex0, texcoord).rgba; + gl_FragColor = color; +} diff --git a/src/main/resources/assets/signalindustries/shaders/nightvision/base.vsh b/src/main/resources/assets/signalindustries/shaders/nightvision/base.vsh new file mode 100644 index 00000000..5650d067 --- /dev/null +++ b/src/main/resources/assets/signalindustries/shaders/nightvision/base.vsh @@ -0,0 +1,9 @@ +#version 120 + +varying vec2 texcoord; + +void main(){ + gl_Position = ftransform(); + + texcoord = gl_MultiTexCoord0.xy; +} \ No newline at end of file diff --git a/src/main/resources/assets/signalindustries/shaders/nightvision/post.fsh b/src/main/resources/assets/signalindustries/shaders/nightvision/post.fsh new file mode 100644 index 00000000..b7a1a461 --- /dev/null +++ b/src/main/resources/assets/signalindustries/shaders/nightvision/post.fsh @@ -0,0 +1,26 @@ +#version 120 + +uniform sampler2D colortex0; + +uniform float intensity; + +varying vec2 texcoord; + +vec3 toGrayscale(vec3 color) +{ + color.r = color.r * 0.5 + color.g * 0.5 + color.b * 0.5; + color.g = color.r * 0.5 + color.g * 0.5 + color.b * 0.5; + color.b = color.r * 0.5 + color.g * 0.5 + color.b * 0.5; + + return color; +} + +void main() +{ + vec3 color = texture2D(colortex0, texcoord).rgb; + vec3 gs = toGrayscale(color); + + color = mix(gs, gs, intensity); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/src/main/resources/assets/signalindustries/shaders/nightvision/post.vsh b/src/main/resources/assets/signalindustries/shaders/nightvision/post.vsh new file mode 100644 index 00000000..9c7ba53f --- /dev/null +++ b/src/main/resources/assets/signalindustries/shaders/nightvision/post.vsh @@ -0,0 +1,9 @@ +#version 120 + +varying vec2 texcoord; + +void main(){ + gl_Position = ftransform(); + + texcoord = gl_MultiTexCoord0.xy; +} \ No newline at end of file diff --git a/src/main/resources/lang/signalindustries/en_US.lang b/src/main/resources/lang/signalindustries/en_US.lang index 69d670bb..aa7a072f 100644 --- a/src/main/resources/lang/signalindustries/en_US.lang +++ b/src/main/resources/lang/signalindustries/en_US.lang @@ -83,6 +83,8 @@ item.signalindustries.reinforced.pulsar.desc=Multifunctional gadget. It's main a item.signalindustries.reinforced.signalumSaber.name=Signalum Saber item.signalindustries.reinforced.signalumSaber.desc=A heated blade capable of cutting almost anything if powered. +item.signalindustries.awakened.sunriseDawn.name=Sunrise Dawn +item.signalindustries.awakened.sunriseDawn.desc=Allows you to summon a destructive beam of light anywhere near the range of any [Satellite]. item.signalindustries.basic.signalumDrill.name=Basic Signalum Drill item.signalindustries.basic.signalumDrill.desc=A heavy-duty drill powered by Signalum Energy. Will not break when it runs out of energy. @@ -578,7 +580,7 @@ achievement.signalindustries.gate.desc=Construct a Warp Gate to link any two poi achievement.signalindustries.wings=Better than Icarus achievement.signalindustries.wings.desc=Attach a pair of Signalum Wings to your suit and reach for the stars. achievement.signalindustries.orbitalWeapon=3000 Orbital Weapons of Signal Industries -achievement.signalindustries.orbitalWeapon.desc= +achievement.signalindustries.orbitalWeapon.desc=Cast your divine fury upon your enemies and have them experience the unmatched power of the Sun. achievement.signalindustries.completed=Signal Industries achievement.signalindustries.completed=Activate the Awakened Signalum Ignition Facility for the first time reaching the end of your adventure. Thank you for playing!