mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Remove dead test classes.
This commit is contained in:
1 parent
f24991f3bb
commit
0c0603dc91
133 files changed
-15903
No files matched your search
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLServerStartingEvent;
|
||||
|
||||
//@Mod(modid = "entityupdateblockedtest", name = "Entity Update Blocked Test", version = "1.0.0", acceptableRemoteVersions = "*")
|
||||
public class BlockEntityUpdateTest
|
||||
{
|
||||
@Mod.EventHandler
|
||||
public void init(FMLServerStartingEvent event)
|
||||
{
|
||||
event.registerServerCommand(new BlockEntityUpdateCommand());
|
||||
}
|
||||
|
||||
private class BlockEntityUpdateCommand extends CommandBase
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "blockEntityUpdate";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(ICommandSender sender)
|
||||
{
|
||||
return "blockEntityUpdate <value>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
boolean value = Boolean.parseBoolean(args[0]);
|
||||
for (Entity ent : sender.getEntityWorld().loadedEntityList)
|
||||
{
|
||||
if (!(ent instanceof EntityPlayer))
|
||||
{
|
||||
ent.updateBlocked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityTravelToDimensionEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = "entitytraveltodimensioneventtest", name = "EntityTravelToDimensionEventTest", version = "0.0.0", acceptableRemoteVersions = "*")
|
||||
public class EntityTravelToDimensionEventTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
private static Logger logger;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDimensionTravel(EntityTravelToDimensionEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
logger.info("Travelling to Dimension {} Entity: {}", event.getDimension(), event.getEntity());
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.world.GetCollisionBoxesEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
//@Mod(modid = GetCollisionBoxesEventTest.MODID, name = "CollisionBoxesEventTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
public class GetCollisionBoxesEventTest
|
||||
{
|
||||
public static final String MODID = "collisionboxexeventtest";
|
||||
|
||||
public static final boolean ENABLED = true;
|
||||
@GameRegistry.ObjectHolder("box_block")
|
||||
private static final Block BOX_BLOCK = null;
|
||||
private static final ArrayList<BlockPos> locations = new ArrayList<>();
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void registerBlock(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
event.getRegistry().register(new BoxBlock());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItem(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
event.getRegistry().register(new ItemBlock(BOX_BLOCK).setRegistryName(new ResourceLocation(MODID, "box_block")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void getBoxes(GetCollisionBoxesEvent event)
|
||||
{
|
||||
AxisAlignedBB box = event.getAabb();
|
||||
|
||||
for (BlockPos pos: locations)
|
||||
{
|
||||
for (EnumFacing facing: EnumFacing.HORIZONTALS)
|
||||
{
|
||||
AxisAlignedBB temp = new AxisAlignedBB(pos).offset(new Vec3d(facing.getDirectionVec()));
|
||||
if (box.intersects(temp))
|
||||
event.getCollisionBoxesList().add(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class BoxBlock extends Block
|
||||
{
|
||||
|
||||
public BoxBlock()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
setRegistryName(new ResourceLocation(MODID, "box_block"));
|
||||
setCreativeTab(CreativeTabs.MISC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
locations.remove(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
locations.add(pos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "CollisionBoxes event test block";
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = "projectile_event_test", name = "ProjectileImpactEvent test mod", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class ProjectileImpactEventTest
|
||||
{
|
||||
private static final boolean ENABLED = false;
|
||||
private static Logger logger;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(ProjectileImpactEventTest.class);
|
||||
}
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void onProjectileImpact(ProjectileImpactEvent event)
|
||||
{
|
||||
logger.info("projectile: {}, impact: {}", event.getEntity().getName(), event.getRayTraceResult());
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraftforge.event.entity.living.AnimalTameEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = AnimalTameEventTest.MOD_ID, name = "AnimalTameEvent test mod", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
public class AnimalTameEventTest
|
||||
{
|
||||
static final String MOD_ID = "animal_tame_event_test";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onAnimalTame(AnimalTameEvent event)
|
||||
{
|
||||
if (!ENABLED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAnimal() instanceof EntityWolf)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = AttackEventTest.MODID, name = AttackEventTest.NAME, version = "1.0.0", acceptableRemoteVersions = "*")
|
||||
public class AttackEventTest
|
||||
{
|
||||
|
||||
public static final String MODID = "livingattackeventtest";
|
||||
public static final String NAME = "LivingAttackEventTest";
|
||||
private static final Logger LOGGER = LogManager.getLogger(NAME);
|
||||
|
||||
//@EventBusSubscriber
|
||||
public static class LivingAttackEventHandler
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLivingAttack(LivingAttackEvent event)
|
||||
{
|
||||
if (event.getSource() == DamageSource.ANVIL)
|
||||
{
|
||||
LOGGER.info("{} was hit by an anvil!", event.getEntityLiving().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = BabyEntitySpawnEventTest.MODID, name = "BreedingTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class BabyEntitySpawnEventTest
|
||||
{
|
||||
public static final String MODID = "breedingtest";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBabyBorn(BabyEntitySpawnEvent event)
|
||||
{
|
||||
event.setChild(new EntityCow(event.getParentA().world));
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = CheckSpawnEventTest.MODID, name = "CheckSpawnTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class CheckSpawnEventTest
|
||||
{
|
||||
public static final String MODID = "checkspawntest";
|
||||
public static final boolean ENABLED = false;
|
||||
|
||||
@EventHandler
|
||||
public void onPreInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void canMobSpawn(CheckSpawn event)
|
||||
{
|
||||
event.setResult(Result.DENY);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntitySpawnPlacementRegistry;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
|
||||
//@Mod(modid = CustomSpawnPlacementTest.MOD_ID, name = "Custom SpawnPlacementType test mod", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class CustomSpawnPlacementTest
|
||||
{
|
||||
static final String MOD_ID = "custom_spawn_placement_test";
|
||||
static final boolean ENABLED = false;
|
||||
static final EntityLiving.SpawnPlacementType CUSTOM = EnumHelper.addSpawnPlacementType("CUSTOM", (world, pos) -> world.getBlockState(pos.down()).getMaterial() == Material.ICE);
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
// needs edit to EntitySpawnPlacementRegistry to work
|
||||
EntitySpawnPlacementRegistry.setPlacementType(EntityStray.class, CUSTOM);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.event.entity.living.LivingDamageEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = DamageEventTest.MODID, name = "ForgeDebugLivingDamage", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class DamageEventTest
|
||||
{
|
||||
|
||||
private static Logger logger;
|
||||
|
||||
public static final String MODID = "forgedebuglivingdamage";
|
||||
|
||||
private static final Map<String, DamageSource> DAMAGE_SOURCES = ImmutableMap.<String, DamageSource> builder()
|
||||
.put("fire", DamageSource.IN_FIRE)
|
||||
.put("lightning_bolt", DamageSource.LIGHTNING_BOLT)
|
||||
.put("on_fire", DamageSource.ON_FIRE)
|
||||
.put("lava", DamageSource.LAVA)
|
||||
.put("hot_floor", DamageSource.HOT_FLOOR)
|
||||
.put("in_wall", DamageSource.IN_WALL)
|
||||
.put("cramming", DamageSource.CRAMMING)
|
||||
.put("drown", DamageSource.DROWN)
|
||||
.put("starve", DamageSource.STARVE)
|
||||
.put("cactus", DamageSource.CACTUS)
|
||||
.put("fall", DamageSource.FALL)
|
||||
.put("fly_into_wall", DamageSource.FLY_INTO_WALL)
|
||||
.put("out_of_world", DamageSource.OUT_OF_WORLD)
|
||||
.put("generic", DamageSource.GENERIC)
|
||||
.put("magic", DamageSource.MAGIC)
|
||||
.put("wither", DamageSource.WITHER)
|
||||
.put("anvil", DamageSource.ANVIL)
|
||||
.put("falling_block", DamageSource.FALLING_BLOCK)
|
||||
.put("dragon_breath", DamageSource.DRAGON_BREATH)
|
||||
.put("fireworks", DamageSource.FIREWORKS)
|
||||
.build();
|
||||
|
||||
private static class CommandDamage extends CommandBase
|
||||
{
|
||||
|
||||
private static final String USAGE = "damage <selector> <source> <amount>";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "damage";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(ICommandSender sender)
|
||||
{
|
||||
return USAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
throw new WrongUsageException(USAGE);
|
||||
}
|
||||
|
||||
EntityLivingBase target = getEntity(server, sender, args[0], EntityLivingBase.class);
|
||||
DamageSource damageSource = DAMAGE_SOURCES.get(args[1].toLowerCase(Locale.ROOT));
|
||||
if (target == null || damageSource == null)
|
||||
{
|
||||
throw new WrongUsageException(USAGE);
|
||||
}
|
||||
|
||||
float amount;
|
||||
try
|
||||
{
|
||||
amount = Float.parseFloat(args[2]);
|
||||
} catch (NumberFormatException e)
|
||||
{
|
||||
throw new WrongUsageException(USAGE);
|
||||
}
|
||||
|
||||
target.attackEntityFrom(damageSource, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames());
|
||||
} else if (args.length == 2)
|
||||
{
|
||||
return getListOfStringsMatchingLastWord(args, DAMAGE_SOURCES.keySet());
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsernameIndex(String[] args, int index)
|
||||
{
|
||||
return index == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void serverStarting(FMLServerStartingEvent evt)
|
||||
{
|
||||
evt.registerServerCommand(new CommandDamage());
|
||||
}
|
||||
|
||||
//@EventBusSubscriber
|
||||
public static class TestEventHandler
|
||||
{
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void livingHurtPre(LivingHurtEvent evt)
|
||||
{
|
||||
logger.info("Entity {} damage from {} (pre-reduction): {}", evt.getEntity(), evt.getSource().getDamageType(), evt.getAmount());
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void livingHurtPost(LivingDamageEvent evt)
|
||||
{
|
||||
logger.info("Entity {} damage from {} (post-reduction): {}", evt.getEntity(), evt.getSource().getDamageType(), evt.getAmount());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = "equipment_change_test", name = "Equipment Change Test", version = "1.0.0", acceptableRemoteVersions = "*")
|
||||
public class EquipmentChangeEventTest
|
||||
{
|
||||
private static final boolean ENABLED = false;
|
||||
private static Logger logger;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* the Method handling the {@link LivingEquipmentChangeEvent}
|
||||
* Serverside only!
|
||||
*//*
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEquipmentChange(LivingEquipmentChangeEvent event)
|
||||
{
|
||||
//a debug console print
|
||||
logger.info("[Equipment-Change] {} changed their Equipment in {} from {} to {}", event.getEntity(), event.getSlot(), event.getFrom(), event.getTo());
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraftforge.event.entity.living.LivingKnockBackEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = "kbhtest", name = "Knock Back Hook Test", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
public class KnockBackEventTest
|
||||
{
|
||||
private static final boolean ENABLED = false;
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void onKnockBack(LivingKnockBackEvent event)
|
||||
{
|
||||
if(ENABLED)
|
||||
{
|
||||
if(event.getEntityLiving() instanceof EntitySheep)
|
||||
{
|
||||
event.setStrength(0.2F);
|
||||
}
|
||||
else if(event.getEntityLiving() instanceof EntityCow)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraftforge.event.entity.EntityMobGriefingEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
|
||||
//@Mod(modid = "entitymobgriefingeventtest", name = "EntityMobGriefingEventTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
public class MobGriefingEventTest
|
||||
{
|
||||
private static final boolean ENABLED = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMobGriefing(EntityMobGriefingEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
String customName = event.getEntity().getCustomNameTag();
|
||||
|
||||
try
|
||||
{
|
||||
Result result = Result.valueOf(customName);
|
||||
event.setResult(result);
|
||||
}
|
||||
catch (IllegalArgumentException iae)
|
||||
{
|
||||
// Thrown if the name tag did not match a result value, can be ignored and DEFAULT will still be used.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = SpecialSpawnTest.MOD_ID, name = "Special Spawn Test", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber(modid = SpecialSpawnTest.MOD_ID)
|
||||
public class SpecialSpawnTest
|
||||
{
|
||||
static final String MOD_ID = "special_spawn_test";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onSpecialSpawn(LivingSpawnEvent.SpecialSpawn event)
|
||||
{
|
||||
if (!ENABLED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getEntity() instanceof EntityPigZombie)
|
||||
{
|
||||
event.getEntity().setCustomNameTag("Called SpecialSpawn");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerCareer;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
||||
|
||||
//@Mod(modid = "professiontest", name = "ProfessionTest2000", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@EventBusSubscriber
|
||||
public class VillagerProfessionTest
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerVillagers(RegistryEvent.Register<VillagerProfession> event)
|
||||
{
|
||||
VillagerProfession profession = new VillagerProfession("professiontest:test_villager", "professiontest:textures/entity/test_villager.png", "professiontest:textures/entity/zombie_test_villager.png");
|
||||
new VillagerCareer(profession, "professiontest:test_villager");
|
||||
event.getRegistry().register(profession);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package net.minecraftforge.debug.entity.living;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.CriticalHitEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
||||
//@Mod(modid = "criticalhiteventtest", name = "CriticalHitEventTest", version = "1.0.0", acceptableRemoteVersions = "*")
|
||||
public class CriticalHitEventTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
private Logger log;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
log = event.getModLog();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCriticalHit(CriticalHitEvent event)
|
||||
{
|
||||
ItemStack itemstack = event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND);
|
||||
|
||||
if(event.getDamageModifier()>1F)
|
||||
{
|
||||
log.info("By default this hit will be critical.");
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info("By default this hit won't be critical.");
|
||||
}
|
||||
|
||||
if (itemstack.getItem() instanceof ItemSword)
|
||||
{
|
||||
event.setResult(Result.ALLOW); //Every hit is Critical
|
||||
log.info("This hit will be critical.");
|
||||
}
|
||||
else if (!itemstack.isEmpty())
|
||||
{
|
||||
event.setResult(Result.DENY);//No hit will be Critical
|
||||
log.info("This hit wont be critical.");
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setResult(Result.DEFAULT); //Vanilla Hits
|
||||
}
|
||||
|
||||
log.info("{} got hit by {} with a damagemodifier of {}" , event.getTarget(), event.getEntityPlayer(), event.getDamageModifier());
|
||||
event.setDamageModifier(2.0F);
|
||||
log.info("The damagemodifier is changed to {}", event.getDamageModifier());
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = "playerdamagereworktest", name = "PlayerDamageReworkTest", version = "0.0.0", acceptableRemoteVersions = "*")
|
||||
public class DamageReworkTest
|
||||
{
|
||||
private static final boolean ENABLE = false;
|
||||
private static final UUID ARMOR_MODIFIER_UUID = UUID.fromString("23373DC8-1F3D-11E7-93AE-92361F002671");
|
||||
private static final AttributeModifier mod = new AttributeModifier(ARMOR_MODIFIER_UUID, "Player Damage Rework Test", 20, 0);
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
if (ENABLE) MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public void checkForSneakEvent(LivingUpdateEvent event)
|
||||
{
|
||||
if (event.getEntityLiving() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (!player.getEntityAttribute(SharedMonsterAttributes.ARMOR).hasModifier(mod))
|
||||
{
|
||||
player.getEntityAttribute(SharedMonsterAttributes.ARMOR).applyModifier(mod);
|
||||
}
|
||||
}
|
||||
else if (player.getEntityAttribute(SharedMonsterAttributes.ARMOR).hasModifier(mod))
|
||||
{
|
||||
player.getEntityAttribute(SharedMonsterAttributes.ARMOR).removeModifier(ARMOR_MODIFIER_UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
|
||||
//@Mod(modid = ItemPickupEventTest.MODID, name = ItemPickupEventTest.NAME, version = ItemPickupEventTest.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ItemPickupEventTest
|
||||
{
|
||||
|
||||
private static final boolean ENABLED = true;
|
||||
public static final String MODID = "playeritempickupeventdebug";
|
||||
public static final String NAME = "Player.ItemPickup Event Debug";
|
||||
public static final String VERSION = "1.0.0";
|
||||
private static Logger logger;
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLPreInitializationEvent event)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void itemPickupEvent(PlayerEvent.ItemPickupEvent event)
|
||||
{
|
||||
logger.info("Item picked up: " + event.getStack().getDisplayName() + "x" + event.getStack().getCount());
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,254 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.tileentity.TileEntityDropper;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = "playerinteracteventtest", name = "PlayerInteractEventTest", version = "0.0.0", acceptableRemoteVersions = "*")
|
||||
public class PlayerInteractEventTest
|
||||
{
|
||||
// NOTE: Test with both this ON and OFF - ensure none of the test behaviours show when this is off!
|
||||
private static final boolean ENABLE = false;
|
||||
private static Logger logger;
|
||||
|
||||
@EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(PlayerInteractEventTest.class); // Test Static event listeners
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent(receiveCanceled = true) // this triggers after the subclasses below, and we'd like to log them all
|
||||
public void global(PlayerInteractEvent evt)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger.info("{} | {}", evt.getClass().getSimpleName(), evt.getSide().name());
|
||||
logger.info("{} | stack: {}", evt.getHand(), evt.getItemStack());
|
||||
logger.info("{} | face: {}", evt.getPos(), evt.getFace());
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public void leftClickBlock(PlayerInteractEvent.LeftClickBlock evt)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger.info("HIT VEC: {}", evt.getHitVec());
|
||||
|
||||
if (!evt.getItemStack().isEmpty())
|
||||
{
|
||||
if (evt.getItemStack().getItem() == Items.GOLDEN_PICKAXE)
|
||||
{
|
||||
evt.setCanceled(true); // Redstone should not activate and pick should not be able to dig anything
|
||||
}
|
||||
if (evt.getItemStack().getItem() == Items.DIAMOND_PICKAXE)
|
||||
{
|
||||
evt.setUseBlock(net.minecraftforge.eventbus.api.Event.Result.DENY); // Redstone should not activate, pick should still dig
|
||||
}
|
||||
if (evt.getItemStack().getItem() == Items.IRON_PICKAXE)
|
||||
{
|
||||
evt.setUseItem(Event.Result.DENY); // Pick should not dig, Redstone should still activate
|
||||
}
|
||||
}
|
||||
|
||||
// When item use denied, the event will keep firing as long as the left click button is held.
|
||||
// This is due to how vanilla calls the left click handling methods to let people not lift their button when mining multiple blocks.
|
||||
// Note that when item use is denied, the cool down for the item does not occur. This is good!
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void rightClickBlock(PlayerInteractEvent.RightClickBlock evt)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger.info("HIT VEC: {}", evt.getHitVec());
|
||||
|
||||
// Shift right clicking dropper with an item in hand should still open the dropper contrary to normal mechanics
|
||||
// The item in hand is used as well (not specifying anything would not use the item)
|
||||
TileEntity te = evt.getWorld().getTileEntity(evt.getPos());
|
||||
if (te instanceof TileEntityDropper)
|
||||
{
|
||||
evt.setUseBlock(net.minecraftforge.eventbus.api.Event.Result.ALLOW);
|
||||
evt.setUseItem(Event.Result.ALLOW);
|
||||
}
|
||||
|
||||
// Same as above, except the item should no longer be used
|
||||
if (te instanceof TileEntityChest)
|
||||
{
|
||||
evt.setUseBlock(net.minecraftforge.eventbus.api.Event.Result.ALLOW);
|
||||
evt.setUseItem(net.minecraftforge.eventbus.api.Event.Result.DENY); // could be left out as well
|
||||
}
|
||||
|
||||
// Case: Flint and steel in main hand on top of a TE will light a fire, not open the TE.
|
||||
// Note that if you do this on a chest, the f+s will fail, but then your off hand will open the chest
|
||||
// If you dual wield flints and steels and right click a chest nothing should happen
|
||||
if (!evt.getItemStack().isEmpty() && evt.getItemStack().getItem() == Items.FLINT_AND_STEEL)
|
||||
{
|
||||
evt.setUseBlock(net.minecraftforge.eventbus.api.Event.Result.DENY);
|
||||
}
|
||||
|
||||
// Case: Painting in main hand
|
||||
// Opening a TE will also place a painting on the TE if possible
|
||||
if (evt.getHand() == EnumHand.MAIN_HAND && !evt.getItemStack().isEmpty() && evt.getItemStack().getItem() == Items.PAINTING)
|
||||
{
|
||||
evt.setUseItem(net.minecraftforge.eventbus.api.Event.Result.ALLOW);
|
||||
}
|
||||
|
||||
// Spawn egg in main hand, block in offhand -> block should be placed
|
||||
if (!evt.getItemStack().isEmpty()
|
||||
&& evt.getItemStack().getItem() == Items.SPAWN_EGG
|
||||
&& evt.getHand() == EnumHand.MAIN_HAND
|
||||
&& !evt.getEntityPlayer().getHeldItemOffhand().isEmpty()
|
||||
&& evt.getEntityPlayer().getHeldItemOffhand().getItem() instanceof ItemBlock)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
}
|
||||
|
||||
// Spawn egg in main hand, potion in offhand -> potion should NOT be thrown
|
||||
if (!evt.getItemStack().isEmpty()
|
||||
&& evt.getItemStack().getItem() == Items.SPAWN_EGG
|
||||
&& evt.getHand() == EnumHand.MAIN_HAND
|
||||
&& !evt.getEntityPlayer().getHeldItemOffhand().isEmpty()
|
||||
&& evt.getEntityPlayer().getHeldItemOffhand().getItem() == Items.SPLASH_POTION)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
// Fake spawn egg success so splash potion does not trigger
|
||||
evt.setCancellationResult(EnumActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void rightClickItem(PlayerInteractEvent.RightClickItem evt)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Case: Ender pearl in main hand, block in offhand -> Block is NOT placed
|
||||
if (!evt.getItemStack().isEmpty()
|
||||
&& evt.getItemStack().getItem() == Items.ENDER_PEARL
|
||||
&& evt.getHand() == EnumHand.MAIN_HAND
|
||||
&& !evt.getEntityPlayer().getHeldItemOffhand().isEmpty()
|
||||
&& evt.getEntityPlayer().getHeldItemOffhand().getItem() instanceof ItemBlock)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
evt.setCancellationResult(EnumActionResult.SUCCESS); // We fake success on the ender pearl so block is not placed
|
||||
return;
|
||||
}
|
||||
|
||||
// Case: Ender pearl in main hand, bow in offhand with arrows in inv -> Bow should trigger
|
||||
// Case: Sword in main hand, ender pearl in offhand -> Nothing should happen
|
||||
if (!evt.getItemStack().isEmpty() && evt.getItemStack().getItem() == Items.ENDER_PEARL)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void interactSpecific(PlayerInteractEvent.EntityInteractSpecific evt)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger.info("LOCAL POS: {}", evt.getLocalPos());
|
||||
|
||||
if (!evt.getItemStack().isEmpty()
|
||||
&& evt.getTarget() instanceof EntityArmorStand
|
||||
&& evt.getItemStack().getItem() == Items.IRON_HELMET)
|
||||
{
|
||||
evt.setCanceled(true); // Should not be able to place iron helmet onto armor stand (you will put it on instead)
|
||||
}
|
||||
|
||||
if (!evt.getItemStack().isEmpty()
|
||||
&& evt.getTarget() instanceof EntityArmorStand
|
||||
&& evt.getItemStack().getItem() == Items.GOLDEN_HELMET)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
evt.setCancellationResult(EnumActionResult.SUCCESS);
|
||||
// Should not be able to place golden helmet onto armor stand
|
||||
// However you will NOT put it on because we fake success on the armorstand.
|
||||
}
|
||||
|
||||
if (!evt.getWorld().isRemote
|
||||
&& evt.getTarget() instanceof EntitySkeleton
|
||||
&& evt.getLocalPos().y > evt.getTarget().height / 2.0)
|
||||
{
|
||||
// If we right click the upper half of a skeleton it dies.
|
||||
evt.getTarget().setDead();
|
||||
evt.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void interactNormal(PlayerInteractEvent.EntityInteract evt)
|
||||
{
|
||||
if (!ENABLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!evt.getItemStack().isEmpty() && evt.getTarget() instanceof EntityHorse)
|
||||
{
|
||||
// Should not be able to feed wild horses with golden apple (you will start eating it in survival)
|
||||
if (evt.getItemStack().getItem() == Items.GOLDEN_APPLE
|
||||
&& evt.getItemStack().getItemDamage() == 0)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
}
|
||||
// Should not be able to feed wild horses with notch apple but you will NOT eat it
|
||||
if (evt.getItemStack().getItem() == Items.GOLDEN_APPLE
|
||||
&& evt.getItemStack().getItemDamage() == 1)
|
||||
{
|
||||
evt.setCanceled(true);
|
||||
evt.setCancellationResult(EnumActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//@Mod(modid = "playersetspawntest", name = "Player Set Spawn Test", version = "0.0.0", acceptableRemoteVersions = "*")
|
||||
public class PlayerSetSpawnTest
|
||||
{
|
||||
private static final boolean ENABLE = false;
|
||||
private static Logger logger;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
logger = event.getModLog();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerSetSpawn(PlayerSetSpawnEvent event)
|
||||
{
|
||||
logger.info("{} {}", event.isForced(), event.getNewSpawn().toString());
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
//@Mod(modid = ReachDistanceAttributeTest.MODID, name = ReachDistanceAttributeTest.MODID, version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
public class ReachDistanceAttributeTest
|
||||
{
|
||||
public static final String MODID = "reachdistanceattributetest";
|
||||
private static final Item PLATE = new ExtendedReachPlate().setRegistryName(MODID, "extended_reach_plate");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> evt) {
|
||||
evt.getRegistry().register(PLATE);
|
||||
}
|
||||
|
||||
//@Mod.EventBusSubscriber(Side.CLIENT)
|
||||
public static class ClientEvents
|
||||
{
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent evt)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(PLATE, 0, new ModelResourceLocation("minecraft:diamond_chestplate", "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class ExtendedReachPlate extends ItemArmor
|
||||
{
|
||||
private static final AttributeModifier BOOST = new AttributeModifier("extended reach plate boost", 3, 0);
|
||||
|
||||
public ExtendedReachPlate()
|
||||
{
|
||||
super(ArmorMaterial.DIAMOND, 3, EntityEquipmentSlot.CHEST);
|
||||
setUnlocalizedName("extendedReachPlate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
|
||||
{
|
||||
Multimap<String, AttributeModifier> attribs = super.getAttributeModifiers(slot, stack);
|
||||
if (slot == this.armorType)
|
||||
{
|
||||
attribs.put(EntityPlayer.REACH_DISTANCE.getName(), BOOST);
|
||||
}
|
||||
return attribs;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
//@Mod(modid = SwimSpeedAttributeTest.MODID, name = SwimSpeedAttributeTest.MODID, version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
public class SwimSpeedAttributeTest
|
||||
{
|
||||
public static final String MODID = "swimspeedattributetest";
|
||||
private static final Item PLATE = new SwimSpeedPlate().setRegistryName(MODID, "swim_speed_plate");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> evt) {
|
||||
evt.getRegistry().register(PLATE);
|
||||
}
|
||||
|
||||
//@Mod.EventBusSubscriber(Side.CLIENT)
|
||||
public static class ClientEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent evt)
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation(PLATE, 0, new ModelResourceLocation("minecraft:diamond_chestplate", "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class SwimSpeedPlate extends ItemArmor
|
||||
{
|
||||
private static final AttributeModifier BOOST = new AttributeModifier("swim speed plate boost", 3, 0);
|
||||
|
||||
public SwimSpeedPlate()
|
||||
{
|
||||
super(ArmorMaterial.DIAMOND, 3, EntityEquipmentSlot.CHEST);
|
||||
setUnlocalizedName("swimSpeedPlate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
|
||||
{
|
||||
Multimap<String, AttributeModifier> attribs = super.getAttributeModifiers(slot, stack);
|
||||
if (slot == this.armorType)
|
||||
{
|
||||
attribs.put(EntityLivingBase.SWIM_SPEED.getName(), BOOST);
|
||||
}
|
||||
return attribs;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in new issue
Block a user