Jump to content

MatsCraft1

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by MatsCraft1

  1. like this? @OnlyIn(Dist.CLIENT) @SubscribeEvent public static void registerBlockColorHandlers(final ColorHandlerEvent.Block event) { event.getBlockColors().register((x, reader, pos, u) -> reader != null && pos != null ? BiomeColors.getGrassColor(reader, pos) : GrassColors.get(0.5D, 1.0D), MoreStuff.MARBLEGRASS); }
  2. Okay, I got this far now package com.aug15.morestuff.blocks; import com.aug15.morestuff.MoreStuff; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.item.BlockItem; import net.minecraft.world.GrassColors; import net.minecraft.world.biome.BiomeColors; import net.minecraftforge.client.event.ColorHandlerEvent; import net.minecraftforge.event.terraingen.BiomeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = MoreStuff.MODID) public class ModColourManager { @SubscribeEvent public static void registerBlockColourHandlers(final ColorHandlerEvent.Block event) { final BlockColors blockColors = event.getBlockColors(); final IBlockColor grassColourHandler = (state, blockAccess, pos, tintIndex) -> { if (blockAccess != null && pos != null) { return BiomeEvent.BiomeColor.GetGrassColor(biome, original); } return GrassColors.get(0.5D, 1.0D); }; blockColors.register(grassColourHandler, MoreStuff.MARBLEGRASS); } @SubscribeEvent public static void registerItemColourHandlers(final ColorHandlerEvent.Item event) { final BlockColors blockColors = event.getBlockColors(); final ItemColors itemColors = event.getItemColors(); final IItemColor itemBlockColourHandler = (stack, tintIndex) -> { @SuppressWarnings("deprecation") final BlockState state = ((BlockItem) stack.getItem()).getBlock().getDefaultState(); return blockColors.getColor(state, null, null, tintIndex); }; itemColors.register(itemBlockColourHandler, MoreStuff.MARBLEGRASS); } } but I have no idea what to put here return BiomeEvent.BiomeColor.GetGrassColor(biome, original); "biome, original" is marked as wrong "cannot resolve symbol"
  3. I found out what the problem is, I need a ColorHandler.
  4. Okay, this is how I registered it: public static final Block MARBLEGRASS = new GrassBlock(Block.Properties.create(Material.ORGANIC) .tickRandomly().hardnessAndResistance(4.0F).sound(SoundType.PLANT)).setRegistryName("marble_grass"); event.getRegistry().register(MoreStuff.MARBLEGRASS); event.getRegistry().register(new MarbleDirt_BlockItem(MoreStuff.MARBLEGRASS, properties.group(MoreStuff.morestuff_rock.GroupRock).maxStackSize(32)).setRegistryName("marble_grass")); I made the model files just like the vanilla ones, the BlockItem has a texture where the "grass" part is grey, just like the texture file. When I place my block it has the error texture and I have no idea why, could you help me or give me any reference? Here are my model files: morestuff/blockstates/marble_grass { "variants": { "snowy=false": [ { "model": "morestuff:block/soil/marble_grass" }, { "model": "morestuff:block/soil/marble_grass", "y": 90 }, { "model": "morestuff:block/soil/marble_grass", "y": 180 }, { "model": "morestuff:block/soil/marble_grass", "y": 270 } ], "snowy=true": { "model": "morestuff:block/soil/marble_grass_snowy" } } } morestuff/models/block/soil/marble_grass { "parent": "block/block", "textures": { "particle": "morestuff:block/soil/dirt_marble", "bottom": "morestuff:block/soil/dirt_marble", "top": "block/grass_block_top", "side": "morestuff:block/soil/dirt_marble", "overlay": "block/grass_block_side_overlay" }, "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top", "cullface": "up", "tintindex": 0 }, "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#side", "cullface": "east" } } }, { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" } } } ] } morestuff/models/block/soil/marble_grass_snowy { "parent": "block/cube_bottom_top", "textures": { "particle": "morestuff:block/soil/dirt_marble", "bottom": "morestuff:block/soil/dirt_marble", "top": "block/grass_block_top", "side": "morestuff:block/soil/marble_grass_snowy" } } morestuff/models/item/marble_grass { "parent": "morestuff:block/soil/marble_grass" }
  5. omg I'm so stupid, sorry guys! I didn't even register the block, just the block item!
  6. Kind of off topic but do you know how to make the stairs become "corners"?
  7. Okay it gives me this crash It worked little time ago, I have undone all changes and it still crashed. It was also not registering 3 of my blocks although they were registered like all the others and it told me:
  8. okay this might sound totally stupid but... what should I put in there? It feels like my last brain cell just died.
  9. 1. I use IDEA 2. If I put activeItemStack.damageItem(i, LivingEntity); it tells me that it expects an expression. If I put activeItemStack.damageItem(i, player); it tells me that it cannot be applied to "player"
  10. So here is my code package com.aug15.morestuff.items; import net.minecraft.block.DispenserBlock; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ArmorItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.UseAction; import net.minecraft.util.*; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class ItemShield extends Item { public ItemShield(Item.Properties builder) { super(builder); this.addPropertyOverride(new ResourceLocation("blocking"), (ItemStack stack, World worldIn, LivingEntity player1) -> { return player1 != null && player1.isHandActive() && player1.getActiveItemStack() == stack ? 1.0F : 0.0F; }); DispenserBlock.registerDispenseBehavior(this, ArmorItem.DISPENSER_BEHAVIOR); } public String getTranslationKey(ItemStack stack) { return stack.getChildTag("BlockEntityTag") != null ? this.getTranslationKey() : super.getTranslationKey(stack); } public UseAction getUseAction(ItemStack stack) { return UseAction.BLOCK; } public int getUseDuration(ItemStack stack) { return 300; } public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); playerIn.setActiveHand(handIn); return new ActionResult<>(ActionResultType.SUCCESS, itemstack); } @SubscribeEvent @OnlyIn(Dist.CLIENT) public void attackEvent(LivingAttackEvent e) { float damage = e.getAmount(); ItemStack activeItemStack; PlayerEntity player; if (!(e.getEntityLiving() instanceof PlayerEntity)) { return; } player = (PlayerEntity) e.getEntityLiving(); if (player.getActiveItemStack() == null) { return; } activeItemStack = player.getActiveItemStack(); if (damage > 0.0F && activeItemStack != null && activeItemStack.getItem() instanceof ItemShield) { int i = 1 + MathHelper.floor(damage); activeItemStack.damageItem(i, NO IDEA HERE); if (activeItemStack.getCount() <= 0) { Hand enumhand = player.getActiveHand(); net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, activeItemStack, enumhand); if (enumhand == Hand.MAIN_HAND) { player.setItemStackToSlot(EquipmentSlotType.MAINHAND, (ItemStack) null); } else { player.setItemStackToSlot(EquipmentSlotType.OFFHAND, (ItemStack) null); } activeItemStack = null; player.playSound(SoundEvents.ITEM_SHIELD_BREAK, 0.8F, 0.8F + player.world.rand.nextFloat() * 0.4F); } } } } } The problem is this part if (damage > 0.0F && activeItemStack != null && activeItemStack.getItem() instanceof ItemShield) { int i = 1 + MathHelper.floor(damage); activeItemStack.damageItem(i, NO IDEA HERE); if I do "activeItemStack.damageItem(i, EntityLiving);" or "activeItemStack.damageItem(i, player);" it tells me it's wrong... I have no idea what to do there?!
  11. I guess I was messing around I think I have: What shall I do instead? At first it was a white box, then I started messing around with the code until it was actually invisible, I can see a shadow but nothing else
  12. It loads for me. Just wait or try using a Proxy or restarting your Lan, I guess.
  13. My problem is that my Entity is invisible. Here's all of my code for the Entity. ModEntityRender.java BoarEntityModel.java ModRenderRegistry.java MorestuffEntity.java And I called this "EntityBoarNow.java" (strange name, don't ask why) This is in my ClientProxy.java And this in my Main It might be possible that I missed some file here. Please be nice to me @diesieben07 this is my first post
  14. In your model "Bamboo_rolling_mat" is uppercase, I don't think that's good. Are there maybe some low opacity areas on your texture file? They could cause it.
  15. Hey Guys, If you know "The Official Crafting Dead" where you can wear "suits" and they get on your skin, I want to do something like this, it gives armor points and is directly ON your Skin! How do I code something like this???
×
×
  • Create New...

Important Information

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