Jump to content

Search the Community

Showing results for 'transparent block' in topics.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Minecraft Forge
    • Releases
    • Support & Bug Reports
    • Suggestions
    • General Discussion
  • Mod Developer Central
    • Modder Support
    • User Submitted Tutorials
  • Non-Forge
    • Site News (non-forge)
    • Minecraft General
    • Off-topic
  • Forge Mods
    • Mods

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


XMPP/GTalk


Gender


URL


Location


ICQ


AIM


Yahoo IM


MSN Messenger


Personal Text

  1. Hello, I'm trying to make a block that is basically like a reskin of the vine block. I got almost everything working, except that the texture is not transparent when rendered. https://prnt.sc/2CoFbadXH-6j Does someone know what's wrong with it? https://github.com/robinroloff/alpinemod/ The block is called "resin". Thanks in advance
  2. Hi, I had a problem creating a block with transparent parts and I don't know how to fix it or what is causing it, I already tried looking for solutions but none of them work for me, could someone help me? (I upload it again since nobody answered me)
  3. Hi, I had a problem creating a block with transparent parts and I don't know how to fix it or what is causing it, I already tried looking for solutions but none of them work for me, could someone help me?
  4. i just refactoring the question from the iron bars block i have create a basic full block of glass and an slab the issue is than this block is not transparent it loads glass texture but its dull gray you cannot see through as whit the vanilla glass block im creating the block using the tutorials from Kaupenjoe https://www.youtube.com/playlist?list=PLKGarocXCE1EMxeBvqsOWZVkYD_Vd_uwW public static final RegistryObject<Block> GLASS_BLOCK = registerBlock( "glass_block", () -> new Block( AbstractBlock.Properties.of(Material.GLASS).strength(0.3F).sound(SoundType.GLASS).noOcclusion())); the block is made using the vanilas block class in the old versions to make block transparent you have to add to the block code this function @Override public boolean isOpaqueCube(IBlockState state) { return false; } something like this is missing or the system has totally change someone says than ItemBlockRenderTypes.setRenderLayer(YOUR_BLOCK, RenderType.cutoutMipped()); but i dont have friking idea where that piece of code would go
  5. Hey, I'm fairly new to the modding community and I'm coding a Mod that includes Vertical Slabs for 1.18. Coding the Slabs I pretty much took the way Stairs are made and just removed the bottom extended part. I wanted to take the Original Minecraft textures and after hours of getting the ColorMaps and Tinting to work I realized, that Blocks behind the full Block Side are not rendered. I read something about "culling" but I didn't quite understand. It looks like this: I suspect that the problem is not in my .json Files but in my custom class "ConnectableWallBlock" because it doesn't really matter, even if I take the original oak leaves json it doesn't work. I also tried taking the getVisualShape (like in the AbstractGlassBlock class) and making it return shapes.empty but that didn't work either. I have .noOcclusion() in my Constructor Chain and in my ClientSetup I also call RenderType cutout. At the moment I have no clue what else I could try to make it work. GitHub: https://github.com/Brainterminator/utilityblocks (look at the MoreWallBlocks Branch) I hope you guys have some ideas!
  6. Hey guys! I encountered the following problem when updating my mod from 1.16 to 1.17: If I place a block of my mod (e.g. stairs) in front of another block, the hidden side of the back block is not rendered. It worked perfectly on 1.16, the problem only appeared when I moved to 1.17. I have already tried setting the render layer of the blocks from translucent to solid and to cutout, but nothing has changed. The main feature of my mod is that the blocks of my mod (frames) can take the texture of any block. If I then take a transparent block (e.g. red stained glass) and "disguise" the frame stairs with it, you can see that on all sides that are completely covered by the stairs, the blocks behind them become invisible. (see 2nd picture) But on the side that is only covered to 3/4, the grass block behind is visible through the "red stained glass stairs" (see 3rd picture), which is correct. For the stairs used in the first picture, a classic json model is used; when the stairs are disguised (2nd and 3rd picture), I created a BakedModel. Please let me know, if you need more information or specific code parts. It looks to me like I'm missing on something very obvious, so I'm sorry if this question is stupid... please don't be mad at me Here's my github repository: https://github.com/PianoManu/BlockCarpentry/tree/Forge-1.17 The block's main class is mod.pianomanu.blockcarpentry.block.StairsFrameBlock The class where I created the baked model is mod.pianomanu.blockcarpentry.bakedmodels.StairsBakedModel I'm setting the render layers in mod.pianomanu.blockcarpentry.setup.RenderSetup All blocks and items are registered in mod.pianomanu.blockcarpentry.setup.Registration Thanks in advance!! Regards, Manu
  7. Hey everyone, Freshly coming back to Minecraft modding a few days ago, I decided to start from the basics and so creating a new transparent block, much like a glass block but with 0 opacity. The block itself is transparent but I found an unexpected behaviour (aswell I think it is) : when placed next to or on top of another block, this new transparent block does act as x-ray mods : when no other block underneath it has been mined, you can clearly see the far-away lava for example. It seems also that if any block has been changed or visualized within that view then this block does appear in that x-ray vision. I did follow some of the tutorials I could find online about 1.17, custom block and transparency, but I could not find a solution to this. In case other mods could have been involved in this, I remove them all, server-side and client-side but to no effet. The definition of the new block is quite simple (actually a Block) : public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ExampleMod.MOD_ID); public static final RegistryObject<BlockItem> INVISIBLE_BLOCK = ITEMS.register("invisible_block", () -> new BlockItem(BlockInit.INVISIBLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS))); //... public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ExampleMod.MOD_ID); public static final RegistryObject<InvisibleBlock> INVISIBLE_BLOCK = BLOCKS.register("invisible_block", () -> new InvisibleBlock(Block.Properties.of(Material.STONE, MaterialColor.COLOR_BLUE).explosionResistance(99F))); //... public class InvisibleBlock extends Block { public InvisibleBlock(Properties properties) { super(properties); } } so is the model and textures : { "parent": "block/cube_all", "textures": { "all": "examplemod:blocks/invisible_block" }, "elements": [ { "from": [0, 0, 0], "to": [16, 16, 16], "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#all"}, "east": {"uv": [0, 0, 16, 16], "texture": "#all"}, "south": {"uv": [0, 0, 16, 16], "texture": "#all"}, "west": {"uv": [0, 0, 16, 16], "texture": "#all"}, "up": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#all"}, "down": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#all"} } } ], "groups": [ { "name": "VoxelShapes", "origin": [8, 8, 8], "color": 0, "children": [0] } ] } with texture "invisible_block" being a PNG with 4 blue dots on a huge transparent background. I've read that there is a need to address transparency client-wise so I do have a listener setting render type : @Mod.EventBusSubscriber(modid = ExampleMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ClientModEvent { private ClientModEvent() { } @SubscribeEvent public static void clientSetup(FMLClientSetupEvent event) { ItemBlockRenderTypes.setRenderLayer(BlockInit.INVISIBLE_BLOCK.get(), RenderType.translucent()); } } I've tried some changes from translucent to cutout but it does not solve the problem. Does someone has any idea on why this happen and how could I solve it please ? Thanks you in advance for your time and your help, Cheers Cr3aHal0
  8. Hello everyone, I have custom furnace block. I have created a little window in it, but I can't figure out how I make the glass transparent. I tried these codes: @Override public boolean isTransparent(BlockState state) { return super.isTransparent(state);} @Override public boolean isTransparent(BlockState state) { return true;} These 2 codes doesn't work. Not how I did it. Can someone help me with this? Also here's the block code: CODE
  9. Hey, so I was taking a break from minecraft modding and then today i decided to go back and do some modding again. I saw that my latest version of my mod was 1.16.3, so i decided to update it to 1.16.5. Then I found out that they renamed basically everything, and now im stuck with this problem, the problem is that its not the same code as in the 1.16.3 because the voxel shapes and facing things dont work in this version. So i just deleted them, and now i dont know how to fix this. These blocks have no rotation and no boundary boxes, since i deleted them. I never liked working with them, for me they are annoying. And yeah as i said, the problem is that the custom block model makes the block underneath or beside it transparent. The code is basic, basically just a constructor in a class and some properties in the init class. Any help appreciated!
  10. Hi! Im trying to create a block like an ender chest, so I copied the code from the vanilla, registered the various things and started the game. The problem is that the block appears transparent both in the world and in the inventory. The Block Class: https://pastebin.com/mWkZ0nLU The TileEntityClass: https://pastebin.com/Jy3953EY The TileEntityRenderer Class: https://pastebin.com/WTjrnatD Tile Tile Entity Register: https://pastebin.com/BKdcR8LK JSon: https://pastebin.com/hEGCrq3d Mod Setup: https://pastebin.com/x0xkdqXR
  11. Hi! I'm creating a block that needs to be translucent, bc the model isn't a perfect cube. When I put it in the ground, the bottom become trasparent. I know it's a well knowed issue, but everything I could find told me to set its render layer with RenderTypeLookup#setRenderLayer (I also found topics which solved this problem overriding the Block#getRenderLayer(), but it doesnt exist anymore in this version) , so, I did it, but nothing changed and the bottom of the block still invisible, I tried getCutout(), getTranslucent() and a bunch of other methods but nothing worked (Yeah, the SetupClient#onClientSetupEvent is being called). Any ideas? (I'm sorry if there is any english grammar mistake or something like that) Here are the code and the block printscreen: package net.threader.generatorsmod; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.threader.generatorsmod.init.SetupClient; import net.threader.generatorsmod.init.SetupCommon; @Mod(GeneratorMod.MODID) public class GeneratorMod { public static final String MODID = "generators"; public static IEventBus MOD_EVENT_BUS; public GeneratorMod() { MOD_EVENT_BUS = FMLJavaModLoadingContext.get().getModEventBus(); MOD_EVENT_BUS.register(SetupCommon.class); DistExecutor.runWhenOn(Dist.CLIENT, () -> GeneratorMod::registerClientOnlyEvents); } public static void registerClientOnlyEvents() { MOD_EVENT_BUS.register(SetupClient.class); } } package net.threader.generatorsmod; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; import net.threader.generatorsmod.init.SetupCommon; public class GeneratorBlock extends Block { public GeneratorBlock() { super(Block.Properties.create(Material.ROCK)); } @Override public boolean hasTileEntity(BlockState state) { return true; } @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return SetupCommon.tileEntityType.create(); } } package net.threader.generatorsmod.init; import net.minecraft.block.GlassBlock; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; public class SetupClient { @SubscribeEvent public static void onClientSetupEvent(FMLClientSetupEvent event) { RenderTypeLookup.setRenderLayer(SetupCommon.generatorBlock, RenderType.getCutout()); } }
  12. Hi, I'm trying to make a partly transparent block, but the areas that are supposed to be transparent are just black. Block class: package linky132.waywardcraft.common.block; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.material.Material; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RedstoneSide; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import javax.annotation.Nullable; public class BlockSaltDust extends Block { // Create block properties public static final EnumProperty<RedstoneSide> NORTH = BlockStateProperties.REDSTONE_NORTH; public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.REDSTONE_EAST; public static final EnumProperty<RedstoneSide> SOUTH = BlockStateProperties.REDSTONE_SOUTH; public static final EnumProperty<RedstoneSide> WEST = BlockStateProperties.REDSTONE_WEST; // Create bounding box shape private static final VoxelShape SHAPE = Block.makeCuboidShape(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d); // 1.0d = 1 pixel @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(NORTH, EAST, SOUTH, WEST); } public BlockSaltDust(Material material) { // Block constructor super(Properties.create(material).hardnessAndResistance(0.0f, 0.0f)); // Use material provided in the RegistryHandler class and set hardness and resistance this.setDefaultState(this.stateContainer.getBaseState().with(NORTH, RedstoneSide.NONE).with(EAST, RedstoneSide.NONE).with(SOUTH, RedstoneSide.NONE).with(WEST, RedstoneSide.NONE)); // Set the default states for the block } // Apply bounding box shape @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPE; } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); // Check if the block placed was on the north or south side. If it was, set the NORTH and SOUTH properties to SIDE. if (worldIn.getBlockState(pos.offset(Direction.NORTH)).getBlock() != Blocks.AIR || worldIn.getBlockState(pos.offset(Direction.SOUTH)).getBlock() != Blocks.AIR) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(NORTH, RedstoneSide.SIDE)); worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(SOUTH, RedstoneSide.SIDE)); } // Check if the block placed was on the east or west side. If it was, set the EAST and WEST properties to SIDE. if (worldIn.getBlockState(pos.offset(Direction.EAST)).getBlock() != Blocks.AIR || worldIn.getBlockState(pos.offset(Direction.WEST)).getBlock() != Blocks.AIR) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(EAST, RedstoneSide.SIDE)); worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(WEST, RedstoneSide.SIDE)); } } @Override public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving); Block adjacentBlock = worldIn.getBlockState(fromPos).getBlock(); // Save neighboring block to variable if (adjacentBlock == Blocks.AIR) { // Check if the neighboring block is air (i.e. if the block next to the salt was destroyed) // Check if the block destroyed was on the north or south side. If it was, set the NORTH and SOUTH properties to NONE. if (pos.offset(Direction.NORTH).equals(fromPos) || pos.offset(Direction.SOUTH).equals(fromPos)) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(NORTH, RedstoneSide.NONE)); worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(SOUTH, RedstoneSide.NONE)); } // Check if the block destroyed was on the east or west side. If it was, set the EAST and WEST properties to NONE. if (pos.offset(Direction.EAST).equals(fromPos) || pos.offset(Direction.WEST).equals(fromPos)) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(EAST, RedstoneSide.NONE)); worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(WEST, RedstoneSide.NONE)); } } else { // If the neighboring block is anything but air, do this //TODO: Change the else statement to an else if statement and exclude certain blocks that salt shouldn't connect to (e.g. fluids, gases, etc.) // Check if the block placed was on the north or south side. If it was, set the NORTH and SOUTH properties to SIDE. if (pos.offset(Direction.NORTH).equals(fromPos) || pos.offset(Direction.SOUTH).equals(fromPos)) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(NORTH, RedstoneSide.SIDE)); worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(SOUTH, RedstoneSide.SIDE)); } // Check if the block placed was on the east or west side. If it was, set the EAST and WEST properties to SIDE. if (pos.offset(Direction.EAST).equals(fromPos) || pos.offset(Direction.WEST).equals(fromPos)) { worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(EAST, RedstoneSide.SIDE)); worldIn.setBlockState(pos, worldIn.getBlockState(pos).with(WEST, RedstoneSide.SIDE)); } } } } Block model: { "ambientocclusion": false, "textures": { "line": "waywardcraft:block/salt_dust", "particle": "waywardcraft:block/salt_dust" }, "elements": [ { "from": [0, 0.25, 0], "to": [16, 0.25, 16], "shade": false, "faces": { "up": {"uv": [0, 0, 16, 16], "texture": "#line"}, "down": {"uv": [0, 0, 16, 16], "texture": "#line"} } } ] } Block texture: https://imgur.com/a/SCKJ5TJ And here's what the block looks like when placed in the game: I'd really appreciate any help. Thanks!
  13. Hello, I am new to modding, somewhat new to programming and currently working on my first mod. I managed to make one of my blocks translucent, however the adjacent blocks don't show. It's a full cube and the only solutions I've found so far are for older versions which don't seem to work anymore. I'd be very grateful for help public class Cloud extends Block { public Cloud() { super(AbstractBlock.Properties.create(Material.SNOW) .hardnessAndResistance(0.3f,0.3f) .sound(SoundType.SNOW) .harvestLevel(0) ); } } public class Cloudcraft { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "cloudcraft"; public Cloudcraft() { 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) { RenderTypeLookup.setRenderLayer(RegistryHandler.CLOUD.get(), RenderType.getTranslucent()); } private void doClientStuff(final FMLClientSetupEvent event) { } } If there's other parts of the code that could be relevant, please let me know
  14. I recently made a custom block (not a normally shaped one) and I was wondering how I can make it transparent. It is a crystal ball, and is meant to be a decoration block. It appears clear in my hand but when I place it down, it appears black instead of clear (Its only supposed to be clear where I have no colour.) I heard something about overlaying textures whilst truing to figure it out. If that's what I need to do, I have no idea how to do it. And for any1 who helps, thanks a ton! PS this is in 1.16.1
  15. I have a transparent block but for some reason, any block it touches is turned invisible. What is the problem and how do I fix it?
  16. I've been trying to make a block transparent and I've added a few methods like getOpacity, isTransparent, and isVariableOpacity, but I don't understand what's wrong.
  17. Hello! I am making an animated block with TER. My achieve is to make a mill, behind the block, rotates. I couldn't do it, so I tried to make a pillar with a plate about it (just to lern how TER works with a block simpler) that rotates clockwise. When this block has been placed, it is renderd transparent. p.s. I have taken a look at Chest, Beacon and Enchantment Table, yet. Main(I registered here the TER) package com.olivemod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.olivemod.blocks.machine.active.flour_mill.FlourMillTE; import com.olivemod.blocks.machine.active.flour_mill.FlourMillTER; import com.olivemod.event.generation.OreGeneration; import com.olivemod.event.generation.tree.TreeGeneration; import com.olivemod.fluid.Fluids; import com.olivemod.init.BlockInit; import com.olivemod.init.ItemInit; import com.olivemod.utils.ModContainerTypes; import com.olivemod.utils.ModTileEntityTypes; import com.olivemod.utils.Reference.Reference; import net.minecraft.item.crafting.ShapedRecipe; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @Mod(Reference.MOD_ID) @Mod.EventBusSubscriber(modid = Reference.MOD_ID, bus = EventBusSubscriber.Bus.MOD) public class Main { public static Main instance; // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public Main() { LOGGER.debug("Welcome from OliveMod"); @SuppressWarnings("unused") final ModLoadingContext modLoadingContext = ModLoadingContext.get(); /* * @modEventBus register the setup method for modLoading * @modEventBus register the initClient method for modLoading */ final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::setup); modEventBus.addListener(this::initClient); ItemInit.ITEM.register(modEventBus); BlockInit.BLOCK.register(modEventBus); ModContainerTypes.CONTAINER_TYPE.register(modEventBus); ModTileEntityTypes.TILE_ENTITY_TYPE.register(modEventBus); Fluids.FLUIDS.register(modEventBus); instance = this; MinecraftForge.EVENT_BUS.register(this); } public void setup(final FMLCommonSetupEvent event) {// K9#8016 OreGeneration.oreGeneration(); TreeGeneration.init(); //CapabilityManager.INSTANCE.register(IThirsty.class, new ThirstyStorage(), Thirsty::new); ShapedRecipe.setCraftingSize(5, 5); } private void initClient(final FMLClientSetupEvent event) { ClientRegistry.bindTileEntitySpecialRenderer(FlourMillTE.class, new FlourMillTER()); } } TER: package com.olivemod.blocks.machine.active.flour_mill; import java.util.Random; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.platform.GlStateManager; import com.olivemod.utils.Reference.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.IModelData; @OnlyIn(Dist.CLIENT) public class FlourMillTER extends TileEntityRenderer<FlourMillTE> { // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public static final FlourMillTER INSTANCE = new FlourMillTER(); private final ResourceLocation TEXTURE_LOCATION; private FlourMillModel model = new FlourMillModel(); public FlourMillTER() { TEXTURE_LOCATION = new ResourceLocation(Reference.MOD_ID, "textures/entity/x.png"); } @Override public void render(FlourMillTE tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); GlStateManager.translatef(0.5F, 0.5F, 0.5F); GlStateManager.rotatef(0.0f, 0.0F, 1.0F, 0.0F); this.bindTexture(TEXTURE_LOCATION); this.model.renderAll(); GlStateManager.popMatrix(); } } TE: package com.olivemod.blocks.machine.active.flour_mill; import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.olivemod.utils.ModTileEntityTypes; import com.olivemod.utils.Reference.NBTKeys; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.fluid.Fluids; import net.minecraft.inventory.Inventory; import net.minecraft.inventory.container.Container; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SUpdateTileEntityPacket; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.LockableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.model.animation.IAnimationStateMachine; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.RangedWrapper; public class FlourMillTE extends TileEntity implements ITickableTileEntity{ private final int IN_SLOT = 0; public final ItemStackHandler inventory = new ItemStackHandler(IN_SLOT + 1) { public boolean isItemValid(int slot, ItemStack stack) { return slot == IN_SLOT && stack.getItem() == Items.WHEAT; }; protected void onContentsChanged(int slot) { FlourMillTE.this.markDirty(); }; }; private final LazyOptional<ItemStackHandler> LOInventory = LazyOptional.of( () -> this.inventory); @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return side == Direction.SOUTH ? this.LOInventory.cast() : LazyOptional.empty(); } protected FlourMillTE(TileEntityType<?> typeIn) { super(typeIn); } public FlourMillTE() { super(ModTileEntityTypes.FLOUR_MILL_TE.get()); } @Override public void read(CompoundNBT compound) { // TODO Auto-generated method stub super.read(compound); this.inventory.deserializeNBT(compound); } @Override public CompoundNBT write(CompoundNBT compound) { compound = super.write(compound); compound.put("inventory", this.inventory.serializeNBT()); return compound; } /* * Retrieves packet to send to the client whenever this Tile Entity is re-sinced via World#notifyBlockUpdate. * This packet comes back client-side via (@link #onDataPacket) */ @Nullable public SUpdateTileEntityPacket getUpdatePacket() { final CompoundNBT tag = new CompoundNBT(); //We pass 0 for TileEntityTypesIn because we have a modded TE.See ClientPlayNetHandler#handlerUpdateTileEntity(SUpdateTileEntityPacket) return new SUpdateTileEntityPacket(this.pos, 0, tag); } /* * Get an NBT compount to sync to the client with SPacketChunkData, used to initial loading of the chunk or when many blocks change at once * This compound comes back to the client-side in (@link #handleUpdateTag) * The default implementation ({@link TileEntity#handleUpdateTag}) calls {@link #writeInternal)} * wich doesn't save any of our extra data so we override it to call {@link #write} instead */ @Nonnull public CompoundNBT getUpdateTag() { return this.write(new CompoundNBT()); } /* * Invalidates our Tile Entity */ @Override public void remove() { super.remove(); //We need to invalidate our capability references so that any cached references (by other mod) don't continue to reference our capablities //and try to use them and/or prevent them from being garbage collected LOInventory.invalidate(); } /* * Handle a packet created in (@link #getUpdatePacket()) */ @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { super.onDataPacket(net, pkt); } @Override public void onLoad() { super.onLoad(); } @Override public void tick() { if (!this.inventory.getStackInSlot(IN_SLOT).isEmpty()) { } } @Override public AxisAlignedBB getRenderBoundingBox() { // TODO Auto-generated method stub return super.getRenderBoundingBox(); } } Model: package com.olivemod.blocks.machine.active.flour_mill; import net.minecraft.client.renderer.entity.model.RendererModel; import net.minecraft.client.renderer.model.Model; public class FlourMillModel extends Model { private final RendererModel bb_main;// = (new RendererModel(this, 0, 0)).setTextureSize(64, 64); public FlourMillModel() { textureWidth = 16; textureHeight = 16; bb_main = new RendererModel(this); bb_main.setRotationPoint(0.0F, 1.0F, 0.0F); bb_main.addBox(0f, 0f, 0f, 16, 16, 16); } void renderAll() { this.bb_main.render(0.0625f); } public void setRotationAngle(RendererModel modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } Block: package com.olivemod.blocks.machine.active.flour_mill; import com.olivemod.blocks.machine.active.fluid_transporter.TileEntityFluidTransporter; import com.olivemod.utils.ModTileEntityTypes; import com.olivemod.utils.Reference.Reference; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalBlock; import net.minecraft.block.material.Material; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; @EventBusSubscriber(modid = Reference.MOD_ID, bus = EventBusSubscriber.Bus.MOD) public class FlourMill extends HorizontalBlock{ public FlourMill() { super(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0f).harvestLevel(2).harvestTool(ToolType.PICKAXE)); this.setDefaultState(this.getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH)); } @Override public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { if (state != newState) { TileEntity tileEntity = worldIn.getTileEntity(pos); if(tileEntity instanceof FlourMillTE) { final ItemStackHandler inventory = ((FlourMillTE)tileEntity).inventory; for (int i = 0; i < inventory.getSlots(); i++) { InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), inventory.getStackInSlot(i)); } } } super.onReplaced(state, worldIn, pos, newState, isMoving); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); } @Override public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { final TileEntity tileEntity = worldIn.getTileEntity(pos); if(tileEntity instanceof FlourMillTE) { return ItemHandlerHelper.calcRedstoneFromInventory(((TileEntityFluidTransporter)tileEntity).inventory); } return super.getComparatorInputOverride(blockState, worldIn, pos); } @Override protected void fillStateContainer(Builder<Block, BlockState> builder) { builder.add(HORIZONTAL_FACING); } @Override public BlockState rotate(BlockState state, Rotation rot) { return state.with(HORIZONTAL_FACING, state.get(HORIZONTAL_FACING)); } @Override public BlockState mirror(BlockState state, Mirror mirrorIn) { return state.rotate(mirrorIn.toRotation(state.get(HORIZONTAL_FACING))); } @Override public BlockRenderLayer getRenderLayer() { // TODO Auto-generated method stub return BlockRenderLayer.CUTOUT; } @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } @Override public boolean hasTileEntity() { return true; } @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return ModTileEntityTypes.FLOUR_MILL_TE.get().create(); } }
  18. Helo. So, I'm making a blue berry block that works fine, but the texture is filled with green in game. I tried .notSolid(), but that turned it to be filled with black. Pls help :<
  19. I am programming a leaf block into my mod. I added it as normal but upon opening the game all transparent sections are shown as black. I have read up on this and tried many different solutions and nothing has worked here is my code: Registry Handler: public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } // BLOCKS public static final RegistryObject<Block> SILVER_LEAVES = BLOCKS.register("silver_leaves", SilverLeaves::new); // BLOCK ITEM public static final RegistryObject<Item> SILVER_LEAVES_ITEM = ITEMS.register("silver_leaves", () -> new BlockItemBase(SILVER_LEAVES.get())); private static Block register(String key, Block blockIn) { return Registry.register(Registry.BLOCK, key, blockIn); } } SilverLeaves.java package com.Cyanideee.UDWM.blocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; import net.minecraftforge.common.extensions.IForgeBlockState; public class SilverLeaves extends Block { public SilverLeaves() { super(Properties.create(Material.LEAVES) .hardnessAndResistance(0.2f, 0.2f) .sound(SoundType.PLANT) .notSolid() ); } } { "parent": "block/leaves", "textures": { "all": "udwm:blocks/silver_leaves" } }
  20. What do I have to do to get transparent textures into the game? I have overwritten "isTransparent" and "isVaiableOpacity" but it remains grey where it should be transparent. It is a SixWayBlock that I have overwritten. Blockstate and models load normally.
  21. Hi, when I render transparent block on this lit furnace, it renders darker from side of furnace. But it looks horrible. It is possible to somehow get rid of this? Example: Block: public class ChimneyBlock extends Block { protected static final VoxelShape SHAPE = Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 16.0D, 13.0D); public ChimneyBlock(Properties properties) { super(properties); } @SuppressWarnings("deprecation") @Override public boolean isTransparent(BlockState state) { return true; } @SuppressWarnings("deprecation") @Override @Nonnull public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPE; } } Register: Block.Properties chimneyProperties = Block.Properties.create(Material.ROCK).harvestLevel(ItemTier.STONE.getHarvestLevel()).harvestTool(ToolType.PICKAXE). hardnessAndResistance(2, 2).variableOpacity(); registry.register(new ChimneyBlock(chimneyProperties).setRegistryName(MODID, "chimney"));
  22. I have a block with part of it transparent, but the transparent part shows as white. I saw a topic about this and the solution was to put getBlockLayer(IBlockState state) but it gives an error: "The method getBlockLayer(IBlockState) of type JarBlock must override or implement a supertype method" JarBlock class (the class with the problem) package bigpapa.mod.blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumBlockRenderType; public class JarBlock extends BlockBase { public JarBlock(String name, Material materialIn) { super(name, materialIn); setSoundType(SoundType.GLASS); setHardness(1F); setResistance(15000000F); setHarvestLevel("pickaxe", 1); } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isOpaqueCube(IBlockState state) { //error here return false; } } BlockBase class package bigpapa.mod.blocks; import bigpapa.mod.Main; import bigpapa.mod.init.ModBlocks; import bigpapa.mod.init.ModItems; import bigpapa.mod.util.IHasModel; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.BlockRenderLayer; public class BlockBase extends Block implements IHasModel { public BlockBase(String name, Material materialIn) { super(materialIn); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MATERIALS); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } } Thanks
  23. [ANSWERED] How do I make my Blocks have an Opacity like Glass I tried going to another question but I couldn't find my answer I tried using isOpaqueCube from Block.java but It throughs an error because it is final @Override public final boolean isOpaqueCube(BlockState state, IBlockReader worldIn, BlockPos pos) { return false; } I do not know how to do this can someone please help. here is my code:
  24. I created a block: BlockList.butter_block = new Block(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.0f, 3.0f) .lightValue(15) .sound(SoundType.SLIME) .slipperiness(1.06f) .variableOpacity() ).setRegistryName(location("butter_block")) I created a transparent texture and the blockItem in hand is transparent (like grass) but it's opaque (not transparent) when put on the ground. What's the problem? Minecraft 13.2 Forge 25
  25. I recently made a model and in the game i see a transparent layer under my model, Can someone help me?
×
×
  • Create New...

Important Information

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