Skip to content

Instantly share code, notes, and snippets.

@Densyakun Densyakun/Main.java
Created Feb 13, 2018

Embed
What would you like to do?
[ForgeMOD]最強になるMOD?
package org.densyakun.forge.test;
import java.util.List;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@Mod(modid="test", version="1.0")
public class Main {
@EventHandler
public void init(FMLInitializationEvent event) {
FMLCommonHandler.instance().bus().register(this);
}
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
Minecraft.getMinecraft().thePlayer.setSprinting(true);
Minecraft.getMinecraft().thePlayer.setAir(10);
Minecraft.getMinecraft().thePlayer.setHealth(20f);
Minecraft.getMinecraft().thePlayer.setFire(0);
Minecraft.getMinecraft().thePlayer.setScore(10000);
List<Entity> list = Minecraft.getMinecraft().theWorld.getLoadedEntityList();
for (int a = 0; a < list.size(); a++) {
if ((list.get(a) instanceof EntityPlayer) ? !((EntityPlayer) list.get(a)).getDisplayName().equals(Minecraft.getMinecraft().thePlayer.getDisplayName()) : true) {
Minecraft.getMinecraft().thePlayer.attackTargetEntityWithCurrentItem(list.get(a));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.