Skip to content

Commit

Permalink
add any character and fix any bug
Browse files Browse the repository at this point in the history
also remove HIM
  • Loading branch information
huige233 committed Apr 20, 2022
1 parent 72b14ca commit 783d38b
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'org.spongepowered.mixin'

group = 'huige233'
version = '1.0.4'
version = '1.0.5'
archivesBaseName = 'transcend'

minecraft {
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/huige233/transcend/compat/PsiCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
import vazkii.psi.api.cad.RegenPsiEvent;
import vazkii.psi.common.core.handler.PlayerDataHandler;

@Mod.EventBusSubscriber
public class PsiCompat {
public static boolean enabled = false;

public static void onPlayerAttack(EntityPlayer player, EntityPlayer attacker) {
if (!enabled) return;
if(player.world.isRemote) return;
PlayerDataHandler.PlayerData data = PlayerDataHandler.get(attacker);
ItemStack cadItem = PsiAPI.getPlayerCAD(attacker);
Expand All @@ -34,7 +32,6 @@ public static void onPlayerAttack(EntityPlayer player, EntityPlayer attacker) {


public void hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase player) {
if (!enabled) return;
if(player.world.isRemote) {return;}
if(target instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) target;
Expand All @@ -60,7 +57,6 @@ public void hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase

@SubscribeEvent
public static void onPsiRegen(RegenPsiEvent event) {
if (!enabled) return;
EntityPlayer player = event.getPlayer();
//if(player.world.isRemote) return;
if(ArmorUtils.fullEquipped(player)){
Expand Down
1 change: 0 additions & 1 deletion src/main/java/huige233/transcend/init/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import huige233.transcend.items.armor.ArmorBase;
import huige233.transcend.items.tools.*;
import huige233.transcend.util.Reference;
import joptsimple.OptionSpec;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.*;
Expand Down
33 changes: 28 additions & 5 deletions src/main/java/huige233/transcend/items/armor/ArmorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
Expand All @@ -35,6 +36,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.UUID;

@Mod.EventBusSubscriber(modid = Reference.MOD_ID)
public class ArmorBase extends ItemArmor implements IHasModel {
Expand Down Expand Up @@ -132,17 +134,38 @@ public void onArmorTick(@NotNull World world, @NotNull EntityPlayer player, @Not
} else if (ArmorUtils.fullEquipped(player)) {
if(!player.world.isRemote) {
Multimap<String, AttributeModifier> attributes = HashMultimap.create();
fillModifiers(attributes);
player.getAttributeMap().applyAttributeModifiers(attributes);
if(attributes.isEmpty()) return;
attributes.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier("Flawless", 1000, 0).setSaved(false));

player.setHealth(player.getMaxHealth());
}
}
}

private void fillModifiers(Multimap<String, AttributeModifier> attributes) {
attributes.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier( "transcend", 1000, 0).setSaved(false));
@Override
public Multimap<String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> attrib = super.getAttributeModifiers(slot, stack);
Item item = stack.getItem();
UUID uuid = new UUID(slot.toString().hashCode(), 0);
if (slot == EntityEquipmentSlot.HEAD) {
if(item == ModItems.FLAWLESS_HELMET) {
attrib.put(SharedMonsterAttributes.LUCK.getName(), new AttributeModifier(uuid, "Flawless", 1000, 0));
}
} else if (slot == EntityEquipmentSlot.CHEST) {
if(item == ModItems.FLAWLESS_CHESTPLATE) {
attrib.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier(uuid, "Flawless", 1000, 0));
}
} else if (slot == EntityEquipmentSlot.LEGS) {
if(item == ModItems.FLAWLESS_LEGGINGS) {
attrib.put(SharedMonsterAttributes.FOLLOW_RANGE.getName(), new AttributeModifier(uuid, "Flawless", 1000, 0));
}
} else if (slot == EntityEquipmentSlot.FEET) {
if(item == ModItems.FLAWLESS_BOOTS) {
attrib.put(SharedMonsterAttributes.MOVEMENT_SPEED.getName(), new AttributeModifier(uuid, "Flawless", 0.2, 1));
}
} else if(slot == armorType) {
attrib.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(uuid, "Flawless", 1000, 0));
}
return attrib;
}

public boolean hasCustomEntity(ItemStack stack) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/huige233/transcend/items/fireimmune.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class fireimmune extends EntityItem {
public fireimmune(World world, Entity location, ItemStack stack) {
this(world, location.posX, location.posY, location.posZ, stack);
this.setPickupDelay(20);
this.setPickupDelay(0);
this.motionX = location.motionX;
this.motionY = location.motionY;
this.motionZ = location.motionZ;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/huige233/transcend/items/tools/ToolPickaxe.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package huige233.transcend.items.tools;

import com.google.common.collect.Multimap;
import huige233.transcend.Main;
import huige233.transcend.init.ModItems;
import huige233.transcend.items.fireimmune;
import huige233.transcend.util.IHasModel;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
Expand All @@ -17,6 +21,8 @@
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;

import java.util.UUID;

public class ToolPickaxe extends ItemPickaxe implements IHasModel {
public ToolPickaxe(String name, CreativeTabs tab, ToolMaterial material) {
super(material);
Expand Down Expand Up @@ -50,6 +56,16 @@ public Entity createEntity(World world,Entity location, ItemStack itemstack) {
return new fireimmune(world,location,itemstack);
}

public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> attrib = super.getAttributeModifiers(slot, stack);
UUID uuid = new UUID((slot.toString()).hashCode(), 0);
if(slot == EntityEquipmentSlot.MAINHAND) {
attrib.put(EntityPlayer.REACH_DISTANCE.getName(),
new AttributeModifier(uuid,"Pickaxe modifier",256,0));
}
return attrib;
}

public EnumRarity getRarity(ItemStack stack )
{
return(ModItems.COSMIC_RARITY);
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/huige233/transcend/items/tools/ToolSword.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
package huige233.transcend.items.tools;

import com.google.common.collect.Multimap;
import huige233.transcend.Main;
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.Reference;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;

import javax.annotation.Nonnull;
import java.util.UUID;


public class ToolSword extends ItemSword implements IHasModel {
public ToolSword(String name, CreativeTabs tab,ToolMaterial material) {
Expand Down Expand Up @@ -58,6 +66,18 @@ public Entity createEntity(World world,Entity location, ItemStack itemstack) {
return new fireimmune(world,location,itemstack);
}

public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> attrib = super.getAttributeModifiers(slot, stack);
UUID uuid = new UUID((slot.toString()).hashCode(), 0);
if(slot == EntityEquipmentSlot.MAINHAND) {
attrib.put(SharedMonsterAttributes.ATTACK_SPEED.getName(),
new AttributeModifier(uuid,"Weapon modifier",0.99,1));
attrib.put(EntityPlayer.REACH_DISTANCE.getName(),
new AttributeModifier(uuid,"Weapon modifier",256,0));
}
return attrib;
}

public EnumRarity getRarity(ItemStack stack )
{
return(ModItems.COSMIC_RARITY);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/huige233/transcend/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import huige233.transcend.compat.Avartiabreak;
import huige233.transcend.compat.PsiCompat;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand All @@ -21,7 +22,7 @@ public void preInit( FMLPreInitializationEvent event )
public void init( FMLInitializationEvent event )
{
if(Loader.isModLoaded("psi")){
PsiCompat.enabled = true;
MinecraftForge.EVENT_BUS.register(PsiCompat.class);
}
if(Loader.isModLoaded("avartia")) {
Avartiabreak.enabled = true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/huige233/transcend/util/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class Reference {
public static final String MOD_ID = "transcend";
public static final String NAME = "Transcend";
public static final String VERSION = "1.0.4";
public static final String VERSION = "1.0.5";
public static final String ACCEPTED_VERSIONS = "[1.12.2]";
public static final String CLIENT_PROXY_CLASS = "huige233.transcend.proxy.ClientProxy";
public static final String COMMON_PROXY_CLASS = "huige233.transcend.proxy.CommonProxy";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "transcend:block/transcend_block"
"all": "transcend:blocks/transcend_block"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"parent" : "transcend:transcend_block"
"parent" : "transcend:block/transcend_block"
}
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "transcend",
"name": "transcend",
"description": "Tconstruct, an accessory, offers supermodel metal",
"version": "1.0.4",
"version": "1.0.5",
"mcversion": "1.12.2",
"url": "",
"updateUrl": "",
Expand Down

0 comments on commit 783d38b

Please sign in to comment.