
saoj12
Members-
Posts
12 -
Joined
-
Last visited
Everything posted by saoj12
-
Ohhh you're right! I fixed this and now it works, thanks so much! I'm not sure why that was done. I definitely didn't do it by hand so it was probably auto-generated when I accidentally extended the wrong super class or something. Good spot! My entity is now working but the skin is a bit messed up. Any idea how to implement a skin for a PlayerModel model? a regular player skin off planet minecraft doesn't seem to map properly
-
unfortunately I didn't make a github repo for this project as I only intended for it to be a little test but I can send you all the code that I think would be relevant on here. Sorry if it's messy and thanks again for your help so far. You've already got the registry handler and my entity class so I'll just send the rest: @Mod("my_mod") public class MyMod { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "my_mod"; public Obamium() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); RegistryHandler.init(); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event){ OreGenerator.setupOreGen(); } private void doClientStuff(final FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(RegistryHandler.OBAMA.get(), ObamaRenderFactory.INSTANCE); } } public class MyRenderFactory implements IRenderFactory<MyEntity> { public static final MyRenderFactory INSTANCE = new MyRenderFactory(); @Override public EntityRenderer<? super MyEntity> createRenderFor(EntityRendererManager manager) { if (FMLEnvironment.dist.isDedicatedServer()) throw new IllegalStateException("Only run this on client!"); return new MyRenderer(manager); } } @OnlyIn(Dist.CLIENT) public class MyRenderer extends MobRenderer<MyEntity, PlayerModel<MyEntity>> { private static final ResourceLocation SKIN = new ResourceLocation(MyMod.MOD_ID,"textures/entity/mytexture.png"); @Nullable public MyRenderer(EntityRendererManager rendererManager) { // (renderManager, model, shadowSize); super(rendererManager, new PlayerModel<>(1, false),0.6f); } @Override public ResourceLocation getEntityTexture(MyEntity entity) { return SKIN; } } And I'm pretty sure that's everything that relates in any way to the entity.
-
'Unable to spawn entity' i edited my last message with some extra details too
-
It seems like in other people's code they are able to put MyEntity.class as a parameter and it works fine? i can put the EntityType as a parameter and this works fine but then when i try and spawn the mob in-game I get an error message in the chat log here is my new code: public class RegistryHandler { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, Obamium.MOD_ID); public static void init(){ ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); } //Entities public static final RegistryObject<EntityType<MyEntity>> MYENTITY = ENTITY_TYPES.register("my_entity", () -> EntityType.Builder.create(ObamaEntity::new, EntityClassification.AMBIENT).size(1F, 2F).build("my_entity")); } I am now calling registerEntityRenderingHandler in the doClientStuff method of my main class because someone said that's where I should put it since the rendering is done clientside. I have tried calling it elsewhere but the result is the same here's what the console outputs: java.lang.NullPointerException: null at net.minecraft.network.datasync.EntityDataManager.set(EntityDataManager.java:123) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.LivingEntity.setHealth(LivingEntity.java:877) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:200) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.MobEntity.<init>(MobEntity.java:99) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.CreatureEntity.<init>(CreatureEntity.java:13) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.AgeableEntity.<init>(AgeableEntity.java:25) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.merchant.villager.AbstractVillagerEntity.<init>(AbstractVillagerEntity.java:47) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.merchant.villager.VillagerEntity.<init>(VillagerEntity.java:116) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.merchant.villager.VillagerEntity.<init>(VillagerEntity.java:112) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at com.saoj.obamiummod.core.entities.ObamaEntity.<init>(ObamaEntity.java:12) ~[main/:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:421) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.EntityType.lambda$loadEntityUnchecked$0(EntityType.java:432) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_241] {} at net.minecraft.entity.EntityType.loadEntityUnchecked(EntityType.java:431) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.EntityType.loadEntity(EntityType.java:479) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.EntityType.func_220335_a(EntityType.java:461) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.command.impl.SummonCommand.summonEntity(SummonCommand.java:50) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at net.minecraft.command.impl.SummonCommand.lambda$register$1(SummonCommand.java:32) ~[forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:262) ~[brigadier-1.0.17.jar:?] {} at net.minecraft.command.Commands.handleCommand(Commands.java:210) ~[?:?] {re:classloading} at net.minecraft.network.play.ServerPlayNetHandler.handleSlashCommand(ServerPlayNetHandler.java:1028) ~[?:?] {re:classloading} at net.minecraft.network.play.ServerPlayNetHandler.processChatMessage(ServerPlayNetHandler.java:1008) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CChatMessagePacket.processPacket(CChatMessagePacket.java:37) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CChatMessagePacket.processPacket(CChatMessagePacket.java:8) ~[?:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) [?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) [?:?] {re:classloading} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:756) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:141) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:739) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:733) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:718) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:663) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241] {} [20:55:01] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] Unable to summon entity [20:55:07] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [20:55:07] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Test'/minecraft:overworld [20:55:07] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save Test
-
Okay thank you. Then do i pass this into the registerEntityRenderingHandler method instead of MyEntity.class?
-
I'm trying to create a custom entity that extends the VillagerEntity class and uses a player model. Here is my code: public class RegistryHandler { public static void init(){ RenderingRegistry.registerEntityRenderingHandler(MyEntity.class, MyRenderFactory.INSTANCE); } } The problem I have is that the registerEntityRenderingHandler method won't accept MyEntity.class as a parameter as it says it is of type Class<MyEntity> when it should be EntityType<T> Here is the MyEntity class: public class MyEntity extends VillagerEntity { public MyEntity(EntityType<? extends VillagerEntity> entityTypeIn, World worldIn) { super(entityTypeIn, worldIn); } @Override protected void registerData() { } @Override public void readAdditional(CompoundNBT compound) { } @Override public void writeAdditional(CompoundNBT compound) { } @Override public IPacket<?> createSpawnPacket() { return null; } } Any help would be appreciated
-
[ 1.15.2 ] Block won't drop item when broken [SOLVED]
saoj12 replied to saoj12's topic in Modder Support
Thanks, very helpful ? -
[ 1.15.2 ] Block won't drop item when broken [SOLVED]
saoj12 replied to saoj12's topic in Modder Support
Okay thank you, that's exactly what I needed to know. One more thing, how do I look at the vanilla jar file? Up until now I've been right-clicking net.minecraft classes and clicking goto declaration in my IDE ? -
I'm trying to make a custom block, which is mostly the same as an iron block, except with a different texture. However, for some reason, when I break the block in survival mode the corresponding BlockItem won't drop. I was under the impression that I didn't have to add any code to make this happen, was i wrong in thinking this? Here is my code: public class CustomBlock extends Block{ public CustomBlock() { super(Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(1)); } } I have made I am breaking the item in-game in the same conditions as I'm breaking the iron block. The BlockItem is also definitely registered as I can hold it in my hand
-
Fixed. For some reason, moving the file into my SSD (C drive) instead of my HDD (D drive) fixed the problem
-
unfortunately, it does not. Is there any alternative method I could try that might bypass this issue?
-
Ah yes, my mistake. It's version 1.12.2. Not sure why I said 'most recent', my bad
-
I'm following a tutorial on how to install forge and set up the workspace for Minecraft 1.12.2. When I try to do 'gradlew setupDecompWorkspace eclipse' it outputs: 'Documents\Desktop\modding\MyFirstMod\' is not recognized as an internal or external command, operable program or batch file. Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Double-clicking the gradlew.bat file also outputs those first two lines. Does anyone have any idea how I can fix this?