Skip to content

Commit

Permalink
add Creative RF Source and EU Source
Browse files Browse the repository at this point in the history
  • Loading branch information
huige233 committed Sep 8, 2022
1 parent 4168a07 commit 944db51
Show file tree
Hide file tree
Showing 21 changed files with 385 additions and 156 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ mixin {

dependencies {
implementation 'org.jetbrains:annotations:23.0.0'
compile 'net.industrial-craft:industrialcraft-2:2.2.650-experimental:api'
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "com.github.mcjty:mcjtylib:${mc_short}-${mcjtylib_version}"
deobfCompile "vazkii.botania:Botania:${botania_version}"
Expand Down
Binary file added libs/industrialcraft-2-2.8.188-ex112.jar
Binary file not shown.
19 changes: 19 additions & 0 deletions src/main/java/huige233/transcend/compat/botaniasword.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
package huige233.transcend.compat;

import huige233.transcend.Main;
import huige233.transcend.init.ModItems;
import huige233.transcend.util.ItemNBTHelper;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.common.Optional;
import org.jetbrains.annotations.NotNull;
import vazkii.botania.api.mana.ICreativeManaProvider;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaTooltipDisplay;

public class botaniasword implements ICreativeManaProvider, IManaItem, IManaTooltipDisplay {
public botaniasword() {

}

public void getSubItems(@NotNull CreativeTabs tab,NonNullList<ItemStack> stack) {
if(tab == Main.TranscendTab){
ItemStack create = new ItemStack(ModItems.TRANSCEND_SWORD);
setMana(create, MAX_MANA);
isCreative(create);
setStackCreative(create);
stack.add(create);
}
}
protected static final int MAX_MANA = Integer.MAX_VALUE;
private static final String TAG_CREATIVE = "creative";
private static final String TAG_ONE_USE = "oneUse";
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/huige233/transcend/init/ModBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import huige233.transcend.blocks.bedrockorz;
import huige233.transcend.blocks.voidblock;
import huige233.transcend.tileEntity.BlockBedRockCollector;
import huige233.transcend.tileEntity.BlockCreativeRFSource;
import huige233.transcend.tileEntity.BlockVirusGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand All @@ -20,4 +21,5 @@ public class ModBlock {
public static final Block BEDROCK_COLLECTOR = new BlockBedRockCollector("bedrock_collector").setHardness(5.0f);
public static final Block CAST_MACHINE = new BlockVirusGenerator("cast_machine");
public static final Block NETHER_STAR_BLOCK = new BlockBase("nether_star_block", Material.ROCK).setHardness(5.0F);
public static final Block CREATIVERFSOURCE = new BlockCreativeRFSource();
}
47 changes: 40 additions & 7 deletions src/main/java/huige233/transcend/items/armor/ArmorBase.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package huige233.transcend.items.armor;

import c4.conarm.common.armor.modifiers.accessories.AbstractTravelGoggles;
import c4.conarm.lib.modifiers.IToggleable;
import com.google.common.collect.Collections2;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -29,17 +31,23 @@
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.client.event.FOVUpdateEvent;
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.player.AttackEntityEvent;
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.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
import slimeknights.tconstruct.library.utils.ModifierTagHolder;
import thaumcraft.api.items.IGoggles;
import thaumcraft.api.items.IRechargable;
import thaumcraft.api.items.IVisDiscountGear;

Expand All @@ -50,7 +58,8 @@
@Mod.EventBusSubscriber(modid = Reference.MOD_ID)
@Optional.Interface(iface = "thaumcraft.api.items.IVisDiscountGear", modid = "thaumcraft")
@Optional.Interface(iface = "thaumcraft.api.items.IRechargable", modid = "thaumcraft")
public class ArmorBase extends ItemArmor implements IHasModel, IVisDiscountGear, IRechargable {
@Optional.Interface(iface = "thaumcraft.api.items.IGoggles",modid = "thaumcraft")
public class ArmorBase extends ItemArmor implements IHasModel, IVisDiscountGear, IRechargable, IGoggles {
public ArmorBase(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, CreativeTabs tab) {
super(materialIn, renderIndexIn, equipmentSlotIn);
setTranslationKey(name);
Expand Down Expand Up @@ -98,22 +107,30 @@ public static void onPlayerHurt(LivingHurtEvent event) {
}
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void PlayerDropsEvent(PlayerDropsEvent event){
if(ArmorUtils.fullEquipped(event.getEntityPlayer())){
event.setCanceled(true);
}
}


@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void LivingAttackEvent(LivingAttackEvent event) {
if (!(event.getEntityLiving() instanceof EntityPlayer) || event.isCanceled())
return;
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (player.world.isRemote)
return;
NonNullList<ItemStack> armor = player.inventory.armorInventory;
if (armor.get(3).getItem() == ModItems.FLAWLESS_HELMET && armor.get(2).getItem() == ModItems.FLAWLESS_CHESTPLATE && armor.get(1).getItem() == ModItems.FLAWLESS_LEGGINGS && armor.get(0).getItem() == ModItems.FLAWLESS_BOOTS) {
if (ArmorUtils.fullEquipped(player)) {
Entity attacker = event.getSource().getTrueSource();
if (attacker instanceof EntityPlayer) {
PsiCompat.onPlayerAttack(player, (EntityPlayer) attacker);
}
event.setCanceled(true);
}
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void AttackEvent(AttackEntityEvent event){

}

Expand Down Expand Up @@ -152,6 +169,9 @@ public void onArmorTick(@NotNull World world, @NotNull EntityPlayer player, @Not
ItemNBTHelper.setBoolean(player.getHeldItem(EnumHand.MAIN_HAND),"Invul",true);
}
}
if(player.isDead){
player.isDead=false;
}
} 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 @@ -163,9 +183,16 @@ 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.isDead=false;
}
}
}
}

@SubscribeEvent
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerRender(RenderPlayerEvent.Pre event){
EntityPlayer player = event.getEntityPlayer();
if(ArmorUtils.fullEquipped(player)){
Expand Down Expand Up @@ -255,6 +282,12 @@ public int getMaxCharge(ItemStack itemStack, EntityLivingBase entityLivingBase)
@Override
@Optional.Method(modid = "thaumcraft")
public EnumChargeDisplay showInHud(ItemStack itemStack, EntityLivingBase entityLivingBase) {
return null;
return EnumChargeDisplay.PERIODIC;
}

@Override
@Optional.Method(modid = "thaumcraft")
public boolean showIngamePopups(ItemStack itemStack, EntityLivingBase entityLivingBase) {
return true;
}
}
9 changes: 2 additions & 7 deletions src/main/java/huige233/transcend/items/tools/ToolPickaxe.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public ToolPickaxe(String name, CreativeTabs tab, ToolMaterial material) {
ModItems.ITEMS.add(this);
}

private int tick = 0;

@Override
public void registerModels() {
Main.proxy.registerItemRenderer(this, 0, "inventory");
Expand Down Expand Up @@ -116,11 +114,8 @@ public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer pla
return false;
}
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
EntityPlayer p = (EntityPlayer) victim;
if (!ArmorUtils.fullEquipped(p)) {
int i = 10;
victim.addVelocity(-MathHelper.sin((double)(player.rotationYaw * 3.1415927F / 180.0F)) * (double)i * 0.5, 2.0, MathHelper.cos((double)(player.rotationYaw * 3.1415927F / 180.0F)) * (double)i * 0.5);
}
int i = 30;
victim.addVelocity(-MathHelper.sin((double)(player.rotationYaw * 3.1415927F / 180.0F)) * (double)i * 0.5, 2.0, MathHelper.cos((double)(player.rotationYaw * 3.1415927F / 180.0F)) * (double)i * 0.5);
return true;
}

Expand Down
Loading

0 comments on commit 944db51

Please sign in to comment.