Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 13:00:06 +01:00
Add new DispenseBehavior files from mc-dev for diff visibility.
Dieser Commit ist enthalten in:
Ursprung
ff1c1daf69
Commit
fbe609bdbe
32
src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
Normale Datei
32
src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
Normale Datei
@ -0,0 +1,32 @@
|
|||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
final class DispenseBehaviorArmor extends DispenseBehaviorItem {
|
||||||
|
|
||||||
|
DispenseBehaviorArmor() {}
|
||||||
|
|
||||||
|
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||||
|
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
|
||||||
|
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||||
|
int j = isourceblock.getBlockY() + enumfacing.d();
|
||||||
|
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||||
|
AxisAlignedBB axisalignedbb = AxisAlignedBB.a().a((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1));
|
||||||
|
List list = isourceblock.k().a(EntityLiving.class, axisalignedbb, (IEntitySelector) (new EntitySelectorEquipable(itemstack)));
|
||||||
|
|
||||||
|
if (list.size() > 0) {
|
||||||
|
EntityLiving entityliving = (EntityLiving) list.get(0);
|
||||||
|
int l = entityliving instanceof EntityHuman ? 1 : 0;
|
||||||
|
int i1 = EntityLiving.b(itemstack);
|
||||||
|
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||||
|
|
||||||
|
itemstack1.count = 1;
|
||||||
|
entityliving.setEquipment(i1 - l, itemstack1);
|
||||||
|
entityliving.a(i1, 2.0F);
|
||||||
|
--itemstack.count;
|
||||||
|
return itemstack;
|
||||||
|
} else {
|
||||||
|
return super.b(isourceblock, itemstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
Normale Datei
38
src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
Normale Datei
@ -0,0 +1,38 @@
|
|||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
|
||||||
|
|
||||||
|
private boolean b = true;
|
||||||
|
|
||||||
|
DispenseBehaviorBonemeal() {}
|
||||||
|
|
||||||
|
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||||
|
if (itemstack.getData() == 15) {
|
||||||
|
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
|
||||||
|
World world = isourceblock.k();
|
||||||
|
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||||
|
int j = isourceblock.getBlockY() + enumfacing.d();
|
||||||
|
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||||
|
|
||||||
|
if (ItemDye.a(itemstack, world, i, j, k)) {
|
||||||
|
if (!world.isStatic) {
|
||||||
|
world.triggerEffect(2005, i, j, k, 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.b = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
|
} else {
|
||||||
|
return super.b(isourceblock, itemstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void a(ISourceBlock isourceblock) {
|
||||||
|
if (this.b) {
|
||||||
|
isourceblock.k().triggerEffect(1000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||||
|
} else {
|
||||||
|
isourceblock.k().triggerEffect(1001, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
|
||||||
|
|
||||||
|
private boolean b = true;
|
||||||
|
|
||||||
|
DispenseBehaviorFlintAndSteel() {}
|
||||||
|
|
||||||
|
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||||
|
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
|
||||||
|
World world = isourceblock.k();
|
||||||
|
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||||
|
int j = isourceblock.getBlockY() + enumfacing.d();
|
||||||
|
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||||
|
|
||||||
|
if (world.isEmpty(i, j, k)) {
|
||||||
|
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
|
||||||
|
if (itemstack.isDamaged(1, world.random)) {
|
||||||
|
itemstack.count = 0;
|
||||||
|
}
|
||||||
|
} else if (world.getTypeId(i, j, k) == Block.TNT.id) {
|
||||||
|
Block.TNT.postBreak(world, i, j, k, 1);
|
||||||
|
world.setAir(i, j, k);
|
||||||
|
} else {
|
||||||
|
this.b = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void a(ISourceBlock isourceblock) {
|
||||||
|
if (this.b) {
|
||||||
|
isourceblock.k().triggerEffect(1000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||||
|
} else {
|
||||||
|
isourceblock.k().triggerEffect(1001, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
Normale Datei
19
src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
Normale Datei
@ -0,0 +1,19 @@
|
|||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
final class DispenseBehaviorTNT extends DispenseBehaviorItem {
|
||||||
|
|
||||||
|
DispenseBehaviorTNT() {}
|
||||||
|
|
||||||
|
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||||
|
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
|
||||||
|
World world = isourceblock.k();
|
||||||
|
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||||
|
int j = isourceblock.getBlockY() + enumfacing.d();
|
||||||
|
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||||
|
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), (EntityLiving) null);
|
||||||
|
|
||||||
|
world.addEntity(entitytntprimed);
|
||||||
|
--itemstack.count;
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren