Skip to content

Commit

Permalink
fix7
Browse files Browse the repository at this point in the history
  • Loading branch information
huige233 committed Jan 7, 2023
1 parent fba36e8 commit 91b4cd3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
16 changes: 13 additions & 3 deletions src/main/java/huige233/transcend/init/ModBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
import huige233.transcend.blocks.BlockBase;
import huige233.transcend.blocks.bedrockorz;
import huige233.transcend.blocks.voidblock;
import huige233.transcend.compat.ThaumcraftCompat;
import huige233.transcend.tileEntity.BlockBedRockCollector;
import huige233.transcend.tileEntity.BlockCreativeRFSource;
import huige233.transcend.tileEntity.BlockUltraManaPool;
import huige233.transcend.tileEntity.BlockVirusGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.ArrayList;
import java.util.List;

@Mod.EventBusSubscriber
public class ModBlock {
public static final List<Block> BLOCKS = new ArrayList<Block>();
public static final Block TRANSCEND_BLOCK = new BlockBase("transcend_block", Material.ROCK);
Expand All @@ -25,5 +27,13 @@ public class ModBlock {
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();
public static final Block ULTRAMANAPOOL = new BlockUltraManaPool();
public static Block ULTRAMANAPOOL = null;

@SubscribeEvent
public static void onBlockRegister(RegistryEvent.Register<Block> event) {
if(Loader.isModLoaded("botania")){
ULTRAMANAPOOL = new BlockUltraManaPool();
event.getRegistry().registerAll(ULTRAMANAPOOL);
}
}
}
13 changes: 2 additions & 11 deletions src/main/java/huige233/transcend/items/tools/ToolSword.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,32 @@
import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.network.play.server.SPacketCustomSound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Optional;
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 vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.ICreativeManaProvider;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaTooltipDisplay;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketLeftClick;
Expand All @@ -75,6 +66,7 @@
@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.mana.IManaTooltipDisplay")
@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.mana.IManaItem")
@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.mana.ICreativeManaProvider")
@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.mana.IManaUsingItem")
@Optional.Interface(modid = RedstoneFluxProps.MOD_ID, iface = "cofh.redstoneflux.api.IEnergyContainerItem")
@Mod.EventBusSubscriber(modid = Reference.MOD_ID)
public class ToolSword extends ItemSword implements IHasModel, ICreativeManaProvider, IManaItem, IManaTooltipDisplay, IEnergyContainerItem, IManaUsingItem {
Expand Down Expand Up @@ -218,8 +210,6 @@ public boolean onLeftClickEntity(@NotNull ItemStack stack, @NotNull EntityPlayer
return false;
}



@Override
public @NotNull ActionResult<ItemStack> onItemRightClick(@NotNull World world, EntityPlayer player, @NotNull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
Expand Down Expand Up @@ -457,6 +447,7 @@ public int getMaxEnergyStored(ItemStack itemStack) {
return Integer.MAX_VALUE;
}

@Optional.Method(modid = LibMisc.MOD_ID)
@Override
public boolean usesMana(ItemStack stack) {
return false;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/huige233/transcend/items/tools/ToolWarp.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipment
return attrib;
}

@Optional.Method(modid = LibMisc.MOD_ID)
@SubscribeEvent
public void attackEntity(AttackEntityEvent event){
if(!event.getEntityPlayer().world.isRemote){
Expand Down Expand Up @@ -143,11 +144,13 @@ public EntityManaBurst getBurst(EntityPlayer player,ItemStack stack){
return burst;
}

@Optional.Method(modid = LibMisc.MOD_ID)
@Override
public void apply(ItemStack stack, BurstProperties props) {

}

@Optional.Method(modid = LibMisc.MOD_ID)
@Override
public boolean collideBurst(IManaBurst burst, RayTraceResult pos, boolean isManaBlock, boolean dead, ItemStack stack) {
return dead;
Expand Down Expand Up @@ -190,6 +193,7 @@ private int generateRGB(float time){
return r << 16 | g << 8 | b;
}

@Optional.Method(modid = LibMisc.MOD_ID)
@Override
public boolean doParticles(IManaBurst burst, ItemStack stack) {
return true;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/huige233/transcend/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand Down Expand Up @@ -67,7 +68,9 @@ public long getTickCount() {

public void preInit( FMLPreInitializationEvent event )
{
ClientRegistry.bindTileEntitySpecialRenderer(TileUltraManaPool.class,new RenderTileUltraManaPool());
if(Loader.isModLoaded("botania")){
ClientRegistry.bindTileEntitySpecialRenderer(TileUltraManaPool.class, new RenderTileUltraManaPool());
}
super.preInit(event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
Expand All @@ -36,11 +37,15 @@
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.lib.LibMisc;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.wand.IWandHUD")
@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.wand.IWandable")
@Optional.Interface(modid = LibMisc.MOD_ID,iface = "vazkii.botania.api.lexicon.ILexiconable")
public class BlockUltraManaPool extends BlockBase implements IWandHUD, IWandable, ILexiconable, ITileBlock<TileUltraManaPool> {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.5, 1);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package huige233.transcend.tileEntity;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class TileEntityHandler {
public static void registerTileEntities() {
GameRegistry.registerTileEntity(TileEntityVirusGenerator.class,new ResourceLocation("transcend:tileEntityVirusGenerator"));
GameRegistry.registerTileEntity(TileEntityCollerctor.class,new ResourceLocation("transcend:tileEntityCollector"));
GameRegistry.registerTileEntity(TileCreativeRFSource.class,new ResourceLocation("transcend:TileCreativeRFSource"));
GameRegistry.registerTileEntity(TileUltraManaPool.class,new ResourceLocation("transcend:TileUltraManaPool"));
if (Loader.isModLoaded("botania")) {
GameRegistry.registerTileEntity(TileUltraManaPool.class,new ResourceLocation("transcend:TileUltraManaPool"));
}
}
}

0 comments on commit 91b4cd3

Please sign in to comment.