Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Verthicha

Members
  • Joined

  • Last visited

Everything posted by Verthicha

  1. is this possible. if so. what have I messed up. i cant seem to find anyone else having this problem. the model used to load and render, but i think with my constant tinkering i messed that up too. block .class package com.mod.rsmc.block; import net.minecraft.block.*; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.*; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class BlockSmelter extends Block { public static final DirectionProperty FACING = DirectionProperty.create("facing",Direction.values()); public BlockSmelter(Properties properties) { super(properties); this.setDefaultState(this.getDefaultState().with(FACING, Direction.NORTH)); LOGGER.debug("RSMC::" + Direction.values()); } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(BlockStateProperties.FACING); } @OnlyIn(Dist.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); } } block .json { "forge_marker": 1, "model": "rsmc:block/block_smelter.obj", "custom": { "flip-v": true }, "variants": { "facing": { "up": { "transform": { "rotation": { "y": 0 } } }, "north": { "transform": { "rotation": { "y": 0 } } }, "south": { "transform": { "rotation": { "y": 180 } } }, "east": { "transform": { "rotation": { "y": 270 } } }, "west": { "transform": { "rotation": { "y": 90 } } }, "down": { "transform": { "rotation": { "y": 0 } } } } } } mod "main" .kt yes it is in Kotlin, no i didn't have a choice in the matter package com.mod.rsmc import com.mod.rsmc.client.ClientEventHandler import com.mod.rsmc.library.block.BlockLibrary import com.mod.rsmc.library.block.TileEntityLibrary import com.mod.rsmc.library.feature.FeatureLibrary import com.mod.rsmc.library.item.ItemLibrary import com.mod.rsmc.packets.RSMCPacketHandler import com.mod.rsmc.util.CVManager import net.minecraft.client.renderer.model.ModelResourceLocation import net.minecraft.client.renderer.vertex.DefaultVertexFormats import net.minecraft.util.ResourceLocation import net.minecraftforge.client.event.ModelBakeEvent import net.minecraftforge.client.event.ModelRegistryEvent import net.minecraftforge.client.event.TextureStitchEvent import net.minecraftforge.client.model.BasicState import net.minecraftforge.client.model.ModelLoader import net.minecraftforge.client.model.ModelLoaderRegistry import net.minecraftforge.client.model.obj.OBJLoader import net.minecraftforge.client.model.obj.OBJModel import net.minecraftforge.common.MinecraftForge import net.minecraftforge.eventbus.api.SubscribeEvent import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext import org.apache.logging.log4j.LogManager const val RSMC_MOD_ID = "rsmc" val LOGGER = LogManager.getLogger(RSMC_MOD_ID) @Mod(RSMC_MOD_ID) class RSMC { init { MinecraftForge.EVENT_BUS FMLJavaModLoadingContext.get().modEventBus.register(BlockLibrary) FMLJavaModLoadingContext.get().modEventBus.register(ItemLibrary) FMLJavaModLoadingContext.get().modEventBus.register(FeatureLibrary) FMLJavaModLoadingContext.get().modEventBus.register(TileEntityLibrary) FMLJavaModLoadingContext.get().modEventBus.register(RegistryEvents) MinecraftForge.EVENT_BUS.register(PlayerEventHandler) MinecraftForge.EVENT_BUS.register(GuffCoreEventContainer) MinecraftForge.EVENT_BUS.register(RegistryEvents) FMLJavaModLoadingContext.get().modEventBus.register(ClientEventHandler) RSMCPacketHandler //initializes the network channel FMLJavaModLoadingContext.get().modEventBus.addListener<FMLCommonSetupEvent> { commonSetup(it) } FMLJavaModLoadingContext.get().modEventBus.addListener<FMLClientSetupEvent> { clientSetup(it) } } private fun commonSetup(event: FMLCommonSetupEvent) { FeatureLibrary.populateBiomes() CVManager.load() //load item values } private fun clientSetup(event: FMLClientSetupEvent) { OBJLoader.INSTANCE.addDomain(RSMC_MOD_ID) } @Mod.EventBusSubscriber(modid = RSMC_MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) object RegistryEvents { @SubscribeEvent fun onModelBakeEvent(event: ModelBakeEvent) { try { // Try to load an OBJ model (placed in src/main/resources/assets/examplemod/models/) val model = ModelLoaderRegistry.getModelOrMissing(ResourceLocation("rsmc:block/block_smelter.obj")) if (model is OBJModel) { // If loading OBJ model succeeds, bake the model and replace stick's model with the baked model val bakedModel = model.bake(event.modelLoader, ModelLoader.defaultTextureGetter(), BasicState(model.getDefaultState(), false), DefaultVertexFormats.ITEM) event.modelRegistry[ModelResourceLocation("rsmc:block_smelter")] = bakedModel } } catch (e: Exception) { e.printStackTrace() } } @SubscribeEvent fun onPreTextureStitch(event: TextureStitchEvent.Pre) { LOGGER.debug(event.addSprite(ResourceLocation.tryCreate("rsmc:block/block_smelter_mat"))) } } }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.