Roman Sarkisov
Ученик
(124),
на голосовании
4 года назад
Возможно ли вообще программировать в майнкрафте? Именно пользуясь не MakeCode или компилятормаи на python, а напрямую? Можно например datapacks делать, но неужели это единственный способ? Видел на форуме вот такой вот отрывочек кода. На каком языке это написано и желательно ссылку на сайт или инструкцию с описанием интеграции этого в minecraft public class BionisationEffectSyncEventHandler {
public HashMap<String, Collection> effects = new HashMap<String, Collection>();
@SubscribeEvent public void onPlayerDeath(LivingDeathEvent event) {
public class BionisationEffectSyncEventHandler {
public HashMap<String, Collection> effects = new HashMap<String, Collection>();
@SubscribeEvent
public void onPlayerDeath(LivingDeathEvent event) {
if(event.entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)event.entity;
Collection coll = player.getActivePotionEffects();
if(!coll.isEmpty()){
for (Object o : coll) {
PotionEffect effect = (PotionEffect)o;
if(effect.getPotionID() == BionisationPotionList.AncientFlowerEffect.id || effect.getPotionID() == BionisationPotionList.EnderFlowerEffect.id || effect.getPotionID() == BionisationPotionList.FireFlowerEffect.id || effect.getPotionID() == BionisationPotionList.WaterFlowerEffect.id || effect.getPotionID() == BionisationPotionList.ImmunityRegenEffect.id)
coll.remove(effect);
}
if(!coll.isEmpty())
effects.put(player.getCommandSenderName(), coll);
}
}
}
@SubscribeEvent
public void onPlayerRespawn(PlayerRespawnEvent event) {
EntityPlayer player = (EntityPlayer)event.player;
if(effects.containsKey(player.getCommandSenderName())){
Collection coll = effects.get(player.getCommandSenderName());
if(!coll.isEmpty()){
for (Object o : coll) {
PotionEffect effect = (PotionEffect)o;
player.addPotionEffect(effect);
}
effects.remove(player.getCommandSenderName());
}
}
}
@SubscribeEvent
public void onCloneEffectsPlayer(PlayerEvent.Clone event) {
Collection coll = event.original.getActivePotionEffects();
if(!coll.isEmpty()){
for (Object o : coll) {
PotionEffect effect = (PotionEffect)o;
event.entityPlayer.addPotionEffect(effect);
}
}