Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported miscellaneous and first half of entity related procedure blocks to 1.16.4 (#4) #596

Merged
merged 2 commits into from Dec 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1 @@
${JavaModName}.LOGGER.${field$message_type}(${input$message});
@@ -0,0 +1,2 @@
<#include "mcitems.ftl">
/*@ItemStack*/(${mappedMCItemToItemStackCode(input$source,1)}.copy())
@@ -0,0 +1,5 @@
<#if field$damagesource?has_content>
${input$entity}.attackEntityFrom(DamageSource.${generator.map(field$damagesource, "damagesources")},(float)${input$amount});
<#else>
${input$entity}.attackEntityFrom(DamageSource.GENERIC,(float)${input$amount});
</#if>
@@ -0,0 +1 @@
(${input$direction}.getOpposite())
@@ -0,0 +1,12 @@
if(${input$entity} instanceof ServerPlayerEntity) {
Advancement _adv = ((MinecraftServer)((ServerPlayerEntity)${input$entity}).server).getAdvancementManager()
.getAdvancement(new ResourceLocation("${generator.map(field$achievement, "achievements")}"));
AdvancementProgress _ap = ((ServerPlayerEntity) ${input$entity}).getAdvancements().getProgress(_adv);
if (!_ap.isDone()) {
Iterator _iterator = _ap.getRemaningCriteria().iterator();
while(_iterator.hasNext()) {
String _criterion = (String)_iterator.next();
((ServerPlayerEntity) ${input$entity}).getAdvancements().grantCriterion(_adv, _criterion);
}
}
}
@@ -0,0 +1,6 @@
<#include "mcitems.ftl">
if(${input$entity} instanceof PlayerEntity) {
ItemStack _setstack = ${mappedMCItemToItemStackCode(input$item, 1)};
_setstack.setCount((int) ${input$amount});
ItemHandlerHelper.giveItemToPlayer(((PlayerEntity)${input$entity}), _setstack);
}
@@ -0,0 +1,2 @@
if(${input$entity} instanceof LivingEntity)
((LivingEntity)${input$entity}).addPotionEffect(new EffectInstance(${generator.map(field$potion, "potions")},(int) ${input$duration},(int) ${input$level}));
@@ -0,0 +1,2 @@
if(${input$entity} instanceof LivingEntity)
((LivingEntity)${input$entity}).addPotionEffect(new EffectInstance(${generator.map(field$potion, "potions")},(int) ${input$duration},(int) ${input$level}, ${input$ambient}, ${input$particles}));
@@ -0,0 +1 @@
if(${input$entity} instanceof PlayerEntity)((PlayerEntity)${input$entity}).giveExperiencePoints((int)${input$xpamount});
@@ -0,0 +1 @@
if(${input$entity} instanceof PlayerEntity)((PlayerEntity)${input$entity}).addExperienceLevel((int)${input$xpamount});
@@ -0,0 +1,4 @@
if(${input$entity} instanceof PlayerEntity) {
((PlayerEntity)${input$entity}).abilities.allowEdit = ${input$condition};
((PlayerEntity)${input$entity}).sendPlayerAbilities();
}
@@ -0,0 +1,4 @@
if(${input$entity} instanceof PlayerEntity) {
((PlayerEntity)${input$entity}).abilities.allowFlying = ${input$condition};
((PlayerEntity)${input$entity}).sendPlayerAbilities();
}
@@ -0,0 +1 @@
((${input$entity} instanceof LivingEntity)?((LivingEntity)${input$entity}).getTotalArmorValue():0)
@@ -0,0 +1 @@
(${input$entity}.hasPermissionLevel((int) ${input$permissionlevel}))
@@ -0,0 +1 @@
(${input$entity} instanceof LivingEntity ? (((LivingEntity) ${input$entity}).getCreatureAttribute() == CreatureAttribute.${field$type}) : false)
@@ -0,0 +1,11 @@
(new Object(){
public boolean checkGamemode(Entity _ent){
if(_ent instanceof ServerPlayerEntity) {
return ((ServerPlayerEntity) _ent).interactionManager.getGameType() == GameType.${generator.map(field$gamemode, "gamemodes")};
} else if(_ent instanceof PlayerEntity && _ent.world.isRemote) {
NetworkPlayerInfo _npi = Minecraft.getInstance().getConnection().getPlayerInfo(((ClientPlayerEntity) _ent).getGameProfile().getId());
return _npi != null && _npi.getGameType() == GameType.${generator.map(field$gamemode, "gamemodes")};
}
return false;
}
}.checkGamemode(${input$entity}))
@@ -0,0 +1,2 @@
if(${input$entity} instanceof PlayerEntity)
((PlayerEntity)${input$entity}).inventory.clear();
@@ -0,0 +1 @@
if(${input$entity} instanceof LivingEntity)((LivingEntity)${input$entity}).clearActivePotions();
@@ -0,0 +1,2 @@
if(${input$entity} instanceof PlayerEntity)
((PlayerEntity) ${input$entity}).closeScreen();
@@ -0,0 +1,3 @@
if (${input$entity} instanceof LivingEntity) {
((LivingEntity) ${input$entity}).attackEntityFrom(new DamageSource(${input$localization_text}).setDamageBypassesArmor(), (float) ${input$damage_number});
}
@@ -0,0 +1,2 @@
if(!${input$entity}.world.isRemote)
${input$entity}.remove();
@@ -0,0 +1 @@
(${input$entity}.rotationYaw)
@@ -0,0 +1 @@
(${input$entity}.getHorizontalFacing())
@@ -0,0 +1,4 @@
if(${input$entity} instanceof PlayerEntity) {
((PlayerEntity)${input$entity}).abilities.disableDamage = ${input$condition};
((PlayerEntity)${input$entity}).sendPlayerAbilities();
}
@@ -0,0 +1,7 @@
{
Entity _ent = ${input$entity};
if(!_ent.world.isRemote && _ent.world.getServer() != null) {
_ent.world.getServer().getCommandManager().handleCommand(_ent.getCommandSource()
.withFeedbackDisabled().withPermissionLevel(4), ${input$command});
}
}
@@ -0,0 +1 @@
${input$entity}.extinguish();
@@ -0,0 +1 @@
((${input$entity} instanceof PlayerEntity)?((PlayerEntity)${input$entity}).getFoodStats().getFoodLevel():0)
@@ -0,0 +1 @@
((${input$entity} instanceof PlayerEntity) ? ((PlayerEntity)${input$entity}).getAbsorptionAmount() : 0)
@@ -0,0 +1 @@
/*@ItemStack*/((${input$entity} instanceof PlayerEntity)?((PlayerEntity)${input$entity}).inventory.armorInventory.get((int) ${input$slotid}):ItemStack.EMPTY)
@@ -0,0 +1 @@
((${input$entity} instanceof PlayerEntity)?((PlayerEntity)${input$entity}).getFoodStats().getSaturationLevel():0)
@@ -0,0 +1,13 @@
(new Object(){
public int getScore(String score){
if(${input$entity} instanceof PlayerEntity) {
Scoreboard _sc = ((PlayerEntity)${input$entity}).getWorldScoreboard();
ScoreObjective _so = _sc.getObjective(score);
if (_so != null) {
Score _scr = _sc.getOrCreateScore(((PlayerEntity)${input$entity}).getScoreboardName(), _so);
return _scr.getScorePoints();
}
}
return 0;
}
}.getScore(${input$score}))
@@ -0,0 +1,10 @@
<#include "mcitems.ftl">
/*@ItemStack*/(new Object(){
public ItemStack getItemStack(int sltid, Entity entity) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
_retval.set(capability.getStackInSlot(sltid).copy());
});
return _retval.get();
}
}.getItemStack((int)(${input$slotid}), ${input$entity}))
@@ -0,0 +1 @@
((entity instanceof TameableEntity)?((TameableEntity) entity).getOwner() : null)
@@ -0,0 +1 @@
(${input$entity}.getRidingEntity())
@@ -0,0 +1 @@
((${input$entity} instanceof MobEntity) ? ((MobEntity) ${input$entity}).getAttackTarget() : null)
@@ -0,0 +1,2 @@
(((${input$entity} instanceof ServerPlayerEntity)&&(${input$entity}.world instanceof ServerWorld))?((ServerPlayerEntity)${input$entity}).getAdvancements()
.getProgress(((MinecraftServer)((ServerPlayerEntity)${input$entity}).server).getAdvancementManager().getAdvancement(new ResourceLocation("${generator.map(field$achievement, "achievements")}"))).isDone():false)
@@ -0,0 +1,2 @@
<#include "mcitems.ftl">
((${input$entity} instanceof PlayerEntity)?((PlayerEntity)${input$entity}).inventory.hasItemStack(${mappedMCItemToItemStackCode(input$item, 1)}):false)
@@ -0,0 +1 @@
((${input$entity} instanceof LivingEntity)?(${input$entity}.hasNoGravity()):false)
@@ -0,0 +1,10 @@
(new Object(){boolean check(Entity _entity){
if(_entity instanceof LivingEntity){
Collection<EffectInstance> effects=((LivingEntity)_entity).getActivePotionEffects();
for(EffectInstance effect:effects){
if(effect.getPotion()== ${generator.map(field$potion, "potions")})
return true;
}
}
return false;
}}.check(${input$entity}))
@@ -0,0 +1 @@
((${input$entity} instanceof LivingEntity)?((LivingEntity)${input$entity}).getHealth():-1)
@@ -0,0 +1 @@
((${input$entity} instanceof LivingEntity)?((LivingEntity)${input$entity}).getMaxHealth():-1)
@@ -0,0 +1,10 @@
{
AtomicReference<IItemHandler> _iitemhandlerref = new AtomicReference<>();
${input$entity}.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> _iitemhandlerref.set(capability));
if (_iitemhandlerref.get() != null) {
for(int _idx = 0; _idx < _iitemhandlerref.get().getSlots(); _idx++) {
ItemStack itemstackiterator = _iitemhandlerref.get().getStackInSlot(_idx).copy();
${statement$foreach}
}
}
}
@@ -0,0 +1 @@
(${input$entity}.isAlive())
@@ -0,0 +1 @@
(${input$entity}.isBeingRidden())
@@ -0,0 +1 @@
(${input$entity}.isBurning())
@@ -0,0 +1 @@
((${input$entity} instanceof LivingEntity)?((LivingEntity)${input$entity}).isChild():false)
@@ -0,0 +1 @@
((${input$entity} instanceof PlayerEntity)?((PlayerEntity)${input$entity}).abilities.isCreativeMode:false)
@@ -0,0 +1 @@
(${input$entity}.isImmuneToExplosions())
@@ -0,0 +1 @@
(${input$entity}.isImmuneToFire())
@@ -0,0 +1 @@
(${input$entity}.isInLava())
@@ -0,0 +1 @@
(${input$entity}.isInvisible())
@@ -0,0 +1 @@
(${input$entity}.isInvulnerable())
@@ -0,0 +1 @@
(${input$entity}.isInWater())
@@ -0,0 +1 @@
(${input$entity}.isInWaterOrBubbleColumn())
@@ -0,0 +1 @@
(${input$entity}.isInWaterRainOrBubbleColumn())
@@ -0,0 +1 @@
((${input$entity} instanceof MobEntity)?((MobEntity) ${input$entity}).getLeashed():false)
@@ -0,0 +1 @@
(${input$entity}.isNonBoss())
@@ -0,0 +1 @@
(${input$entity}.isPassenger())
@@ -0,0 +1 @@
(${input$entity}.isSneaking())
@@ -0,0 +1 @@
(${input$entity}.isSprinting())
@@ -0,0 +1 @@
((${input$entity} instanceof TameableEntity)?((TameableEntity)${input$entity}).isTamed():false)
@@ -0,0 +1,2 @@
((${input$entity} instanceof TameableEntity && ${input$tamedBy} instanceof LivingEntity)
?((TameableEntity)${input$entity}).isOwner((LivingEntity)${input$tamedBy}):false)
@@ -0,0 +1 @@
/*@ItemStack*/((${input$entity} instanceof LivingEntity)?((LivingEntity)${input$entity}).getHeldItemMainhand():ItemStack.EMPTY)
@@ -0,0 +1 @@
/*@ItemStack*/((${input$entity} instanceof LivingEntity)?((LivingEntity)${input$entity}).getHeldItemOffhand():ItemStack.EMPTY)
@@ -0,0 +1,3 @@
(${input$entity}.world.rayTraceBlocks(new RayTraceContext(${input$entity}.getEyePosition(1f), ${input$entity}.getEyePosition(1f)
.add(${input$entity}.getLook(1f).x * ${input$maxdistance}, ${input$entity}.getLook(1f).y * ${input$maxdistance}, ${input$entity}.getLook(1f).z * ${input$maxdistance}),
RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, ${input$entity})).getPos().getX())
@@ -0,0 +1,3 @@
(${input$entity}.world.rayTraceBlocks(new RayTraceContext(${input$entity}.getEyePosition(1f), ${input$entity}.getEyePosition(1f)
.add(${input$entity}.getLook(1f).x * ${input$maxdistance}, ${input$entity}.getLook(1f).y * ${input$maxdistance}, ${input$entity}.getLook(1f).z * ${input$maxdistance}),
RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, ${input$entity})).getPos().getY())
@@ -0,0 +1,3 @@
(${input$entity}.world.rayTraceBlocks(new RayTraceContext(${input$entity}.getEyePosition(1f), ${input$entity}.getEyePosition(1f)
.add(${input$entity}.getLook(1f).x * ${input$maxdistance}, ${input$entity}.getLook(1f).y * ${input$maxdistance}, ${input$entity}.getLook(1f).z * ${input$maxdistance}),
RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, ${input$entity})).getPos().getZ())
@@ -0,0 +1 @@
${input$sourceentity}.startRiding(${input$entity});
@@ -0,0 +1,4 @@
if ((${input$entity} instanceof TameableEntity) && (${input$sourceentity} instanceof PlayerEntity)) {
((TameableEntity) ${input$entity}).setTamed(true);
((TameableEntity) ${input$entity}).setTamedBy((PlayerEntity) ${input$sourceentity});
}
@@ -0,0 +1 @@
(${input$entity}.getDisplayName().getString())
@@ -0,0 +1 @@
(${input$entity}.getPersistentData().getBoolean(${input$tagName}))
@@ -0,0 +1 @@
${input$entity}.getPersistentData().putBoolean(${input$tagName}, ${input$tagValue});
@@ -0,0 +1 @@
(${input$entity}.getPersistentData().getDouble(${input$tagName}))
@@ -0,0 +1 @@
${input$entity}.getPersistentData().putDouble(${input$tagName}, ${input$tagValue});
@@ -0,0 +1 @@
(${input$entity}.getPersistentData().getString(${input$tagName}))
@@ -0,0 +1 @@
${input$entity}.getPersistentData().putString(${input$tagName}, ${input$tagValue});