Skip to content

Commit 8374e52

Browse files
[CHANGE] modify code to make it work on both neoforge and later forge versions on 1.20.1
1 parent fa260fc commit 8374e52

File tree

5 files changed

+122
-23
lines changed

5 files changed

+122
-23
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Add to changelog
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
if: contains(github.event.head_commit.message, '[CHANGE]')
7+
steps:
8+
- name: Checkout repo
9+
uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 1000
12+
fetch-tags: true
13+
- name: Append changelog file
14+
uses: slegare/write-file-action@1.0.2
15+
with:
16+
path: changelog-1.20.1.txt
17+
write-mode: append
18+
empty-line-eof: true
19+
contents: |
20+
- ${{ github.event.head_commit.message }}
21+
- name: Commit & Push
22+
uses: Andro999b/push@v1.3
23+
with:
24+
github_token: ${{ secrets.GIT_TOKEN}}
25+
branch: ${{ github.ref }}
26+
force: true

.github/workflows/build.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ jobs:
2222
with:
2323
arguments: build
2424
gradle-version: 7.4.2
25-
25+
- uses: BrycensRanch/read-properties-action@v1
26+
id: version
27+
with:
28+
file: gradle.properties
29+
property: mod_version
2630
- name: mc-publish
2731
uses: Kir-Antipov/mc-publish@v3.3.0
2832
with:
@@ -32,9 +36,36 @@ jobs:
3236
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
3337
files-primary: build/libs/!(*-@(javadoc|sources)).jar
3438
version-type: release
35-
loaders: forge
39+
version: ${{ steps.version.outputs.value }}
40+
loaders: |
41+
forge
42+
neoforge
3643
game-versions: 1.20.1
3744
java: 17
3845
name: ""
3946
changelog-file: changelog-1.20.1.*
40-
version: 1.20.1-1.7.5
47+
- name: Nuke Changelog dot txt
48+
uses: DamianReeves/write-file-action@master
49+
with:
50+
path: changelog-1.20.1.txt
51+
write-mode: overwrite
52+
contents: |
53+
CHANGELOG:
54+
- name: Increment version variable
55+
id: bump_version
56+
uses: christian-draeger/increment-semantic-version@1.2.3
57+
with:
58+
current-version: ${{ steps.version.outputs.value }}
59+
version-fragment: 'hotfix'
60+
- name: Replace single file
61+
uses: richardrigutins/replace-in-files@v2
62+
with:
63+
files: 'gradle.properties'
64+
search-text: ${{ steps.version.outputs.value }}
65+
replacement-text: ${{ steps.bump_version.outputs.next-version }}
66+
- name: Commit & Push
67+
uses: Andro999b/push@v1.3
68+
with:
69+
github_token: ${{ secrets.GIT_TOKEN}}
70+
branch: ${{ github.ref }}
71+
force: true
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Bump To Major or Minor
2+
3+
on: [push]
4+
jobs:
5+
bump-to-major-or-minor:
6+
runs-on: ubuntu-latest
7+
if: contains(github.event.head_commit.message, '[MAJOR]')
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 1000
13+
fetch-tags: true
14+
- uses: BrycensRanch/read-properties-action@v1
15+
id: version
16+
with:
17+
file: gradle.properties
18+
property: mod_version
19+
- name: Increment version variable
20+
id: bump_version
21+
uses: christian-draeger/increment-semantic-version@1.2.3
22+
with:
23+
current-version: ${{ steps.version.outputs.value }}
24+
version-fragment: 'feature'
25+
- name: Replace single file
26+
uses: richardrigutins/replace-in-files@v2
27+
with:
28+
files: 'gradle.properties'
29+
search-text: ${{ steps.version.outputs.value }}
30+
replacement-text: ${{ steps.bump_version.outputs.next-version }}
31+
- name: Append changelog file
32+
uses: slegare/write-file-action@1.0.2
33+
with:
34+
path: changelog-1.20.1.txt
35+
write-mode: append
36+
empty-line-eof: true
37+
contents: |
38+
- ${{ github.event.head_commit.message }}
39+
- name: Commit & Push
40+
uses: Andro999b/push@v1.3
41+
with:
42+
github_token: ${{ secrets.GIT_TOKEN}}
43+
branch: ${{ github.ref }}
44+
force: true

src/main/java/tallestegg/bigbrain/BigBrainEvents.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,6 @@ public static void onPlayerRightClick(PlayerInteractEvent.RightClickItem event)
119119
}
120120
}
121121

122-
@SubscribeEvent
123-
public static void entityHitbox(EntityEvent.Size event) {
124-
if (event.getEntity() instanceof Husk husk) {
125-
if (husk.hasPose(Pose.SWIMMING)) {
126-
event.setNewSize(EntityDimensions.scalable(1.0F, 1.5F));
127-
}
128-
}
129-
}
130-
131-
@SubscribeEvent
132-
public static void entityEye(EntityEvent.EyeHeight event) {
133-
if (event.getEntity() instanceof Husk husk) {
134-
if (husk.hasPose(Pose.SWIMMING))
135-
event.setNewEyeHeight(0.5F);
136-
}
137-
}
138-
139122
@SubscribeEvent
140123
public static void onMount(EntityMountEvent event) {
141124
if (event.getEntity() instanceof Player player) {

src/main/java/tallestegg/bigbrain/mixins/HuskMixin.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package tallestegg.bigbrain.mixins;
22

33
import net.minecraft.util.Mth;
4-
import net.minecraft.world.entity.Entity;
5-
import net.minecraft.world.entity.EntityType;
6-
import net.minecraft.world.entity.LivingEntity;
4+
import net.minecraft.world.entity.*;
75
import net.minecraft.world.entity.monster.Husk;
86
import net.minecraft.world.entity.monster.Zombie;
97
import net.minecraft.world.level.Level;
@@ -19,4 +17,21 @@ public HuskMixin(EntityType<? extends Zombie> pEntityType, Level pLevel) {
1917
public boolean canRiderInteract() {
2018
return true;
2119
}
20+
21+
@Override
22+
protected float getStandingEyeHeight(Pose pPose, EntityDimensions pSize) {
23+
if (pPose == Pose.SWIMMING)
24+
return 0.5F;
25+
else
26+
return super.getStandingEyeHeight(pPose, pSize);
27+
}
28+
29+
@Override
30+
public EntityDimensions getDimensions(Pose pPose) {
31+
if (pPose == Pose.SWIMMING) {
32+
return EntityDimensions.scalable(1.0F, 1.5F);
33+
} else {
34+
return super.getDimensions(pPose);
35+
}
36+
}
2237
}

0 commit comments

Comments
 (0)