Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
huige233 committed Oct 5, 2022
1 parent e1d5416 commit ede9ab0
Show file tree
Hide file tree
Showing 36 changed files with 684 additions and 66 deletions.
7 changes: 2 additions & 5 deletions src/main/java/huige233/transcend/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
modid = Reference.MOD_ID,
name = Reference.NAME,
version = Reference.VERSION,
//dependencies = "required-after:avaritia@[3.3.0,)",
//dependencies = "required-after:mixinbooter@[0.0,)",
// dependencies = "required-after:tconstruct@[1.10.2-2.5.0,);required-after:mantle@[1.10.2-1.0.0,)",
dependencies = "required-after:mixinbooter@[0.0,)",
dependencies = "required-after:mixinbooter@[0.0,)",//;required-after:mantle@[1.10.2-1.0.0,)",
acceptedMinecraftVersions = "[1.12.2]"
)
public class Main {
Expand Down Expand Up @@ -66,7 +63,7 @@ public void init(FMLInitializationEvent event) {
*/
@Mod.EventHandler
public void postinit(FMLPostInitializationEvent event) {

proxy.postInit(event);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package huige233.transcend.compat.tinkers;

import com.google.common.collect.Lists;
import huige233.transcend.init.ModBlock;
import huige233.transcend.init.ModItems;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import slimeknights.tconstruct.library.TinkerRegistry;
import slimeknights.tconstruct.library.client.MaterialRenderInfo;
import slimeknights.tconstruct.library.fluid.FluidColored;
import slimeknights.tconstruct.library.materials.*;
import slimeknights.tconstruct.library.smeltery.Cast;
import slimeknights.tconstruct.library.tinkering.MaterialItem;
Expand Down
29 changes: 16 additions & 13 deletions src/main/java/huige233/transcend/compat/tinkers/conarmConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import c4.conarm.lib.materials.PlatesMaterialStats;
import c4.conarm.lib.materials.TrimMaterialStats;
import com.google.common.collect.Lists;
import huige233.transcend.init.ModItems;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import slimeknights.tconstruct.library.TinkerRegistry;
import slimeknights.tconstruct.library.materials.Material;
Expand All @@ -31,20 +32,22 @@ private static Material mat(String name, int color) {

@SubscribeEvent
public static void setup() {
ArmorMaterials.addArmorTrait(flawless,ArmorTraits.tasty);
ArmorMaterials.addArmorTrait(flawless,TraitArmorFlawless.a);
TinkerRegistry.addMaterialStats(flawless,
new CoreMaterialStats(63,63),
new PlatesMaterialStats(4,36,9.9f),
new TrimMaterialStats(63.0f));
flawless.addItem(ModItems.FLAWLESS);
transcend.addItem(ModItems.TRANSCEND);
ArmorMaterials.addArmorTrait(flawless,ArmorTraits.tasty);
ArmorMaterials.addArmorTrait(flawless,TraitArmorFlawless.a);
TinkerRegistry.addMaterialStats(flawless,
new CoreMaterialStats(63,63),
new PlatesMaterialStats(4,36,9.9f),
new TrimMaterialStats(63.0f));

ArmorMaterials.addArmorTrait(transcend,TraitArmorTranscend.a);
TinkerRegistry.addMaterialStats(transcend,
new CoreMaterialStats(999999,999999),
new PlatesMaterialStats(999999,999999,9999.99f),
new TrimMaterialStats(9999.99f));
ArmorMaterials.addArmorTrait(transcend,TraitArmorTranscend.a);
TinkerRegistry.addMaterialStats(transcend,
new CoreMaterialStats(999999,999999),
new PlatesMaterialStats(999999,999999,9999.99f),
new TrimMaterialStats(9999.99f));

TinkerRegistry.integrate(flawless).preInit();
TinkerRegistry.integrate(transcend).preInit();
TinkerRegistry.integrate(flawless).preInit();
TinkerRegistry.integrate(transcend).preInit();
}
}
7 changes: 3 additions & 4 deletions src/main/java/huige233/transcend/init/ModItems.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package huige233.transcend.init;

import huige233.transcend.Main;
import huige233.transcend.items.InfinityFood;
import huige233.transcend.items.ItemBase;
import huige233.transcend.items.ItemTranscendShield;
import huige233.transcend.items.armor.ArmorBase;
Expand All @@ -21,9 +22,6 @@ public class ModItems {

public static EnumRarity COSMIC_RARITY = EnumHelper.addRarity("COSMIC", TextFormatting.RED, "Cosmic");
public static final List<Item> ITEMS = new ArrayList<Item>();

public static final Item QS = new ItemBase("qs",Main.TranscendTab);

public static final Item TRANSCEND = new ItemBase("transcend", Main.TranscendTab);
public static final Item FLAWLESS = new ItemBase("flawless", Main.TranscendTab);
public static final ArmorMaterial flawless_armor = EnumHelper.addArmorMaterial("flawless_alloy","",0,new int[] {1000,1000,1000,1000},1000, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN,1000.0f);
Expand All @@ -50,7 +48,8 @@ public class ModItems {
public static final ToolMaterial Invulnera = EnumHelper.addToolMaterial("Invulnera",0,0,1,-4,0);
public static final ItemSword Invulnerable = new ItemInvulnerable("invulnerable",Invulnera);
public static final ItemSword TimeStop = new ItemTimeStop("timestop",Invulnera);
public static final Item TRANSCEND_SHIELD = new ItemTranscendShield("transcend_shield",Main.TranscendTab);
public static final Item ITEM_XP = new ItemXp("transcend_xp",Main.TranscendTab);
public static final Item TravelStaff = new ItemTravelStaff("travel_staff",Main.TranscendTab);
public static final ItemFood InfinityFood = new InfinityFood();
//public static final ItemSword a = new TranscendSword("tr",Main.TranscendTab,transcend_tool);
}
58 changes: 58 additions & 0 deletions src/main/java/huige233/transcend/items/InfinityFood.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package huige233.transcend.items;

import huige233.transcend.Main;
import huige233.transcend.init.ModItems;
import huige233.transcend.util.IHasModel;
import huige233.transcend.util.Reference;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Locale;

public class InfinityFood extends ItemFood implements IHasModel {
public InfinityFood(){
super(20,10.f,false);
this.setMaxStackSize(1);
this.setTranslationKey("infinity_food");
this.setAlwaysEdible();
setRegistryName("infinity_food");
this.setCreativeTab(Main.TranscendTab);
addPropertyOverride(new ResourceLocation(Reference.MOD_ID,"easter"),(stack, worldIn, entityIn) -> InfinityFood.isEaster(stack)?1F:0F);
ModItems.ITEMS.add(this);
}

@Override
public void registerModels() {
Main.proxy.registerItemRenderer(this, 0, "inventory");
}

@Override
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entity) {
if (entity instanceof EntityPlayer){
stack.grow(1);
}
return super.onItemUseFinish(stack,world,entity);
}

public int getMaxItemUseDuration(ItemStack stack)
{
return 8;
}

@SideOnly(Side.CLIENT)
public boolean hasEffect( ItemStack stack)
{
return true;
}

public static boolean isEaster(ItemStack stack){
String name = stack.getDisplayName().toLowerCase(Locale.ROOT).trim();
return name.equals("azazel sakura");
}
}
69 changes: 59 additions & 10 deletions src/main/java/huige233/transcend/items/armor/ArmorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import huige233.transcend.compat.PsiCompat;
import huige233.transcend.init.ModItems;
import huige233.transcend.items.fireimmune;
import huige233.transcend.lib.TranscendDamageSources;
import huige233.transcend.util.ArmorUtils;
import huige233.transcend.util.IHasModel;
import huige233.transcend.util.ItemNBTHelper;
import huige233.transcend.util.Reference;
import huige233.transcend.util.handlers.EnergeticHandler;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
Expand All @@ -31,13 +33,11 @@
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
Expand All @@ -56,7 +56,7 @@
@Optional.Interface(iface = "thaumcraft.api.items.IVisDiscountGear", modid = "thaumcraft")
@Optional.Interface(iface = "thaumcraft.api.items.IRechargable", modid = "thaumcraft")
@Optional.Interface(iface = "thaumcraft.api.items.IGoggles",modid = "thaumcraft")
public class ArmorBase extends ItemArmor implements IHasModel, IVisDiscountGear, IRechargable, IGoggles {
public class ArmorBase extends ItemArmor implements IHasModel, IVisDiscountGear, IRechargable, IGoggles, EnergeticHandler {
public ArmorBase(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, CreativeTabs tab) {
super(materialIn, renderIndexIn, equipmentSlotIn);
setTranslationKey(name);
Expand Down Expand Up @@ -86,17 +86,21 @@ public static void onPlayerDeath(LivingDeathEvent event) {
event.getEntityLiving().setHealth(player.getMaxHealth());
event.getEntityLiving().isDead = false;
event.getEntityLiving().deathTime = 0;
player.world.playerEntities.add(player);
player.world.onEntityAdded(player);
player.world.setEntityState(event.getEntityLiving(), (byte)35);
}
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onPlayerHurt(LivingHurtEvent event) {
if (!(event.getEntityLiving() instanceof EntityPlayer) || event.isCanceled())
return;
if (!(event.getEntityLiving() instanceof EntityPlayer) || event.isCanceled()) return;
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (!player.isServerWorld())
return;
if (!player.isServerWorld()) return;
if (ArmorUtils.fullEquipped(player)) {
event.getSource().getTrueSource().attackEntityFrom((new TranscendDamageSources(player)).setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(), Float.MAX_VALUE);
player.world.playerEntities.add(player);
player.world.onEntityAdded(player);
event.setCanceled(true);
}
}
Expand Down Expand Up @@ -169,14 +173,20 @@ public void onArmorTick(@NotNull World world, @NotNull EntityPlayer player, @Not
if (ArmorUtils.fullEquipped(player)) {
player.setEntityInvulnerable(true);
player.setHealth(player.getMaxHealth());
if(player.getAbsorptionAmount()<2048){
player.setAbsorptionAmount(2048);
}
if(player.getHeldItemMainhand().getItem()==ModItems.TRANSCEND_SWORD){
if(!ItemNBTHelper.getBoolean(player.getHeldItem(EnumHand.MAIN_HAND),"Invul",false)){
ItemNBTHelper.setBoolean(player.getHeldItem(EnumHand.MAIN_HAND),"Invul",true);
}
}
if(player.isDead){
player.world.playerEntities.add(player);
player.world.onEntityAdded(player);
player.isDead=false;
}
player.inventoryContainer.detectAndSendChanges();
} else if(!ArmorUtils.fullEquipped(player)) {
if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.TRANSCEND_SWORD) {
if (ItemNBTHelper.getBoolean(player.getHeldItem(EnumHand.MAIN_HAND), "Invul", false)) {
Expand All @@ -191,16 +201,51 @@ public void onArmorTick(@NotNull World world, @NotNull EntityPlayer player, @Not
if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.TRANSCEND_SWORD) {
if (ItemNBTHelper.getBoolean(player.getHeldItem(EnumHand.MAIN_HAND), "Invul", false)) {
if(player.isDead){
player.world.playerEntities.add(player);
player.world.onEntityAdded(player);
player.isDead=false;
}
}
}
}

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerRender(RenderPlayerEvent.Pre event){
public static void onPlayerRender(RenderPlayerEvent.Pre event){
EntityPlayer player = event.getEntityPlayer();
if(ArmorUtils.fullEquipped(player)&&player.getHeldItemMainhand().getItem() == ModItems.TRANSCEND_SWORD){
event.setCanceled(true);
}
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void DeSpawn(LivingSpawnEvent.AllowDespawn event){
if(event.getEntityLiving() instanceof EntityPlayer){
if(ArmorUtils.fullEquipped((EntityPlayer) event.getEntityLiving())) {
event.setResult(Event.Result.DENY);
}
}
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void LivingDrop(LivingDropsEvent event){
EntityLivingBase entity = event.getEntityLiving();
if(entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer) entity;
if(ArmorUtils.fullEquipped(player)){
player.world.playerEntities.add(player);
player.world.onEntityAdded(player);
event.setCanceled(true);
}
}
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void PlayerDrop(PlayerDropsEvent event){
EntityPlayer player = event.getEntityPlayer();
if(ArmorUtils.fullEquipped(player)){
player.world.playerEntities.add(player);
player.world.onEntityAdded(player);
event.setCanceled(true);
}
}
Expand Down Expand Up @@ -306,4 +351,8 @@ public EnumChargeDisplay showInHud(ItemStack itemStack, EntityLivingBase entityL
public boolean showIngamePopups(ItemStack itemStack, EntityLivingBase entityLivingBase) {
return true;
}

public int getEnergyStored(){
return 50000000;
}
}
3 changes: 2 additions & 1 deletion src/main/java/huige233/transcend/items/fireimmune.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.item.ItemExpireEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import javax.annotation.Nonnull;

@Mod.EventBusSubscriber
public class fireimmune extends EntityItem {
public fireimmune(World world, Entity location, ItemStack stack) {
this(world, location.posX, location.posY, location.posZ, stack);
Expand Down
Loading

0 comments on commit ede9ab0

Please sign in to comment.