Skip to content

Commit 1c6ceca

Browse files
committed
Bug fixes
1 parent d01357a commit 1c6ceca

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

src/main/resources/neoforge-1.20.6/procedures/entity_add_modifier.java.ftl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
<#include "mcelements.ftl">
21
<#assign attr = generator.map(field$attribute, "attributes")>
32
if (${input$entity} instanceof LivingEntity _entity) {
4-
AttributeModifier modifier = new AttributeModifier(${toResourceLocation('"' + modid + ':' + field$name + '"')}, ${input$value}, AttributeModifier.Operation.${field$operation});
5-
if (!_entity.getAttribute(${attr}).hasModifier(modifier.id())) {
3+
AttributeModifier modifier = new AttributeModifier(${'"' + modid + ':' + field$name + '"'}, ${input$value}, AttributeModifier.Operation.${field$operation});
4+
if (_entity.getAttribute(${attr}).getModifiers().stream().noneMatch((e) -> e.name().equals(modifier.name()))) {
65
<#if field$permanent == "TRUE">
76
_entity.getAttribute(${attr}).addPermanentModifier(modifier);
87
<#else>
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<#include "mcelements.ftl">
21
(${input$entity} instanceof LivingEntity _livingEntity${cbi} && _livingEntity${cbi}.getAttribute(${generator.map(field$attribute, "attributes")})
3-
.hasModifier(${toResourceLocation('"' + modid + ':' + field$name + '"')}))
2+
.getModifiers().stream().anyMatch((e) -> e.name().equals(${'"' + modid + ':' + field$name + '"'})))
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<#include "mcelements.ftl">
21
if (${input$entity} instanceof LivingEntity _entity) {
3-
_entity.getAttribute(${generator.map(field$attribute, "attributes")}).removeModifier(${toResourceLocation('"' + modid + ':' + field$name + '"')});
2+
_entity.getAttribute(${generator.map(field$attribute, "attributes")}).getModifiers().forEach((_attribute) -> {
3+
if(_attribute.name().equals(${'"' + modid + ':' + field$name + '"'})) _entity.getAttribute(${generator.map(field$attribute, "attributes")}).removeModifier(_attribute);
4+
});
45
}

src/main/resources/neoforge-1.20.6/templates/block/block.java.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,8 @@ public class ${name}Block extends
482482
</#if>
483483

484484
<#if data.strippingResult?? && !data.strippingResult.isEmpty()>
485-
@Override public BlockState getToolModifiedState(BlockState blockstate, UseOnContext context, ItemAbility itemAbility, boolean simulate) {
486-
if (ItemAbilities.AXE_STRIP == itemAbility && context.getItemInHand().canPerformAction(itemAbility)) {
485+
@Override public BlockState getToolModifiedState(BlockState blockstate, UseOnContext context, ToolAction itemAbility, boolean simulate) {
486+
if (ToolActions.AXE_STRIP == itemAbility && context.getItemInHand().canPerformAction(itemAbility)) {
487487
return ${mappedBlockToBlock(data.strippingResult)}.withPropertiesOf(blockstate);
488488
}
489489
return super.getToolModifiedState(blockstate, context, itemAbility, simulate);

src/main/resources/neoforge-1.20.6/templates/item/item_renderer.java.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ package ${package}.client.renderer.item;
9494
else
9595
</#if>
9696
model.setupAnim(null, 0, 0, (System.currentTimeMillis() - start) / 50.0f, 0, 0);
97-
model.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay);
97+
model.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay, 1, 1, 1, 1);
9898
poseStack.popPose();
9999
}
100100

src/main/resources/neoforge-1.20.6/templates/plant/plant.java.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public class ${name}Block extends ${getPlantClass(data.plantType)}Block
187187
</#if>
188188

189189
<#if data.strippingResult?? && !data.strippingResult.isEmpty()>
190-
@Override public BlockState getToolModifiedState(BlockState blockstate, UseOnContext context, ItemAbility itemAbility, boolean simulate) {
191-
if (ItemAbilities.AXE_STRIP == itemAbility && context.getItemInHand().canPerformAction(itemAbility)) {
190+
@Override public BlockState getToolModifiedState(BlockState blockstate, UseOnContext context, ToolAction itemAbility, boolean simulate) {
191+
if (ToolActions.AXE_STRIP == itemAbility && context.getItemInHand().canPerformAction(itemAbility)) {
192192
return ${mappedBlockToBlock(data.strippingResult)}.withPropertiesOf(blockstate);
193193
}
194194
return super.getToolModifiedState(blockstate, context, itemAbility, simulate);

0 commit comments

Comments
 (0)