Skip to content

Instantly share code, notes, and snippets.

@Densyakun
Created February 13, 2018 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Densyakun/bdfdbcbfef91ab7e957533718851639e to your computer and use it in GitHub Desktop.
Save Densyakun/bdfdbcbfef91ab7e957533718851639e to your computer and use it in GitHub Desktop.
[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