Closed jacky8399 closed 6 years ago
explosionPower is a property of a block, so there is nothing wrong to store it in NWblocktype. Fields translucent and opaque can also be useful in server-side. A example is beacon in Minecraft.
explosionPower is a property of a block, so there is nothing wrong to store it in NWblocktype.
But not every block have the ability to explode, and adding that to the struct would be redundant. Blocks can make an explosionPower field their own.
explosionPower is a property of a block, so there is nothing wrong to store it in NWblocktype.
I agree with.
Fields translucent and opaque can also be useful in server-side. A example is beacon in Minecraft.
I think it's not very useful but in order to keep the code uniform,I approve of it
@abc612008 Does explosionPower
mean "The ability of anti explosion"?
Does explosionPower mean "The ability of anti explosion"?
If that's what it means, it should be renamed to explosionResistance
in order to prevent ambiguity.
I got the point. A system which is used to store specific block information may be need to be built.
However, removing the fields translucent and opaque in server-side is not necessary and not worthy. It can bring different behaviors and make the game become difficult to develop and maintain.
@abc612008 yes,you're right
but,can you explain what explosionPower
means?
就是爆炸强度,不会炸就是0,炸得越厉害就越大
这种细节能不能不要纠结了啊(╯‵□′)╯︵┻━┻ 本来根本没啥事的地方(BlockType多点东西又不占多大内存)还说要改 这种冗余要是都改的话又麻烦又复杂
233
这种细节能不能不要纠结了啊(╯‵□′)╯︵┻━┻ 本来根本没啥事的地方(BlockType多点东西又不占多大内存)还说要改
blockType裏居然不保存比較重要的luminosity 而保存無關重要的explosionPower,這就是設計上的問題了吧。
況且,如果允許blockType加入任何property of block的話,將來是不是會在blockType加入liquidDensity, blockMobility, liquidMobility呢?
这种冗余要是都改的话又麻烦又复杂
寫程序不麻煩嗎? 修bug不麻煩嗎? 現在不改的話,將來再改不會變得更複雜嗎?
Finally,
中國有一句話,叫細節決定成敗
。
没存luminosity是因为现在没用到,blocktype还没定稿
没存luminosity是因为现在没用到,blocktype还没定稿
BlockData brightness?
luminosity和brightness有区别?
luminosity是一個方塊會發出的亮度 brightness是當前方塊的亮度 吧
explosionPower
是爆炸威力吧
为什么不把爆炸做成触发器事件之类的呢?
比如,规定方块被打火石右键之后就生成一个点燃的实体,这个实体又有一个事件是在几秒后爆炸
这样会灵活很多
luminosity指的是光度,常是科学名词,不同领域好像都有不同定义……; brightness指的是东西未经任何阻挡或处理_自行_发出来的亮度; luminance指的是辉度,中文不知道怎么定义……大概是发光能力; 干脆就叫illuminance好了,单位流明233
至于爆炸威力……为什么不专门弄个Virtual Class叫explosive呢……
至于爆炸威力……为什么不专门弄个Virtual Class叫explosive呢……
我本來打算提議弄個像Minecraft一樣的Explosion class 當觸發爆炸時new Explosion(world, radius)
然後由Explosion計算爆炸影響的方塊和生物
但是 他們已經打算把explosionPower硬編碼了 也代表Explosion class不可能出現了
至于爆炸威力……为什么不专门弄个Virtual Class叫explosive呢……
話說你這樣 如果不是int getExplosionForce(WorldObj wld, BlockPos pos)
而是int getExplosionForce()
的話 基本上就跟硬編碼沒有分別了吧..
@jacky8399 好吧,我还没看完(guo)NW的代码,还以为Explosion已经弄好了
@jacky8399 说的和我想的一致 不同意explosionPower
那先去掉就是了
qzr對我:
这种细节能不能不要纠结了啊(╯‵□′)╯︵┻━┻
qzr對@Miigon dalao
那先去掉就是了
这后面可能有不可告re
@jacky8399 1、这两句话想表达的意思其实是一样的 2、我是先回复你的,然后close了issue,可是又被批判之后reopen了,然后我就必须稍微作出让步,才有了后一句话
同意。记得以前的NW代码里的方块属性里竟然有一个bool canExplode
(大概是刚加入TNT时),这个真的没有必要,因为从ID就可以判断出来能不能爆炸了。
I agree. I remember in the past, there's even a bool canExplode
in the block property of NW. That's really unnecessary. Because you can know if the block can explode directly from its ID.
直接用id判斷能不能爆炸不就硬編碼了嗎.
boolean canExplode(Block b) {
return b.getBlockId() == 46; //TNT in Minecraft
}
我的意思是像MC這樣
/* 大概是createExplosion(@Nullable Entity e, float x, float y, float z, float exlosionPower, boolean createFire) */
public boolean onBlockActivated(/*args*/) {
worldIn.createExplosion((Entity) null, posX, posY, posZ, 4.0F, true);
}
或者是
worldIn.addExplosion(new Explosion(posX, posY, posZ, 4.0F, false))
這樣
关于硬编码,可以用符号标记代表ID,例如AIR
为0,TNT
为46。代码大概这样:
public boolean canExplode(int id)
{
return id == TNT;
}
或者通过名字:
public boolean canExplode(int id)
{
return getNameById(id) == "TNT";
}
我再重申一遍,我堅持不要硬編碼。
不要硬编码
不要硬编码
硬编码在有plugin系统下肯定不能要的啊……至少要让插件和config有修改数值的能力
explosionPower
should instead be stored in anExplosion
class created on-the-fly. Also, the fieldstranslucent
andopaque
are useful to the client only, and should not be stored inNWblocktype
.