Skip to content

Commit f5f8dd7

Browse files
committed
chore(git): merge upstream changes
Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
2 parents 898bd33 + 6159890 commit f5f8dd7

29 files changed

Lines changed: 979 additions & 24 deletions

forge/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22
import net.minecraftforge.gradle.common.util.RunConfig
3-
import org.gradle.api.tasks.JavaExec
43
import org.gradle.internal.DefaultTaskExecutionRequest
54
import org.spongepowered.gradle.impl.AWToAT
65
import org.spongepowered.gradle.impl.IdeHelper
@@ -432,6 +431,7 @@ tasks {
432431
test {
433432
useJUnitPlatform()
434433

434+
maxHeapSize = "4G"
435435
testClassesDirs = commonTest.get().output.classesDirs + testSources.get().output.classesDirs
436436

437437
val runServer = minecraft.runs.getByName("server")

neoforge/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22
import net.neoforged.moddevgradle.internal.RunGameTask
3-
import org.gradle.api.tasks.JavaExec
43
import org.spongepowered.gradle.impl.AWToAT
54

65
buildscript {
@@ -405,6 +404,7 @@ tasks {
405404
test {
406405
useJUnitPlatform()
407406

407+
maxHeapSize = "4G"
408408
testClassesDirs = commonTest.get().output.classesDirs + testSources.get().output.classesDirs
409409

410410
jvmArgs(runServer.get().jvmArgs)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file is part of Sponge, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package org.spongepowered.common.accessor.world.level.storage;
26+
27+
import net.minecraft.nbt.CompoundTag;
28+
import net.minecraft.world.level.storage.TagValueInput;
29+
import org.spongepowered.asm.mixin.Final;
30+
import org.spongepowered.asm.mixin.Mixin;
31+
import org.spongepowered.asm.mixin.gen.Accessor;
32+
33+
@Mixin(TagValueInput.class)
34+
public interface TagValueInputAccessor {
35+
36+
@Accessor("input") @Final CompoundTag accessor$input();
37+
}

src/accessors/resources/mixins.sponge.accessors.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
"world.level.saveddata.maps.MapItemSavedDataAccessor",
219219
"world.level.storage.PlayerDataStorageAccessor",
220220
"world.level.storage.PrimaryLevelDataAccessor",
221+
"world.level.storage.TagValueInputAccessor",
221222
"world.phys.AABBAccessor",
222223
"world.scores.PlayerTeamAccessor",
223224
"world.scores.ScoreboardAccessor",

src/main/java/org/spongepowered/common/bridge/world/inventory/InventoryMenuBridge.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
*/
2525
package org.spongepowered.common.bridge.world.inventory;
2626

27-
public interface InventoryMenuBridge {
27+
import org.spongepowered.common.bridge.world.inventory.container.ContainerBridge;
28+
29+
public interface InventoryMenuBridge extends ContainerBridge {
2830

2931
void bridge$markClean();
3032
}

src/main/java/org/spongepowered/common/data/SpongeDataManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.spongepowered.api.block.BlockSnapshot;
3636
import org.spongepowered.api.block.BlockState;
3737
import org.spongepowered.api.block.entity.BlockEntityArchetype;
38+
import org.spongepowered.api.block.entity.BlockEntityType;
3839
import org.spongepowered.api.data.DataHolder;
3940
import org.spongepowered.api.data.DataHolderBuilder;
4041
import org.spongepowered.api.data.DataManager;
@@ -434,6 +435,7 @@ public <T> Optional<RegistryType<T>> findRegistryTypeFor(Class type) {
434435
this.registryTypeMap.put(ParticleType.class, RegistryTypes.PARTICLE_TYPE);
435436
this.registryTypeMap.put(ParticleOption.class, RegistryTypes.PARTICLE_OPTION);
436437
this.registryTypeMap.put(PotionEffectType.class, RegistryTypes.POTION_EFFECT_TYPE);
438+
this.registryTypeMap.put(BlockEntityType.class, RegistryTypes.BLOCK_ENTITY_TYPE);
437439
// TODO add all RegistryTypes that we have global registries for
438440
// there needs to be a better way to do this
439441
}

src/main/java/org/spongepowered/common/data/provider/item/stack/ItemStackData.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import net.minecraft.world.item.component.ItemLore;
4848
import net.minecraft.world.item.component.UseCooldown;
4949
import net.minecraft.world.item.component.UseRemainder;
50+
import net.minecraft.world.item.component.Weapon;
5051
import net.minecraft.world.item.consume_effects.ConsumeEffect;
5152
import org.checkerframework.checker.nullness.qual.Nullable;
5253
import org.spongepowered.api.Platform;
@@ -65,6 +66,7 @@
6566
import org.spongepowered.common.adventure.SpongeAdventure;
6667
import org.spongepowered.common.data.provider.DataProviderRegistrator;
6768
import org.spongepowered.common.item.util.ItemStackUtil;
69+
import org.spongepowered.common.util.Constants;
6870

6971
import java.util.List;
7072
import java.util.Optional;
@@ -370,6 +372,57 @@ public static void register(final DataProviderRegistrator registrator) {
370372
.get(h -> (ResourceKey) (Object) h.get(DataComponents.TOOLTIP_STYLE))
371373
.set((h, v) -> h.set(DataComponents.TOOLTIP_STYLE, (ResourceLocation) (Object) v))
372374
.delete(h -> h.remove(DataComponents.TOOLTIP_STYLE))
375+
.create(Keys.WEAPON_DAMAGE_PER_ATTACK)
376+
.get(h -> {
377+
final @Nullable Weapon weapon = h.get(DataComponents.WEAPON);
378+
if (weapon == null) {
379+
return null;
380+
}
381+
return weapon.itemDamagePerAttack();
382+
})
383+
.set((h, v) -> {
384+
final @Nullable Weapon weapon = h.get(DataComponents.WEAPON);
385+
h.set(DataComponents.WEAPON, new Weapon(v, weapon == null ? 0 : weapon.disableBlockingForSeconds()));
386+
})
387+
.delete(h -> {
388+
final @Nullable Weapon weapon = h.get(DataComponents.WEAPON);
389+
if (weapon == null) {
390+
return;
391+
}
392+
if (weapon.disableBlockingForSeconds() == 0) {
393+
h.remove(DataComponents.WEAPON);
394+
} else {
395+
h.set(DataComponents.WEAPON, new Weapon(0, weapon.disableBlockingForSeconds()));
396+
}
397+
})
398+
.create(Keys.DISABLE_SHIELD_TICKS)
399+
.get(h -> {
400+
final @Nullable Weapon weapon = h.get(DataComponents.WEAPON);
401+
if (weapon == null) {
402+
return null;
403+
}
404+
return Ticks.of(Math.round(
405+
Constants.TickConversions.TICKS_PER_SECOND * weapon.disableBlockingForSeconds()
406+
));
407+
})
408+
.set((h, v) -> {
409+
final @Nullable Weapon weapon = h.get(DataComponents.WEAPON);
410+
h.set(DataComponents.WEAPON, new Weapon(
411+
weapon == null ? 0 : weapon.itemDamagePerAttack(),
412+
v.ticks() / (float) Constants.TickConversions.TICKS_PER_SECOND
413+
));
414+
})
415+
.delete(h -> {
416+
final @Nullable Weapon weapon = h.get(DataComponents.WEAPON);
417+
if (weapon == null) {
418+
return;
419+
}
420+
if (weapon.itemDamagePerAttack() == 0) {
421+
h.remove(DataComponents.WEAPON);
422+
} else {
423+
h.set(DataComponents.WEAPON, new Weapon(weapon.itemDamagePerAttack()));
424+
}
425+
})
373426
;
374427
}
375428
// @formatter:on

0 commit comments

Comments
 (0)