为了将玩家伪装成另一个实体,我做了一个伪装课,你可以在这里看到:
public class Disguise
{
private static HashSet<Disguise> disguises = new HashSet<>();
private net.minecraft.server.v1_8_R2.EntityLiving nmsEntity;
private Player disguise;
public Disguise(Player disguise, EntityLiving entity, boolean affectLogin)
{
if(affectLogin)
disguises.add(this);
this.disguise = disguise;
this.nmsEntity = entity;
}
public Disguise(Player disguise, EntityLiving entity)
{
this(disguise, entity, true);
}
public void send(Player visible)
{
if(visible == disguise)
return;
EntityPlayer player = NMSUtils.getNMSPlayer(visible);
nmsEntity.setPosition(player.locX, player.locY, player.locZ);
nmsEntity.d(disguise.getEntityId());
nmsEntity.setCustomName(disguise.getDisplayName());
nmsEntity.setCustomNameVisible(true);
PacketPlayOutSpawnEntityLiving spawn = new PacketPlayOutSpawnEntityLiving(nmsEntity);
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(disguise.getEntityId());
player.playerConnection.sendPacket(destroy);
player.playerConnection.sendPacket(spawn);
}
public void send(List<Player> …Run Code Online (Sandbox Code Playgroud) 当我尝试在子 div 上设置 height: 100% 时,高度保持为 0。
这是父级 div:
#game-content {
margin-top: 50px;
overflow: auto;
height: 100%;
width: 100%;
}
#game-wrapper {
float: left;
margin-left: 90px;
position: relative;
height: 100%;
}Run Code Online (Sandbox Code Playgroud)
<div id="game-content">
<div id="game-wrapper">
<div class="game">
<img class="game-element" src="http://placehold.it/200x200" />
<div class="game-element" id="description">
<h4 id="game-header">Game1</h4>
Desc
</div>
</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
游戏内容的高度也是 100%(不是 0)。虽然游戏包装器的高度保持为 0,但宽度确实有效。我究竟做错了什么?
现在我有这个:
但是我需要这样的东西:
HTML
<div id="content">
<div class="block" style="height:600px;">
</div>
<div class="block" style="height:500px;">
</div>
<div class="block" style="height:500px;">
</div>
...
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.block
{
width:350px;
background-color:white;
border-radius:5px;
margin-right:80px;
margin-bottom:80px;
display:inline-block;
}
#content
{
position:relative;
display:inline;
overflow:auto;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用列,但效果不佳,即使列数高于1,它也只显示了一列.
我有 3 列,但这些列分开并在顶部重新开始。
(我将相关div标记为红色)
CSS
.block
{
background-color:white;
width:330px;
margin-bottom:25px;
display:block;
}
#content
{
-moz-column-count: 3;
-webkit-column-count: 3;
column-count:3;
display:block;
margin-top:50px;
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使 div 不分裂?