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,135 +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.block;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.TNTBlock;
|
||||
import net.minecraft.entity.EntityClassification;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.item.TNTEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.network.IPacket;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
/*
|
||||
@Mod(CustomTNTTest.MODID)
|
||||
@Mod.EventBusSubscriber(modid = CustomTNTTest.MODID, bus = Bus.MOD)
|
||||
public class CustomTNTTest {
|
||||
static final String MODID = "custom_tnt_test";
|
||||
static final String BLOCK_ID = "test_tnt";
|
||||
|
||||
private static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID);
|
||||
private static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID);
|
||||
private static final DeferredRegister<EntityType<?>> ENTITIES = new DeferredRegister<>(ForgeRegistries.ENTITIES, MODID);
|
||||
|
||||
public static final RegistryObject<TNTBlock> CUSTOM_TNT = BLOCKS.register(BLOCK_ID, () -> new CustomTNTBlock(Block.Properties.from(Blocks.TNT)));
|
||||
public static final RegistryObject<EntityType<CustomTNTEntity>> CUSTOM_TNT_ENTITY = ENTITIES.register(BLOCK_ID, () -> EntityType.Builder
|
||||
.create((EntityType.IFactory<CustomTNTEntity>) CustomTNTEntity::new, EntityClassification.MISC)
|
||||
.build(BLOCK_ID));
|
||||
|
||||
static {
|
||||
ITEMS.register(BLOCK_ID, () -> new BlockItem(CUSTOM_TNT.get(), new Item.Properties()));
|
||||
}
|
||||
|
||||
public CustomTNTTest() {
|
||||
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
BLOCKS.register(modBus);
|
||||
ITEMS.register(modBus);
|
||||
ENTITIES.register(modBus);
|
||||
}
|
||||
|
||||
public static class CustomTNTBlock extends TNTBlock {
|
||||
|
||||
public CustomTNTBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExplosionDestroy(World world, BlockPos pos, Explosion explosion) {
|
||||
if (!world.isRemote) {
|
||||
TNTEntity tnt = new CustomTNTEntity(world, (float) pos.getX() + 0.5F, pos.getY(), (float) pos.getZ() + 0.5F, explosion.getExplosivePlacedBy());
|
||||
tnt.setFuse((short) (world.rand.nextInt(tnt.getFuse() / 4) + tnt.getFuse() / 8));
|
||||
world.addEntity(tnt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void catchFire(BlockState state, World world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {
|
||||
if (!world.isRemote) {
|
||||
TNTEntity tnt = new CustomTNTEntity(world, pos.getX() + 0.5F, pos.getY(), pos.getZ() + 0.5F, igniter);
|
||||
world.addEntity(tnt);
|
||||
world.playSound(null, tnt.getPosX(), tnt.getPosY(), tnt.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom TNT Entity that has a fuse of a quarter length, and four times the explosion strength
|
||||
*//*
|
||||
public static class CustomTNTEntity extends TNTEntity {
|
||||
|
||||
public CustomTNTEntity(EntityType<CustomTNTEntity> type, World world) {
|
||||
super(type, world);
|
||||
setFuse(getFuse() / 4);
|
||||
}
|
||||
|
||||
public CustomTNTEntity(World world, double x, double y, double z, @Nullable LivingEntity placer) {
|
||||
super(world, x, y, z, placer);
|
||||
setFuse(getFuse() / 4);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public EntityType<?> getType() {
|
||||
return CUSTOM_TNT_ENTITY.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void explode() {
|
||||
this.world.createExplosion(this, this.getPosX(), this.getPosY(), this.getPosZ(), 16.0F, Explosion.Mode.BREAK);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IPacket<?> createSpawnPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,191 +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.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.FarmlandWaterManager;
|
||||
import net.minecraftforge.common.ticket.AABBTicket;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
//This adds a block that creates a 4x4x4 watered region when activated
|
||||
@Mod(FarmlandWaterTest.MOD_ID)
|
||||
@Mod.EventBusSubscriber
|
||||
public class FarmlandWaterTest
|
||||
{
|
||||
static final String MOD_ID = "farmland_water_test";
|
||||
static final String BLOCK_ID = "test_block";
|
||||
static final String TILE_ID = "test_tile";
|
||||
|
||||
private static Logger logger = LogManager.getLogger(FarmlandWaterTest.class);
|
||||
|
||||
@ObjectHolder(BLOCK_ID)
|
||||
public static final Block test_block = null;
|
||||
@ObjectHolder(TILE_ID)
|
||||
public static final TileEntityType<TestTileEntity> test_tile = null;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
event.getRegistry().register(new TestBlock(Block.Properties.create(Material.ROCK)).setRegistryName(MOD_ID, BLOCK_ID));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerTileEntity(RegistryEvent.Register<TileEntityType<?>> event)
|
||||
{
|
||||
event.getRegistry().register(TileEntityType.Builder.func_223042_a(TestTileEntity::new, test_block).build(null).setRegistryName(MOD_ID, TILE_ID));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
event.getRegistry().register(new BlockItem(test_block, new Item.Properties()).setRegistryName(new ResourceLocation(MOD_ID, BLOCK_ID)));
|
||||
}
|
||||
|
||||
public static class TestBlock extends Block
|
||||
{
|
||||
public TestBlock(Block.Properties props)
|
||||
{
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TestTileEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTrace)
|
||||
{
|
||||
Optional<TestTileEntity> opt = getTE(world, pos);
|
||||
opt.ifPresent(tileEntity -> {
|
||||
tileEntity.isActive = !tileEntity.isActive;
|
||||
tileEntity.updateTicket();
|
||||
player.sendStatusMessage(new StringTextComponent("Changed block powered state to " + tileEntity.isActive), true);
|
||||
logger.info("Changed block powered state at {} to {}", pos, tileEntity.isActive);
|
||||
});
|
||||
return opt.isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
getTE(world, pos).ifPresent(TileEntity::remove);
|
||||
}
|
||||
|
||||
private Optional<TestTileEntity> getTE(World world, BlockPos pos)
|
||||
{
|
||||
if (world.isRemote) return Optional.empty();
|
||||
return Optional.ofNullable((TestTileEntity)world.getTileEntity(pos));
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestTileEntity extends TileEntity
|
||||
{
|
||||
private AABBTicket farmlandTicket;
|
||||
private boolean isActive = false;
|
||||
|
||||
public TestTileEntity()
|
||||
{
|
||||
super(FarmlandWaterTest.test_tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad()
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
farmlandTicket = FarmlandWaterManager.addAABBTicket(world, new AxisAlignedBB(pos).grow(4D));
|
||||
updateTicket();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTicket()
|
||||
{
|
||||
if (world.isRemote)
|
||||
return;
|
||||
if (isActive)
|
||||
farmlandTicket.validate();
|
||||
else
|
||||
farmlandTicket.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT compound)
|
||||
{
|
||||
compound = super.write(compound);
|
||||
compound.putBoolean("active", isActive);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT compound)
|
||||
{
|
||||
super.read(compound);
|
||||
isActive = compound.getBoolean("active");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
farmlandTicket.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,122 +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.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
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.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
//@Mod(MaterialFogColorTest.MODID)
|
||||
//@Mod.EventBusSubscriber
|
||||
public class MaterialFogColorTest
|
||||
{
|
||||
static final String MODID = "fog_color_in_material_test";
|
||||
|
||||
/*
|
||||
static
|
||||
{
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
static int color = 0xFFd742f4; // <-- change value for testing
|
||||
|
||||
public static final Fluid SLIME = new Fluid("slime", new ResourceLocation(MODID, "slime_still"), new ResourceLocation(MODID, "slime_flow"), new ResourceLocation(MODID, "slime_overlay")) {
|
||||
@Override
|
||||
public int getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
};
|
||||
|
||||
//@ObjectHolder("slime")
|
||||
//public static final BlockFluidBase SLIME_BLOCK = null;
|
||||
@ObjectHolder("test_fluid")
|
||||
public static final Block FLUID_BLOCK = null;
|
||||
@ObjectHolder("test_fluid")
|
||||
public static final Item FLUID_ITEM = null;
|
||||
|
||||
private static final ResourceLocation RES_LOC = new ResourceLocation(MODID, "slime");
|
||||
private static final ResourceLocation testFluidRegistryName = new ResourceLocation(MODID, "test_fluid");
|
||||
|
||||
@SubscribeEvent
|
||||
public void preInit(FMLCommonSetupEvent event)
|
||||
{
|
||||
FluidRegistry.registerFluid(SLIME);
|
||||
FluidRegistry.addBucketForFluid(SLIME);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
event.getRegistry().register((new BlockFluidClassic(SLIME, Material.WATER)).setRegistryName(RES_LOC).setUnlocalizedName(RES_LOC.toString()));
|
||||
Fluid fluid = new Fluid("fog_test", new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/water_flow"), new ResourceLocation("blocks/water_overlay"));
|
||||
FluidRegistry.registerFluid(fluid);
|
||||
Block fluidBlock = new BlockFluidClassic(fluid, Material.WATER)
|
||||
{
|
||||
@Override
|
||||
public Vec3d getFogColor(World world, BlockPos pos, BlockState state, Entity entity, Vec3d originalColor, float partialTicks)
|
||||
{
|
||||
return new Vec3d(0.6F, 0.1F, 0.0F);
|
||||
}
|
||||
};
|
||||
event.getRegistry().register(fluidBlock.setCreativeTab(CreativeTabs.BUILDING_BLOCKS).setUnlocalizedName(MODID + ".test_fluid").setRegistryName(testFluidRegistryName));
|
||||
}
|
||||
|
||||
@net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
event.getRegistry().register(new ItemBlock(FLUID_BLOCK).setRegistryName(testFluidRegistryName));
|
||||
}
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT, modid = MODID)
|
||||
public static class ClientEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
ModelResourceLocation fluidLocation = new ModelResourceLocation(testFluidRegistryName, "fluid");
|
||||
ModelLoader.registerItemVariants(FLUID_ITEM);
|
||||
ModelLoader.setCustomMeshDefinition(FLUID_ITEM, stack -> fluidLocation);
|
||||
ModelLoader.setCustomStateMapper(FLUID_BLOCK, new StateMapperBase() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(BlockState state)
|
||||
{
|
||||
return fluidLocation;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -1,141 +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.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
@Mod(ParticleEffectsTest.MOD_ID)
|
||||
@Mod.EventBusSubscriber
|
||||
public class ParticleEffectsTest
|
||||
{
|
||||
|
||||
public static final String MOD_ID = "block_particle_effects_test";
|
||||
public static final String BLOCK_ID = "particle_block";
|
||||
|
||||
@ObjectHolder(BLOCK_ID)
|
||||
public static final Block PARTICLE_BLOCK = null;
|
||||
|
||||
@ObjectHolder(BLOCK_ID)
|
||||
public static final Item PARTICLE_ITEM = null;
|
||||
|
||||
private static final ResourceLocation particleBlockLocation = new ResourceLocation(MOD_ID, "particle_block");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
Block block = new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(20, 0))
|
||||
{
|
||||
@Override
|
||||
public boolean addLandingEffects(BlockState state, ServerWorld world, BlockPos blockPosition, BlockState BlockState, LivingEntity entity, int numberOfParticles)
|
||||
{
|
||||
world.spawnParticle(ParticleTypes.EXPLOSION, entity.posX, entity.posY, entity.posZ, numberOfParticles, 0, 0, 0, 0.1D);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addRunningEffects(BlockState state, World world, BlockPos pos, Entity entity)
|
||||
{
|
||||
world.addParticle(ParticleTypes.EXPLOSION, entity.posX, entity.posY, entity.posZ, 1, 0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean addHitEffects(BlockState state, World world, RayTraceResult target, ParticleManager manager)
|
||||
{
|
||||
world.addParticle(ParticleTypes.EXPLOSION, target.getHitVec().x, target.getHitVec().y, target.getHitVec().z, 0, 1, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager manager)
|
||||
{
|
||||
world.addParticle(ParticleTypes.EXPLOSION, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0, 0, 1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
event.getRegistry().register(block.setRegistryName(particleBlockLocation));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
Item item = new BlockItem(PARTICLE_BLOCK, new Item.Properties()) {
|
||||
@Override
|
||||
public ITextComponent getDisplayName(ItemStack stack)
|
||||
{
|
||||
return new StringTextComponent("Particle Tests Block");
|
||||
}
|
||||
};
|
||||
event.getRegistry().register(item.setRegistryName(particleBlockLocation));
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
@EventBusSubscriber(value = Dist.CLIENT, modid = MOD_ID)
|
||||
public static class ClientEventHandler
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
ModelResourceLocation normalLoc = new ModelResourceLocation("minecraft:stone", "normal");
|
||||
ModelResourceLocation invLoc = new ModelResourceLocation("minecraft:stone", "normal");
|
||||
ModelLoader.setCustomStateMapper(PARTICLE_BLOCK, new StateMapperBase()
|
||||
{
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(BlockState state)
|
||||
{
|
||||
return normalLoc;
|
||||
}
|
||||
});
|
||||
ModelLoader.setCustomModelResourceLocation(PARTICLE_ITEM, 0, invLoc);
|
||||
}
|
||||
}
|
||||
*//*
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -1,72 +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.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.pathfinding.PathNodeType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
|
||||
@Mod(PathNodeTypeTest.MOD_ID)
|
||||
@Mod.EventBusSubscriber
|
||||
public class PathNodeTypeTest
|
||||
{
|
||||
static final String MOD_ID = "ai_node_type_test";
|
||||
static final String BLOCK_ID = "test_block";
|
||||
|
||||
|
||||
@ObjectHolder(BLOCK_ID)
|
||||
private static Block TEST_BLOCK = null;
|
||||
|
||||
/*TODO
|
||||
@SubscribeEvent
|
||||
public static void register(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
event.getRegistry().register((new Block(Block.Properties.create(Material.ROCK))
|
||||
{
|
||||
@Override
|
||||
public PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos)
|
||||
{
|
||||
return PathNodeType.DOOR_OPEN;
|
||||
}
|
||||
}).setRegistryName(MOD_ID, BLOCK_ID));
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = MOD_ID)
|
||||
public static class ClientEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
ModelLoader.setCustomStateMapper(TEST_BLOCK, block -> Collections.emptyMap());
|
||||
ModelBakery.registerItemVariants(Item.getItemFromBlock(TEST_BLOCK));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -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.block;
|
||||
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod("portal_spawn_event_test")
|
||||
@Mod.EventBusSubscriber
|
||||
public class PortalSpawnEventTest
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void onTrySpawnPortal(BlockEvent.PortalSpawnEvent event)
|
||||
{
|
||||
IWorld world = event.getWorld();
|
||||
if (world.getWorld().getDimension().getType() == DimensionType.OVERWORLD && world.getBiome(event.getPos()) != Biomes.field_222371_ax)
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in new issue
Block a user