-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from SymmetricDevs/bru-gas-masks
Environmental Survival items
- Loading branch information
Showing
166 changed files
with
4,218 additions
and
19 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
69 changes: 69 additions & 0 deletions
69
src/main/java/supersymmetry/api/items/IBreathingArmorLogic.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,69 @@ | ||
package supersymmetry.api.items; | ||
|
||
import gregtech.api.items.armor.ArmorMetaItem; | ||
import gregtech.api.items.armor.IArmorLogic; | ||
import gregtech.api.items.armor.ISpecialArmorLogic; | ||
import gregtech.api.items.metaitem.stats.IItemBehaviour; | ||
import gregtech.common.items.behaviors.TooltipBehavior; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.inventory.EntityEquipmentSlot; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.*; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.common.ISpecialArmor; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public interface IBreathingArmorLogic extends ISpecialArmorLogic { | ||
|
||
boolean mayBreatheWith(ItemStack stack, EntityPlayer player); | ||
|
||
|
||
double tryTick(ItemStack stack, EntityPlayer player); | ||
|
||
default ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, double damage, | ||
EntityEquipmentSlot equipmentSlot) { | ||
return new ISpecialArmor.ArmorProperties(0, 0, (int) player.getMaxHealth()); | ||
} | ||
|
||
default int getArmorDisplay(EntityPlayer player, @NotNull ItemStack armor, int slot) { | ||
return 0; | ||
} | ||
|
||
void addInformation(ItemStack stack, List<String> tooltips); | ||
|
||
@Override | ||
default void addToolComponents(ArmorMetaItem.ArmorMetaValueItem metaValueItem) { | ||
metaValueItem.addComponents(new TooltipBehavior((ignored) -> { | ||
}) { | ||
@Override | ||
public void addInformation(ItemStack itemStack, @NotNull List<String> lines) { | ||
IBreathingArmorLogic.this.addInformation(itemStack, lines); | ||
} | ||
}, new IItemBehaviour() { | ||
|
||
@Override | ||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { | ||
return onRightClick(world, player, hand); | ||
} | ||
}); | ||
} | ||
|
||
default ActionResult<ItemStack> onRightClick(World world, EntityPlayer player, EnumHand hand) { | ||
if (player.getHeldItem(hand).getItem() instanceof ArmorMetaItem) { | ||
ItemStack armor = player.getHeldItem(hand); | ||
if (armor.getItem() instanceof ArmorMetaItem && | ||
player.inventory.armorInventory.get(getEquipmentSlot(armor).getIndex()).isEmpty() && | ||
!player.isSneaking()) { | ||
player.inventory.armorInventory.set(getEquipmentSlot(armor).getIndex(), armor.copy()); | ||
player.setHeldItem(hand, ItemStack.EMPTY); | ||
player.playSound(new SoundEvent(new ResourceLocation("item.armor.equip_generic")), 1.0F, 1.0F); | ||
return ActionResult.newResult(EnumActionResult.SUCCESS, armor); | ||
} | ||
} | ||
|
||
return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); | ||
} | ||
} |
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,12 @@ | ||
package supersymmetry.api.items; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import java.util.List; | ||
|
||
public interface IBreathingItem { | ||
boolean isValid(ItemStack stack, EntityPlayer player); | ||
|
||
double tryTick(ItemStack stack, EntityPlayer player); | ||
} |
3 changes: 2 additions & 1 deletion
3
src/main/java/supersymmetry/api/unification/material/properties/SuSyMaterialProperties.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
15 changes: 15 additions & 0 deletions
15
src/main/java/supersymmetry/api/util/SuSyDamageSources.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,15 @@ | ||
package supersymmetry.api.util; | ||
import net.minecraft.util.DamageSource; | ||
|
||
public class SuSyDamageSources { | ||
private static final DamageSource SUFFOCATION = new DamageSource("suffocation").setDamageBypassesArmor(); | ||
private static final DamageSource TOXIC_ATMO = new DamageSource("toxic_atmo").setDamageBypassesArmor(); | ||
|
||
public static DamageSource getSuffocationDamage() { | ||
return SUFFOCATION; | ||
} | ||
|
||
public static DamageSource getToxicAtmoDamage() { | ||
return TOXIC_ATMO; | ||
} | ||
} |
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
55 changes: 55 additions & 0 deletions
55
src/main/java/supersymmetry/client/renderer/handler/BreathingApparatusModel.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,55 @@ | ||
package supersymmetry.client.renderer.handler; | ||
|
||
import net.minecraft.client.model.ModelBiped; | ||
import net.minecraft.inventory.EntityEquipmentSlot; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static supersymmetry.api.util.SuSyUtility.susyId; | ||
|
||
public class BreathingApparatusModel extends ModelBiped { | ||
public BreathingApparatusModel(String name, EntityEquipmentSlot slot) { | ||
this.textureWidth = 64; | ||
this.textureHeight = 64; | ||
|
||
this.bipedHead.cubeList.clear(); | ||
this.bipedHeadwear.cubeList.clear(); | ||
this.bipedBody.cubeList.clear(); | ||
this.bipedRightArm.cubeList.clear(); | ||
this.bipedLeftArm.cubeList.clear(); | ||
this.bipedLeftLeg.cubeList.clear(); | ||
this.bipedRightLeg.cubeList.clear(); | ||
|
||
addChildren(name, slot); | ||
} | ||
|
||
public void addChildren(String name, EntityEquipmentSlot slot) { | ||
switch (slot) { | ||
case FEET -> { | ||
this.bipedLeftLeg.addChild(modelForPart(name, "left_foot")); | ||
this.bipedRightLeg.addChild(modelForPart(name, "right_foot")); | ||
} | ||
case CHEST -> { | ||
this.bipedBody.addChild(modelForPart(name, "chest")); | ||
this.bipedLeftArm.addChild(modelForPart(name, "left_arm")); | ||
this.bipedRightArm.addChild(modelForPart(name, "right_arm")); | ||
} | ||
case LEGS -> { | ||
this.bipedBody.addChild(modelForPart(name, "belt")); | ||
this.bipedLeftLeg.addChild(modelForPart(name, "left_leg")); | ||
this.bipedRightLeg.addChild(modelForPart(name, "right_leg")); | ||
} | ||
case HEAD -> this.bipedHead.addChild(modelForPart(name, "head")); | ||
} | ||
} | ||
|
||
public ResourceLocation modelLocationFromPart(String armor, String model) { | ||
return susyId("models/armor/" + armor + "_" + model + ".obj"); | ||
} | ||
|
||
public OBJModelRender modelForPart(String armor, String model) { | ||
return new OBJModelRender(this, modelLocationFromPart(armor, model), 17); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/supersymmetry/client/renderer/handler/ITextureRegistrar.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,12 @@ | ||
package supersymmetry.client.renderer.handler; | ||
|
||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
import java.util.List; | ||
|
||
public interface ITextureRegistrar { | ||
@SideOnly(Side.CLIENT) | ||
List<ResourceLocation> getTextureLocations(); | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/supersymmetry/client/renderer/handler/SimpleBreathingApparatusModel.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,40 @@ | ||
package supersymmetry.client.renderer.handler; | ||
|
||
import net.minecraft.client.model.ModelBiped; | ||
import net.minecraft.inventory.EntityEquipmentSlot; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
import static supersymmetry.api.util.SuSyUtility.susyId; | ||
|
||
public class SimpleBreathingApparatusModel extends ModelBiped { | ||
public SimpleBreathingApparatusModel(String name, EntityEquipmentSlot slot) { | ||
this.textureWidth = 64; | ||
this.textureHeight = 64; | ||
|
||
this.bipedHead.cubeList.clear(); | ||
this.bipedHeadwear.cubeList.clear(); | ||
this.bipedBody.cubeList.clear(); | ||
this.bipedRightArm.cubeList.clear(); | ||
this.bipedLeftArm.cubeList.clear(); | ||
this.bipedLeftLeg.cubeList.clear(); | ||
this.bipedRightLeg.cubeList.clear(); | ||
|
||
addChildren(name, slot); | ||
} | ||
|
||
public void addChildren(String name, EntityEquipmentSlot slot) { | ||
switch (slot) { | ||
case CHEST -> this.bipedBody.addChild(modelForPart(name, "tank")); | ||
case HEAD -> this.bipedHead.addChild(modelForPart(name, "mask")); | ||
} | ||
} | ||
|
||
public ResourceLocation modelLocationFromPart(String armor, String model) { | ||
return susyId("models/armor/" + armor + "_" + model + ".obj"); | ||
} | ||
|
||
public OBJModelRender modelForPart(String armor, String model) { | ||
return new OBJModelRender(this, modelLocationFromPart(armor, model), 17); | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.