Skip to content

Commit

Permalink
Merge branch 'PlantTypeRefactor' of https://github.com/TelepathicGrun…
Browse files Browse the repository at this point in the history
…t/NeoForge into PlantTypeRefactor
  • Loading branch information
TelepathicGrunt committed Jun 26, 2024
2 parents 5e38735 + 4c51e95 commit 0a7b1d1
Show file tree
Hide file tree
Showing 39 changed files with 1,162 additions and 401 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,31 @@ jobs:
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}

- name: Validate wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'

- name: Setup with Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: setup
cache-read-only: false

- name: Setup with Gradle
run: ./gradlew setup

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: assemble checkFormatting
cache-read-only: false
run: ./gradlew assemble checkFormatting

- name: Run JCC
run: ./gradlew checkJarCompatibility

- name: Upload JCC
uses: neoforged/action-jar-compatibility/upload@v1

- name: Publish artifacts
uses: neoforged/action-pr-publishing/upload@v1
48 changes: 48 additions & 0 deletions .github/workflows/check-local-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check PR local changes

on:
pull_request:
types:
- synchronize
- opened
- ready_for_review
- reopened

jobs:
check-local-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true

# GradleUtils will append the branch name to the version,
# but for that we need a properly checked out branch
- name: Create branch for commit
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}

- name: Setup JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false

- name: Setup with Gradle
run: ./gradlew setup

- name: Run datagen with Gradle
run: ./gradlew :neoforge:runData :tests:runData

- name: Check no local changes are present
run: |
# Print status for easier debugging
git status
if [ -n "$(git status --porcelain)" ]; then exit 1; fi
20 changes: 20 additions & 0 deletions .github/workflows/publish-jcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/a65628b0c89dec60b357ce3f8f6bfa62934b8357/src/actionsTemplate/resources/.github/workflows/publish-jcc.yml

name: Publish PR JCC output

on:
workflow_run:
workflows: [Build PRs]
types:
- completed

jobs:
publish-jcc:
if: true
uses: neoforged/actions/.github/workflows/publish-jcc.yml@main
with:
beta_version_pattern: .*-beta.*
secrets:
JCC_GH_APP_ID: ${{ secrets.JCC_GH_APP_ID }}
JCC_GH_APP_KEY: ${{ secrets.JCC_GH_APP_KEY }}
18 changes: 7 additions & 11 deletions .github/workflows/test-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Setup with Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: setup
cache-read-only: false

- name: Setup with Gradle
run: ./gradlew setup

- name: Run game tests with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: :tests:runGameTestServer
cache-read-only: false
run: ./gradlew :tests:runGameTestServer

- name: Run JUnit tests with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: :tests:runUnitTests
cache-read-only: false
run: ./gradlew :tests:runUnitTests

- name: Store reports
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import java.util.regex.Matcher
import java.util.regex.Pattern

plugins {
id 'net.neoforged.gradleutils' version '3.0.0-alpha.10' apply false
id 'net.neoforged.gradleutils' version '3.0.0-alpha.13' apply false
id 'com.diffplug.spotless' version '6.22.0' apply false
id 'net.neoforged.licenser' version '0.7.2'
id 'neoforge.formatting-conventions'
Expand Down
2 changes: 1 addition & 1 deletion patches/net/minecraft/client/KeyboardHandler.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
);
return;
}
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof KeyBindsScreen)
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof KeyBindsScreen && net.neoforged.neoforge.client.settings.KeyModifier.getActiveModifier() != net.neoforged.neoforge.client.settings.KeyModifier.NONE)
+ ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers.
}

Expand Down
8 changes: 0 additions & 8 deletions patches/net/minecraft/client/player/LocalPlayer.java.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -161,6 +_,7 @@

@Override
public boolean hurt(DamageSource p_108662_, float p_108663_) {
+ net.neoforged.neoforge.common.CommonHooks.onPlayerAttack(this, p_108662_, p_108663_);
return false;
}

@@ -297,6 +_,7 @@
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
Expand Down
10 changes: 0 additions & 10 deletions patches/net/minecraft/client/player/RemotePlayer.java.patch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,28 @@
this.thirdPersonLeftHand = p_111798_;
this.thirdPersonRightHand = p_111799_;
this.firstPersonLeftHand = p_111800_;
@@ -64,6 +_,7 @@
@@ -64,9 +_,21 @@
this.gui = p_111803_;
this.ground = p_111804_;
this.fixed = p_111805_;
+ this.moddedTransforms = moddedTransforms;
}

public ItemTransform getTransform(ItemDisplayContext p_270619_) {
+ if (p_270619_.isModded()) {
+ ItemTransform moddedTransform = moddedTransforms.get(p_270619_);
+ if (moddedTransform != null) {
+ return moddedTransform;
+ }
+ ItemDisplayContext moddedFallback = p_270619_.fallback();
+ if (moddedFallback == null) {
+ return ItemTransform.NO_TRANSFORM;
+ }
+ p_270619_ = moddedFallback;
+ }
return switch (p_270619_) {
case THIRD_PERSON_LEFT_HAND -> this.thirdPersonLeftHand;
case THIRD_PERSON_RIGHT_HAND -> this.thirdPersonRightHand;
@@ -104,9 +_,23 @@
ItemTransform itemtransform5 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.GUI);
ItemTransform itemtransform6 = this.getTransform(p_111822_, jsonobject, ItemDisplayContext.GROUND);
Expand Down
30 changes: 17 additions & 13 deletions patches/net/minecraft/world/entity/Entity.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
this.defineSynchedData(synchedentitydata$builder);
this.entityData = synchedentitydata$builder.build();
this.setPos(0.0, 0.0, 0.0);
- this.eyeHeight = this.dimensions.eyeHeight();
+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, Pose.STANDING, this.dimensions, this.dimensions.eyeHeight());
+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, Pose.STANDING, this.dimensions);
+ this.dimensions = sizeEvent.getNewSize();
+ this.eyeHeight = sizeEvent.getNewEyeHeight();
this.eyeHeight = this.dimensions.eyeHeight();
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.EntityEvent.EntityConstructing(this));
}

Expand Down Expand Up @@ -292,6 +291,19 @@
}

public boolean is(Entity p_20356_) {
@@ -2516,10 +_,11 @@
}

public boolean isInvulnerableTo(DamageSource p_20122_) {
- return this.isRemoved()
+ boolean isVanillaInvulnerable = this.isRemoved()
|| this.invulnerable && !p_20122_.is(DamageTypeTags.BYPASSES_INVULNERABILITY) && !p_20122_.isCreativePlayer()
|| p_20122_.is(DamageTypeTags.IS_FIRE) && this.fireImmune()
|| p_20122_.is(DamageTypeTags.IS_FALL) && this.getType().is(EntityTypeTags.FALL_DAMAGE_IMMUNE);
+ return net.neoforged.neoforge.common.CommonHooks.isEntityInvulnerableTo(this, p_20122_, isVanillaInvulnerable);
}

public boolean isInvulnerable() {
@@ -2544,6 +_,7 @@

@Nullable
Expand All @@ -312,7 +324,7 @@
EntityDimensions entitydimensions = this.dimensions;
Pose pose = this.getPose();
EntityDimensions entitydimensions1 = this.getDimensions(pose);
+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, pose, entitydimensions, entitydimensions1, entitydimensions1.eyeHeight()); // Porting 1.20.5 check if this still works
+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, pose, entitydimensions, entitydimensions1);
+ entitydimensions1 = sizeEvent.getNewSize();
this.dimensions = entitydimensions1;
this.eyeHeight = entitydimensions1.eyeHeight();
Expand Down Expand Up @@ -440,7 +452,7 @@
}

public void checkDespawn() {
@@ -3450,6 +_,117 @@
@@ -3450,6 +_,109 @@
public boolean mayInteract(Level p_146843_, BlockPos p_146844_) {
return true;
}
Expand Down Expand Up @@ -495,14 +507,6 @@
+ this.unsetRemoved();
+ }
+
+ // no AT because of overrides
+ /**
+ * Accessor method for {@link #getEyeHeight(Pose)}
+ */
+ public float getEyeHeightAccess(Pose pose) {
+ return this.getEyeHeight(pose);
+ }
+
+ protected Object2DoubleMap<net.neoforged.neoforge.fluids.FluidType> forgeFluidTypeHeight = new Object2DoubleArrayMap<>(net.neoforged.neoforge.fluids.FluidType.SIZE.get());
+ private net.neoforged.neoforge.fluids.FluidType forgeFluidTypeOnEyes = net.neoforged.neoforge.common.NeoForgeMod.EMPTY_TYPE.value();
+ protected final void setFluidTypeHeight(net.neoforged.neoforge.fluids.FluidType type, double height) {
Expand Down
Loading

0 comments on commit 0a7b1d1

Please sign in to comment.