• 0

    posted a message on Help with Stripping Custom Wood Blocks

    I just can't seem to get this to work. I just want this to act as the vanilla logs do, any help is appreciated!

    public class EventHandler {
    
    protected static final Map<Block, Block> BLOCK_STRIPPING_MAP = new HashMap<>();
    
    
        static {
            BLOCK_STRIPPING_MAP.put(BlockInit.MOSSY_LOG.get(), BlockInit.STRIPPED_MOSSY_LOG.get());
            BLOCK_STRIPPING_MAP.put(BlockInit.MOSSY_WOOD.get(), BlockInit.STRIPPED_MOSSY_WOOD.get());
        }
    
        @SubscribeEvent
        public static void onBlockClicked(PlayerInteractEvent.RightClickBlock event) {
            if (event.getItemStack().getItem() instanceof AxeItem) {
                World world = event.getWorld();
                BlockPos blockpos = event.getPos();
                BlockState blockstate = world.getBlockState(blockpos);
                Block block = BLOCK_STRIPPING_MAP.get(blockstate.getBlock());
                if (block != null) {
                    PlayerEntity playerentity = event.getPlayer();
                    world.playSound(playerentity, blockpos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F);
                    if (!world.isRemote) {
                        world.setBlockState(blockpos, block.getDefaultState()
                                .with(RotatedPillarBlock.AXIS, blockstate.get(RotatedPillarBlock.AXIS)), 11);
                        if (playerentity != null) {
                            event.getItemStack().damageItem(1, playerentity, (p_220040_1_) -> {
                                p_220040_1_.sendBreakAnimation(event.getHand());
                            });
                        }
                    }
                }
            }
    
        }
    
    }
    Posted in: Modification Development
  • 0

    posted a message on Trouble with Registering Particle Factory

    Got it working! I had registered RegistryObject<BasicParticleType> as RegistryObject<ParticleType<?>>

    Posted in: Modification Development
  • 0

    posted a message on Trouble with Registering Particle Factory

    Trying to get my dripping particles to work.


    Factory

    	   @OnlyIn(Dist.CLIENT)
    	   public static class DrippingLumiFactory implements IParticleFactory<BasicParticleType> {
    	      protected final IAnimatedSprite spriteWithAge;
    
    	      public DrippingLumiFactory(IAnimatedSprite spriteWithAge) {
    	         this.spriteWithAge = spriteWithAge;
    	      }
    
    	      public Particle makeParticle(BasicParticleType typeIn, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
    	         DrippingLumi.Dripping dripparticle$dripping = new DrippingLumi.Dripping(worldIn, x, y, z, Fluids.EMPTY, ParticleInit.FALLING_LUMI.get());
    	         dripparticle$dripping.particleGravity *= 0.01F;
    	         dripparticle$dripping.maxAge = 100;
    	         dripparticle$dripping.setColor(0.186F, 0.209F, 0.070F);
    	         dripparticle$dripping.selectSpriteRandomly(this.spriteWithAge);
    	         return dripparticle$dripping;
    	      }
    	   }


    registerFactory

    @EventBusSubscriber(modid = MyMod.MOD_ID, bus = Bus.MOD)
    public class ParticleUtil {
    	
    	@SubscribeEvent(priority = EventPriority.LOWEST)
    	public static void registerParticles(ParticleFactoryRegisterEvent event) {
    		Minecraft.getInstance().particles.registerFactory(ParticleInit.DRIPPING_LUMI.get(), new DrippingLumi.DrippingLumiFactory());
    
    	}
    }

    .registerFactory gives an error, "The method registerFactory(ParticleType<T>, IParticleFactory<T>) in the type ParticleManager is not applicable for the arguments (ParticleType<capture#1-of ?>, DrippingLumi.DrippingLumiFactory)"


    Help!!

    Posted in: Modification Development
  • 0

    posted a message on Help with XP dropping from custom ore

    Fixed it!! Didn't assign the new block as OreBlock in my block init class. Thanks!!

    Posted in: Modification Development
  • 0

    posted a message on Custom Particle Help

    I'm new to java, I'm trying to make my custom block have a dripping effect, such as a full bee nest drips with honey. I'm just getting tons of syntax errors. Any help would be appreciated!


    package com.pixxibunny.mymod.common.blocks;
    
    import java.util.Random;
    
    import net.minecraft.block.BlockState;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.World;
    import net.minecraftforge.api.distmarker.Dist;
    import net.minecraftforge.api.distmarker.OnlyIn;
    
    @OnlyIn(Dist.CLIENT)
    public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
        if (this == Blocks.CUSTOM_BLOCK.get()) {
           for(int i = 0; i < rand.nextInt(1) + 1; ++i) {
              this.addHoneyParticle(worldIn, pos, stateIn);
           }
        }
    
     }
    
    Posted in: Modification Development
  • 0

    posted a message on Help with XP dropping from custom ore

    Still not working.


    package com.pixxibunny.mymod.core.init;
    
    import java.util.Random;
    
    import com.pixxibunny.mymod.MyMod;
    
    import net.minecraft.block.AbstractBlock;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockState;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.util.math.MathHelper;
    import net.minecraft.world.server.ServerWorld;
    
    public class OreBlock extends Block {
    
    	   public OreBlock(AbstractBlock.Properties properties) {
    		      super(properties);}
    
    		   protected int getExperience(Random rand) {
    			   if (this == BlockInit.CUSTOM_ORE.get())
    			   {		
    				   return MathHelper.nextInt(rand, 3, 7);
    			   }
    			   else return 0;
    
    			      
    			      
    	}
    Posted in: Modification Development
  • 0

    posted a message on Help with XP dropping from custom ore

    Probably did this wrong but,


    package com.pixxibunny.mymod.core.init;
    
    import java.util.Random;
    
    import com.pixxibunny.mymod.MyMod;
    
    import net.minecraft.block.AbstractBlock;
    import net.minecraft.block.Block;
    import net.minecraft.util.math.MathHelper;
    
    public class OreBlock extends Block {
    
    	   public OreBlock(AbstractBlock.Properties properties) {
    		      super(properties);}
    
    		   protected int getExperience(Random rand) {
    			      if (this == BlockInit.CUSTOM_ORE.get()){
    			         return MathHelper.nextInt(rand, 3, 7);
    			      }
    			      
    	}
    }

    Doesn't work, needs a return statement but there's literally one right under it?

    Posted in: Modification Development
  • 0

    posted a message on Illumination Effect Help?

    I'm new to java and I was wondering if there was anyone who could help me out. I'm trying to make an effect that acts as dynamic light emitting from the player.


    package com.pixxibunny.mymod.common.effects;
    
    import net.minecraft.entity.LivingEntity;
    import net.minecraft.potion.Effect;
    import net.minecraft.potion.EffectType;
    
    public class IlluminationEffect extends Effect {
    
    	protected IlluminationEffect() {
    		super(EffectType.BENEFICIAL, 16771609);
    	}
    	
    	};
    
    

    If I could just get some pointers of where to go from here, that'd be much appreciated!

    Posted in: Modification Development
  • 0

    posted a message on Help with XP dropping from custom ore

    I'm pretty new to java, I was wondering if anyone knew how to fix this issue I've been having.


    I tried to make an OreBlock.class so I could have my custom ore drop XP when harvested (excluding Silk Touch).


    package com.pixxibunny.mymod.core.init;
    
    import java.util.Random;
    
    import com.pixxibunny.mymod.MyMod;
    
    import net.minecraft.block.AbstractBlock;
    import net.minecraft.block.Block;
    import net.minecraft.util.math.MathHelper;
    
    public class OreBlock extends Block {
    
    	   public OreBlock(AbstractBlock.Properties properties) {
    		      super(properties);}
    
    		   protected int getExperience(Random rand) {
    			      if (this == BlockInit.CUSTOM_ORE){
    			         return MathHelper.nextInt(rand, 3, 7);
    			      };
    			      
    	}}

    "if (this == BlockInit.CUSTOM_ORE){" is saying "Incompatible operand types OreBlock and RegistryObject<Block>"

    Any help would be much appreciated!!

    Posted in: Modification Development
  • 0

    posted a message on Testfor amount of specific item in player inventory?

    Is there a way to test for over a stack of blocks? I need it to find 125 logs in your inventory but it won't work.

    Command: /testfor @a {Inventory:[{id:minecraft:log,Count:125b}]}

    Posted in: Redstone Discussion and Mechanisms
  • 0

    posted a message on Minecraft Crash After Driver Update??

    Ok so there's no crash report at all...

    Posted in: Java Edition Support
  • 0

    posted a message on Minecraft Crash After Driver Update??

    I don't know what a DxDiag is but ill send you the crash report next time it happens.

    Posted in: Java Edition Support
  • 0

    posted a message on Minecraft Crash After Driver Update??

    As you can see by the title, I've recently updated my AMD Radeon drivers and my Minecraft has been crashing ever since. If I press my Windows key, I can get out of Minecraft and back to my desktop from fullscreen. Whenever I go back and try to move around in a server, or sometimes randomly for no reason at all, it crashes. I used to be able to do this but I can I can't anymore. Any suggestions? Thanks in advance!

    Posted in: Java Edition Support
  • To post a comment, please .