mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Regenerate patches with relative headers. This should lower conflicts in future PRs.
Convert Forge to use Official mappings. Mojang released their obfuscation mappings but we have not used them up until now due to wanting to get their license to be more explicitly permissive. It is clear that their intent is to allow us to use their names for developing mods like this. See the full wording, and our interpretation here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
This commit is contained in:
1 parent
802298d99d
commit
a95b968c13
832 files changed
+4464
-4373
No files matched your search
@@ -32,7 +32,7 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||
public class AddEntityAttributeTest {
|
||||
public static final boolean ENABLE = true;
|
||||
private static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister.create(Attribute.class, "add_entity_attribute_test");
|
||||
public static final RegistryObject<Attribute> TEST_ATTR = ATTRIBUTES.register("test_attr", () -> new RangedAttribute("forge.test_attr", 1.0D, 0.0D, 1024.0D).setShouldWatch(true));
|
||||
public static final RegistryObject<Attribute> TEST_ATTR = ATTRIBUTES.register("test_attr", () -> new RangedAttribute("forge.test_attr", 1.0D, 0.0D, 1024.0D).setSyncable(true));
|
||||
|
||||
public AddEntityAttributeTest() {
|
||||
if (ENABLE) {
|
||||
|
||||
@@ -52,6 +52,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
||||
@Mod("gravity_attribute_test")
|
||||
public class GravityAttributeTest
|
||||
{
|
||||
@@ -74,18 +76,18 @@ public class GravityAttributeTest
|
||||
@SubscribeEvent
|
||||
public void worldTick(TickEvent.WorldTickEvent event)
|
||||
{
|
||||
if (!event.world.isRemote)
|
||||
if (!event.world.isClientSide)
|
||||
{
|
||||
if (ticks++ > 60)
|
||||
{
|
||||
ticks = 0;
|
||||
World w = event.world;
|
||||
List<LivingEntity> list;
|
||||
if(w.isRemote)
|
||||
if(w.isClientSide)
|
||||
{
|
||||
ClientWorld cw = (ClientWorld)w;
|
||||
list = new ArrayList<>(100);
|
||||
for(Entity e : cw.getAllEntities())
|
||||
for(Entity e : cw.entitiesForRendering())
|
||||
{
|
||||
if(e.isAlive() && e instanceof LivingEntity)
|
||||
list.add((LivingEntity)e);
|
||||
@@ -101,11 +103,11 @@ public class GravityAttributeTest
|
||||
for(LivingEntity liv : list)
|
||||
{
|
||||
ModifiableAttributeInstance grav = liv.getAttribute(ForgeMod.ENTITY_GRAVITY.get());
|
||||
boolean inPlains = liv.world.getBiome(liv.getPosition()).getCategory() == Category.PLAINS;
|
||||
boolean inPlains = liv.level.getBiome(liv.blockPosition()).getBiomeCategory() == Category.PLAINS;
|
||||
if (inPlains && !grav.hasModifier(REDUCED_GRAVITY))
|
||||
{
|
||||
logger.info("Granted low gravity to Entity: {}", liv);
|
||||
grav.applyNonPersistentModifier(REDUCED_GRAVITY);
|
||||
grav.addTransientModifier(REDUCED_GRAVITY);
|
||||
}
|
||||
else if (!inPlains && grav.hasModifier(REDUCED_GRAVITY))
|
||||
{
|
||||
@@ -121,7 +123,7 @@ public class GravityAttributeTest
|
||||
@SubscribeEvent
|
||||
public void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
event.getRegistry().register(new ItemGravityStick(new Item.Properties().group(ItemGroup.TOOLS).rarity(Rarity.RARE)).setRegistryName("gravity_attribute_test:gravity_stick"));
|
||||
event.getRegistry().register(new ItemGravityStick(new Item.Properties().tab(ItemGroup.TAB_TOOLS).rarity(Rarity.RARE)).setRegistryName("gravity_attribute_test:gravity_stick"));
|
||||
}
|
||||
|
||||
public static class ItemGravityStick extends Item
|
||||
@@ -134,10 +136,10 @@ public class GravityAttributeTest
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot)
|
||||
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlotType slot)
|
||||
{
|
||||
@SuppressWarnings("deprecation")
|
||||
Multimap<Attribute, AttributeModifier> multimap = super.getAttributeModifiers(slot);
|
||||
Multimap<Attribute, AttributeModifier> multimap = super.getDefaultAttributeModifiers(slot);
|
||||
if (slot == EquipmentSlotType.MAINHAND)
|
||||
multimap.put(ForgeMod.ENTITY_GRAVITY.get(), new AttributeModifier(GRAVITY_MODIFIER, "More Gravity", 1.0D, Operation.ADDITION));
|
||||
|
||||
|
||||
@@ -48,6 +48,6 @@ public class LivingConversionEventTest
|
||||
public void onLivingConversion(LivingConversionEvent.Post event)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof VillagerEntity)
|
||||
event.getEntityLiving().addPotionEffect(new EffectInstance(Effects.LUCK, 20));
|
||||
event.getEntityLiving().addEffect(new EffectInstance(Effects.LUCK, 20));
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,6 @@ public class PlayerGameModeEventTest
|
||||
public static void onClientPlayerChangeGameModeEvent(ClientPlayerChangeGameModeEvent event)
|
||||
{
|
||||
if (!ENABLE) return;
|
||||
LOGGER.info("Client notified of changed game mode from '{}'. Current GameType: {}. New Game Type: {}", event.getInfo().getGameProfile(), event.getCurrentGameMode(), event.getNewGameMode());
|
||||
LOGGER.info("Client notified of changed game mode from '{}'. Current GameType: {}. New Game Type: {}", event.getInfo().getProfile(), event.getCurrentGameMode(), event.getNewGameMode());
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class PlayerXpEventTest
|
||||
public static void onPlayerPickupXp(PlayerXpEvent.PickupXp event)
|
||||
{
|
||||
if (!ENABLE) return;
|
||||
logger.info("{} picked up an experience orb worth {}", event.getPlayer().getName().getString(), event.getOrb().getXpValue());
|
||||
logger.info("{} picked up an experience orb worth {}", event.getPlayer().getName().getString(), event.getOrb().getValue());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
Reference in new issue
Block a user