-
Posts
52 -
Joined
-
Last visited
Everything posted by Eilux
-
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
That sounds like it will work I am however having trouble finding where Minecraft is instantiated so I can reflect it. -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
That might work but players could work around it by assigning the attack button to a different key. -
setSoundType() is protected and as a result of this I'm unable to set sounds on my blocks without having to create a new class for each of them which is something I would rather not do. The only other solution that comes to mind is the use of some kind of BlockBase class that makes it public but that dose not seem like a good solution either. Dose anyone else have a workaround for this.
-
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
It's working now. I was wondering if there is also a way to prevent the animation from happening and the attack speed from reseting. Thank you everyone for your help so far. -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
I have tried putting the event in an event handler class and registering it but it still isn't working. package eilux.mod.util; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod.EventBusSubscriber public class EventHandler { @SubscribeEvent public void AttackEntityEvent(AttackEntityEvent event) { event.setCanceled(true); } } -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
heres the rest of my main if that helps: package eilux.mod; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod(modid = Main.MODID, name = Main.NAME, version = Main.VERSION, acceptedMinecraftVersions = Main.MC_VERSION) public class Main { public static final String MODID = "mc_general_expansion"; public static final String NAME = "Minecraft General Expansion"; public static final String VERSION = "0.0"; public static final String MC_VERSION = "[1.12.2]"; public static final Logger LOGGER = LogManager.getLogger(Main.MODID); @Mod.EventHandler public void preInit(FMLPreInitializationEvent event){ } @Mod.EventHandler public void init(FMLInitializationEvent event){ LOGGER.info(Main.NAME + " says it wants functionality."); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event){ } @SubscribeEvent public void AttackEntityEvent(AttackEntityEvent event) { event.setCanceled(true); } } -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
I created some test code in my Main however it doesn't seem to work. @SubscribeEvent public void AttackEntityEvent(AttackEntityEvent event){ event.setCanceled(true); } -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
how do you actually cancel the event. -
new Block(Material.IRON).setRegistryName("ruby_block").setCreativeTab(CreativeTabs.BUILDING_BLOCKS).setHardness(5.0F).setResistance(10.0F).setHarvestLevel("pickaxe",2);
-
whenever I add .setHarvestLevel() to the Block class it gives me an incompatible type error: expected: Block, got: void
-
Is it necessary to make a new class for every block or item added or is it acceptable to make a generic block class that takes in parameters the one that i had been using previously was this. package mod.eilux.mcge.blocks; import mod.eilux.mcge.McGE; import mod.eilux.mcge.init.ModBlocks; import mod.eilux.mcge.init.ModItems; import mod.eilux.mcge.util.IHasModel; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class BlockBase extends Block implements IHasModel { private static final Map<String, SoundType> soundIndex; private static final Map<String,CreativeTabs> tabIndex; static { Map<String, SoundType> tempSoundIndex = new HashMap<>(); tempSoundIndex.put("metal", SoundType.METAL); tempSoundIndex.put("stone", SoundType.STONE); tempSoundIndex.put("anvil", SoundType.ANVIL); tempSoundIndex.put("cloth", SoundType.CLOTH); tempSoundIndex.put("glass", SoundType.GLASS); tempSoundIndex.put("ground", SoundType.GROUND); tempSoundIndex.put("ladder", SoundType.LADDER); tempSoundIndex.put("plant", SoundType.PLANT); tempSoundIndex.put("sand", SoundType.SAND); tempSoundIndex.put("slime", SoundType.SLIME); tempSoundIndex.put("snow", SoundType.SNOW); tempSoundIndex.put("wood", SoundType.WOOD); soundIndex = Collections.unmodifiableMap(tempSoundIndex); Map<String, CreativeTabs> tempTabIndex = new HashMap<>(); tempTabIndex.put("misc", CreativeTabs.MISC); tempTabIndex.put("brewing", CreativeTabs.BREWING); tempTabIndex.put("building_blocks", CreativeTabs.BUILDING_BLOCKS); tempTabIndex.put("combat", CreativeTabs.COMBAT); tempTabIndex.put("decorations", CreativeTabs.DECORATIONS); tempTabIndex.put("food", CreativeTabs.FOOD); tempTabIndex.put("redstone", CreativeTabs.REDSTONE); tempTabIndex.put("tools", CreativeTabs.TOOLS); tempTabIndex.put("transportation", CreativeTabs.TRANSPORTATION); tabIndex = Collections.unmodifiableMap(tempTabIndex); } public BlockBase(String name, Material material, String tab, String soundType, Float hardness, Float blastRes, String harvestTool, int harvestLevel, Float lightLevel, int opacity){ super(material); setTranslationKey(name); setRegistryName(name); setCreativeTab(tabIndex.get(tab)); setSoundType(soundIndex.get(soundType)); setHardness(hardness); setResistance(blastRes); setHarvestLevel(harvestTool,harvestLevel); setLightLevel(lightLevel); setLightOpacity(opacity); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void registerModels() { McGE.proxy.registerItemRenderer(Item.getItemFromBlock(this),0,"inventory"); } } *I am still in the process of removing IHasModel
-
Is there somewhere where I could find sample code of this.
-
After reading several pages on the forums I have realized that my mod uses several bad practices including IHasModel and a weird convoluted way of registering blocks and items it is very confusing to try to fix without a point of reference so I was wondering if anyone could point me to a good example of block and item registration.
-
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
Everything basically so it ignores the click entirely . -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
1.12.2 -
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
the function says that it will still consume absorption hearts and armor durability I need a way to prevent this. * Also note that appropriate resources (like armor durability and absorption extra hearths) have already been consumed.<br> ... * If this event is canceled, the Entity is not hurt. Used resources WILL NOT be restored. -
I would recommend using MultiMC it us a very helpful when playing with mods it allows you to easily install forge and create new instances of Minecraft.
-
Preventing the player from punching/attacking on left click
Eilux replied to Eilux's topic in Modder Support
no damage, or knockback -
I need a way to temporarily make it so that a player is not able to punch/attack when they hit left click. I don't have any code yet because I'm unsure of where exactly to start.
-
Making a shapeless recipe with multiple of the same item
Eilux replied to Eilux's topic in Modder Support
I have found the problem i forgot to put minecraft: in front of crafting_shapeless -
I have the recipe here done the vanilla way but it doesn't work. { "type": "crafting_shapeless", "ingredients": [ { "item": "minecraft:prismarine_shard" }, { "item": "minecraft:prismarine_shard" }, { "item": "minecraft:prismarine_shard" }, { "item": "minecraft:prismarine_shard" }, { "item": "minecraft:prismarine_crystals" }, { "item": "minecraft:prismarine_crystals" }, { "item": "minecraft:prismarine_crystals" }, { "item": "minecraft:prismarine_crystals" }, { "item": "minecraft:diamond" } ], "result": { "item": "mcge:prismarine_gem", "count": 1 } }
-
Making a block that requires silk touch to drop self
Eilux replied to Eilux's topic in Modder Support
Ok everything seems to be working now thank you for your help. -
Making a block that requires silk touch to drop self
Eilux replied to Eilux's topic in Modder Support
Ok I am having a difficult time figuring out what exactly I'm supposed to do if somebody could show me some sample code that would be very helpful. -
Making a block that requires silk touch to drop self
Eilux replied to Eilux's topic in Modder Support
how should I detect wether the user is using silk touch? -
Making a block that requires silk touch to drop self
Eilux replied to Eilux's topic in Modder Support
what should I override it with?