mirror of
https://github.com/FatherToast/SpecialMobs.git
synced 2025-04-24 22:34:58 +00:00
WIP ninja TOP compat
This commit is contained in:
parent
9a8d1cdedb
commit
9b8dde210a
7 changed files with 118 additions and 3 deletions
|
@ -105,6 +105,7 @@ dependencies {
|
||||||
// Add in JEI and TOP to assist debugging during development
|
// Add in JEI and TOP to assist debugging during development
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
|
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
|
||||||
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${top_version}")
|
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${top_version}")
|
||||||
|
compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${top_version}:api")
|
||||||
|
|
||||||
annotationProcessor 'org.spongepowered:mixin:0.8.2:processor'
|
annotationProcessor 'org.spongepowered:mixin:0.8.2:processor'
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class NinjaSkeletonRenderer extends SkeletonRenderer {
|
||||||
matrixStack.pushPose();
|
matrixStack.pushPose();
|
||||||
|
|
||||||
matrixStack.translate( -0.5D, 0.0D, -0.5D );
|
matrixStack.translate( -0.5D, 0.0D, -0.5D );
|
||||||
this.blockRenderer.renderBlock( Blocks.LECTERN.defaultBlockState(), matrixStack, buffer, i, OverlayTexture.NO_OVERLAY, EmptyModelData.INSTANCE );
|
this.blockRenderer.renderBlock( state, matrixStack, buffer, i, OverlayTexture.NO_OVERLAY, EmptyModelData.INSTANCE );
|
||||||
|
|
||||||
matrixStack.popPose();
|
matrixStack.popPose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package fathertoast.specialmobs.common.compat.top;
|
||||||
|
|
||||||
|
import fathertoast.specialmobs.common.entity.ai.INinja;
|
||||||
|
import mcjty.theoneprobe.api.*;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class NinjaEntityDisplayOverride implements IEntityDisplayOverride {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean overrideStandardInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, PlayerEntity playerEntity, World world, Entity entity, IProbeHitEntityData iProbeHitEntityData) {
|
||||||
|
if (entity instanceof INinja) {
|
||||||
|
INinja ninja = (INinja) entity;
|
||||||
|
|
||||||
|
if (ninja.getDisguiseBlock() != null) {
|
||||||
|
Block block = ninja.getDisguiseBlock().getBlock();
|
||||||
|
|
||||||
|
iProbeInfo.horizontal().item(new ItemStack(block.asItem()));
|
||||||
|
iProbeInfo.horizontal().text(CompoundText.create().text(new StringTextComponent(translateBlockName(block))), iProbeInfo.defaultTextStyle());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the localized name of a block */
|
||||||
|
private String translateBlockName(Block block) {
|
||||||
|
ResourceLocation resourceLocation = block.getRegistryName();
|
||||||
|
return I18n.get("block." + Objects.requireNonNull(resourceLocation).getNamespace() + "." + resourceLocation.getPath());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package fathertoast.specialmobs.common.compat.top;
|
||||||
|
|
||||||
|
import fathertoast.specialmobs.common.entity.ai.INinja;
|
||||||
|
import mcjty.theoneprobe.api.IProbeConfig;
|
||||||
|
import mcjty.theoneprobe.api.IProbeConfigProvider;
|
||||||
|
import mcjty.theoneprobe.api.IProbeHitData;
|
||||||
|
import mcjty.theoneprobe.api.IProbeHitEntityData;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SMProbeConfig implements IProbeConfigProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getProbeConfig(IProbeConfig probeConfig, PlayerEntity playerEntity, World world, Entity entity, IProbeHitEntityData iProbeHitEntityData) {
|
||||||
|
if (entity instanceof INinja) {
|
||||||
|
INinja ninja = (INinja) entity;
|
||||||
|
|
||||||
|
if (ninja.getDisguiseBlock() != null) {
|
||||||
|
probeConfig.showMobHealth(IProbeConfig.ConfigMode.NOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getProbeConfig(IProbeConfig probeConfig, PlayerEntity playerEntity, World world, BlockState blockState, IProbeHitData iProbeHitData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package fathertoast.specialmobs.common.compat.top;
|
||||||
|
|
||||||
|
import mcjty.theoneprobe.api.ITheOneProbe;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class SMTheOneProbe implements Function<ITheOneProbe, Void> {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static ITheOneProbe TOP;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Void apply(ITheOneProbe probe) {
|
||||||
|
TOP = probe;
|
||||||
|
setup(probe);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setup(ITheOneProbe probe) {
|
||||||
|
probe.registerEntityDisplayOverride(new NinjaEntityDisplayOverride());
|
||||||
|
probe.registerProbeConfigProvider(new SMProbeConfig());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package fathertoast.specialmobs.common.core;
|
package fathertoast.specialmobs.common.core;
|
||||||
|
|
||||||
import fathertoast.specialmobs.common.bestiary.MobFamily;
|
import fathertoast.specialmobs.common.bestiary.MobFamily;
|
||||||
|
import fathertoast.specialmobs.common.compat.top.SMTheOneProbe;
|
||||||
import fathertoast.specialmobs.common.config.Config;
|
import fathertoast.specialmobs.common.config.Config;
|
||||||
import fathertoast.specialmobs.common.core.register.SMEntities;
|
import fathertoast.specialmobs.common.core.register.SMEntities;
|
||||||
import fathertoast.specialmobs.common.core.register.SMItems;
|
import fathertoast.specialmobs.common.core.register.SMItems;
|
||||||
|
@ -8,7 +9,10 @@ import fathertoast.specialmobs.common.event.BiomeEvents;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.fml.InterModComms;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
@ -110,6 +114,7 @@ public class SpecialMobs {
|
||||||
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
|
|
||||||
eventBus.addListener( SMEntities::createAttributes );
|
eventBus.addListener( SMEntities::createAttributes );
|
||||||
|
eventBus.addListener( this::sendIMCMessages );
|
||||||
|
|
||||||
SMEntities.REGISTRY.register( eventBus );
|
SMEntities.REGISTRY.register( eventBus );
|
||||||
SMItems.REGISTRY.register( eventBus );
|
SMItems.REGISTRY.register( eventBus );
|
||||||
|
@ -117,6 +122,12 @@ public class SpecialMobs {
|
||||||
MobFamily.initBestiary();
|
MobFamily.initBestiary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendIMCMessages(InterModEnqueueEvent event) {
|
||||||
|
if (ModList.get().isLoaded("theoneprobe")) {
|
||||||
|
InterModComms.sendTo("theoneprobe", "getTheOneProbe", SMTheOneProbe::new);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @return A ResourceLocation with the mod's namespace. */
|
/** @return A ResourceLocation with the mod's namespace. */
|
||||||
public static ResourceLocation resourceLoc( String path ) { return new ResourceLocation( MOD_ID, path ); }
|
public static ResourceLocation resourceLoc( String path ) { return new ResourceLocation( MOD_ID, path ); }
|
||||||
|
|
||||||
|
|
|
@ -24,20 +24,27 @@ Source: https://github.com/FatherToast/
|
||||||
Discussion: https://discord.gg/GFTzTdX
|
Discussion: https://discord.gg/GFTzTdX
|
||||||
'''
|
'''
|
||||||
|
|
||||||
[[dependencies.deadlyworld]]
|
[[dependencies.specialmobs]]
|
||||||
modId = "forge"
|
modId = "forge"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[36.2.17,)"
|
versionRange = "[36.2.17,)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
[[dependencies.deadlyworld]]
|
[[dependencies.specialmobs]]
|
||||||
modId = "minecraft"
|
modId = "minecraft"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[1.16.5,1.17)"
|
versionRange = "[1.16.5,1.17)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
|
[[dependencies.specialmobs]]
|
||||||
|
modId = "theoneprobe"
|
||||||
|
mandatory = false
|
||||||
|
versionRange = "[1.16,)"
|
||||||
|
ordering = "BEFORE"
|
||||||
|
side = "BOTH"
|
||||||
|
|
||||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
|
|
Loading…
Add table
Reference in a new issue